[GH-ISSUE #1030] Question: Why am I getting permission errors when building the dev container AND proposed implementation for the API. #2155

Closed
opened 2026-03-01 17:56:54 +03:00 by kerem · 2 comments
Owner

Originally created by @djkemmet on GitHub (Sep 20, 2022).
Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1030

Hi all,

Per the documentation I would like to start this post with my proposed implementation for the REST API:

I propose to build a REST API for Archivebox using Django Rest Framework. This seems to be the most straight forward and actually reasonably quick to knock out since it should amount "bolt on" type work vs an entirely new implementation in something I intended to configure pagination and token based authentication and then using generics and mixins as much as possible so the barrier to entry on extending and maintaining the API is very low. One Additional feature I would like to add to the API is a threads, which allows users to topically (whereas a TAG allows sorting by kind) and organize their resources that make them more valuable to share.

First let me start by saying I am new to containers and basically know enough to orient myself but do not know anything sophisticated. My current challenge is when trying to complete step 2b to install archive box into the container passing through the data dir the container when I run:

sudo docker run -it -v $PWD/data:/data archivebox init --setup
I get the following error:

`
Change in ownership detected, please be patient while we chown existing files
This could take some time...
[i] [2022-09-19 03:00:34] ArchiveBox v0.6.3: archivebox init --setup
> /data

[^] Verifying and updating existing ArchiveBox collection to v0.6.3...

[*] Verifying archive folder structure...
+ ./archive, ./sources, ./logs...
+ ./ArchiveBox.conf...

[*] Verifying main SQL index and running any migrations needed...
Traceback (most recent call last):
File "/usr/local/bin/archivebox", line 33, in
sys.exit(load_entry_point('archivebox', 'console_scripts', 'archivebox')())
File "/app/archivebox/cli/init.py", line 140, in main
run_subcommand(
File "/app/archivebox/cli/init.py", line 80, in run_subcommand
module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore
File "/app/archivebox/cli/archivebox_init.py", line 43, in main
init(
File "/app/archivebox/util.py", line 114, in typechecked_function
return func(*args, **kwargs)
File "/app/archivebox/main.py", line 344, in init
for migration_line in apply_migrations(out_dir):
File "/app/archivebox/util.py", line 114, in typechecked_function
return func(*args, **kwargs)
File "/app/archivebox/index/sql.py", line 143, in apply_migrations
call_command("makemigrations", interactive=False, stdout=null)
File "/usr/local/lib/python3.10/site-packages/django/core/management/init.py", line 168, in call_command
return command.execute(*args, **defaults)
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 371, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 85, in wrapped
res = handle_func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/makemigrations.py", line 182, in handle
self.write_migration_files(changes)
File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/makemigrations.py", line 220, in write_migration_files
with open(writer.path, "w", encoding='utf-8') as fh:
PermissionError: [Errno 13] Permission denied: '/app/archivebox/core/migrations/0021_auto_20220919_0300.py'
`

Troubleshooting notes:
Ubuntu 20.04.5, latest docker, python 3.8 is system default,
I'm running my docker commands with sudo,
I've looked around the repo for that file but I don't think it even exists.
I've made no modifications to the dockerfile other than to add DRF requirements to the project.
checked my directory permissions and they look good.
Running inside or out of the VENV has no effect.
I am running the docker build command for the TLD of the repo.

Can anyone please advise?

Originally created by @djkemmet on GitHub (Sep 20, 2022). Original GitHub issue: https://github.com/ArchiveBox/ArchiveBox/issues/1030 Hi all, [Per the documentation](https://github.com/ArchiveBox/ArchiveBox#archivebox-development) I would like to start this post with my proposed implementation for the REST API: I propose to build a REST API for Archivebox using Django Rest Framework. This seems to be the most straight forward and actually reasonably quick to knock out since it should amount "bolt on" type work vs an entirely new implementation in something I intended to configure pagination and token based authentication and then using generics and mixins as much as possible so the barrier to entry on extending and maintaining the API is very low. One Additional feature I would like to add to the API is a threads, which allows users to topically (whereas a TAG allows sorting by kind) and organize their resources that make them more valuable to share. First let me start by saying I am new to containers and basically know enough to orient myself but do not know anything sophisticated. My current challenge is when trying to complete step 2b to install archive box into the container passing through the data dir the container when I run: `sudo docker run -it -v $PWD/data:/data archivebox init --setup ` I get the following error: ` Change in ownership detected, please be patient while we chown existing files This could take some time... [i] [2022-09-19 03:00:34] ArchiveBox v0.6.3: archivebox init --setup > /data [^] Verifying and updating existing ArchiveBox collection to v0.6.3... [*] Verifying archive folder structure... + ./archive, ./sources, ./logs... + ./ArchiveBox.conf... [*] Verifying main SQL index and running any migrations needed... Traceback (most recent call last): File "/usr/local/bin/archivebox", line 33, in <module> sys.exit(load_entry_point('archivebox', 'console_scripts', 'archivebox')()) File "/app/archivebox/cli/__init__.py", line 140, in main run_subcommand( File "/app/archivebox/cli/__init__.py", line 80, in run_subcommand module.main(args=subcommand_args, stdin=stdin, pwd=pwd) # type: ignore File "/app/archivebox/cli/archivebox_init.py", line 43, in main init( File "/app/archivebox/util.py", line 114, in typechecked_function return func(*args, **kwargs) File "/app/archivebox/main.py", line 344, in init for migration_line in apply_migrations(out_dir): File "/app/archivebox/util.py", line 114, in typechecked_function return func(*args, **kwargs) File "/app/archivebox/index/sql.py", line 143, in apply_migrations call_command("makemigrations", interactive=False, stdout=null) File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 168, in call_command return command.execute(*args, **defaults) File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 371, in execute output = self.handle(*args, **options) File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 85, in wrapped res = handle_func(*args, **kwargs) File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/makemigrations.py", line 182, in handle self.write_migration_files(changes) File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/makemigrations.py", line 220, in write_migration_files with open(writer.path, "w", encoding='utf-8') as fh: PermissionError: [Errno 13] Permission denied: '/app/archivebox/core/migrations/0021_auto_20220919_0300.py' ` Troubleshooting notes: Ubuntu 20.04.5, latest docker, python 3.8 is system default, I'm running my docker commands with sudo, I've looked around the repo for that file but I don't think it even exists. I've made no modifications to the dockerfile other than to add DRF requirements to the project. checked my directory permissions and they look good. Running inside or out of the VENV has no effect. I am running the docker build command for the TLD of the repo. Can anyone please advise?
Author
Owner

@pirate commented on GitHub (Sep 22, 2022):

Can you try with 0.6.2 instead, the latest dev branch has some bugs that I need to fix.

Also are you open to considering FastAPI or other alternatives to Django Rest Framework? DRF often ends up being quite verbose with lots of validation/forms work needed.

Thanks for your interest and help here!

<!-- gh-comment-id:1255501198 --> @pirate commented on GitHub (Sep 22, 2022): Can you try with 0.6.2 instead, the latest dev branch has some bugs that I need to fix. Also are you open to considering FastAPI or other alternatives to Django Rest Framework? DRF often ends up being quite verbose with lots of validation/forms work needed. Thanks for your interest and help here!
Author
Owner

@pirate commented on GitHub (Jun 13, 2023):

doing a github issue cleanup, closing this for now since it's a bit stale and I think this particular migrations issue has been fixed already.

Comment back here or on https://github.com/ArchiveBox/ArchiveBox/issues/496 if you're working on the new API implementation and have any fresh problems

<!-- gh-comment-id:1589103315 --> @pirate commented on GitHub (Jun 13, 2023): doing a github issue cleanup, closing this for now since it's a bit stale and I think this particular migrations issue has been fixed already. Comment back here or on https://github.com/ArchiveBox/ArchiveBox/issues/496 if you're working on the new API implementation and have any fresh problems
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ArchiveBox#2155
No description provided.