Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Command to run app with docker doesn't work #739

Closed
Tracked by #738
josecelano opened this issue Sep 27, 2024 · 2 comments · Fixed by #740
Closed
Tracked by #738

Docs: Command to run app with docker doesn't work #739

josecelano opened this issue Sep 27, 2024 · 2 comments · Fixed by #740
Assignees
Labels
Bug Incorrect Behavior Documentation Improves Instructions, Guides, and Notices
Milestone

Comments

@josecelano
Copy link
Member

Parent issue: #738
Source: https://docs.rs/torrust-index/latest/torrust_index/index.html#run-with-docker

mkdir -p ./storage/database \
  && export USER_ID=1000 \
  && docker run -it \
    --user="$USER_ID" \
    --publish 3001:3001/tcp \
    --volume "$(pwd)/storage":"/app/storage" \
    torrust/index
+ '[' -z 1000 ]
+ adduser --disabled-password --shell /bin/sh --uid 1000 torrust
adduser: permission denied (are you root?)
+ mkdir -p /var/lib/torrust/index/database/ /etc/torrust/index/
mkdir: can't create directory '/var/lib/torrust/index/database/': Permission denied
+ chown -R 1000 /var/lib/torrust /var/log/torrust /etc/torrust
chown: /var/lib/torrust/index: Operation not permitted
chown: /var/lib/torrust/index: Operation not permitted
chown: /var/lib/torrust: Operation not permitted
chown: /var/lib/torrust: Operation not permitted
chown: /var/log/torrust/index: Operation not permitted
chown: /var/log/torrust/index: Operation not permitted
chown: /var/log/torrust: Operation not permitted
chown: /var/log/torrust: Operation not permitted
chown: /etc/torrust/index: Operation not permitted
chown: /etc/torrust/index: Operation not permitted
chown: /etc/torrust: Operation not permitted
chown: /etc/torrust: Operation not permitted
+ chmod -R 2770 /var/lib/torrust /var/log/torrust /etc/torrust
chmod: /var/lib/torrust: Operation not permitted
chmod: /var/lib/torrust: Operation not permitted
chmod: /var/log/torrust: Operation not permitted
chmod: /var/log/torrust: Operation not permitted
chmod: /etc/torrust: Operation not permitted
chmod: /etc/torrust: Operation not permitted
+ '[' -n sqlite3 ]
+ cmp_lc sqlite3 sqlite3
+ clean sqlite3
+ echo sqlite3
+ tr -d -c a-zA-Z0-9-
+ to_lc sqlite3
+ echo sqlite3
+ tr '[:upper:]' '[:lower:]'
+ clean sqlite3
+ echo sqlite3
+ tr -d -c a-zA-Z0-9-
+ to_lc sqlite3
+ echo sqlite3
+ tr '[:upper:]' '[:lower:]'
+ '[' sqlite3 '=' sqlite3 ]
+ default_database=/usr/share/torrust/default/database/index.sqlite3.db
+ default_config=/usr/share/torrust/default/config/index.container.sqlite3.toml
+ install_config=/etc/torrust/index/index.toml
+ install_database=/var/lib/torrust/index/database/sqlite3.db
+ inst /usr/share/torrust/default/config/index.container.sqlite3.toml /etc/torrust/index/index.toml
+ '[' -n /usr/share/torrust/default/config/index.container.sqlite3.toml ]
+ '[' -n /etc/torrust/index/index.toml ]
+ '[' -e /usr/share/torrust/default/config/index.container.sqlite3.toml ]
+ '[' '!' -e /etc/torrust/index/index.toml ]
+ install -D -m 0640 -o torrust -g torrust /usr/share/torrust/default/config/index.container.sqlite3.toml /etc/torrust/index/index.toml
install: unknown user torrust
+ inst /usr/share/torrust/default/database/index.sqlite3.db /var/lib/torrust/index/database/sqlite3.db
+ '[' -n /usr/share/torrust/default/database/index.sqlite3.db ]
+ '[' -n /var/lib/torrust/index/database/sqlite3.db ]
+ '[' -e /usr/share/torrust/default/database/index.sqlite3.db ]
+ '[' '!' -e /var/lib/torrust/index/database/sqlite3.db ]
+ install -D -m 0640 -o torrust -g torrust /usr/share/torrust/default/database/index.sqlite3.db /var/lib/torrust/index/database/sqlite3.db
install: unknown user torrust
+ cmp_lc release runtime
+ clean release
+ echo release
+ tr -d -c a-zA-Z0-9-
+ to_lc release
+ echo release
+ tr '[:upper:]' '[:lower:]'
+ clean runtime
+ echo runtime
+ tr -d -c a-zA-Z0-9-
+ to_lc runtime
+ echo runtime
+ tr '[:upper:]' '[:lower:]'
+ '[' release '=' runtime ]
+ cmp_lc release debug
+ clean release
+ echo release
+ tr -d -c a-zA-Z0-9-
+ to_lc release
+ echo release
+ tr '[:upper:]' '[:lower:]'
+ clean debug
+ echo debug
+ tr -d -c a-zA-Z0-9-
+ to_lc debug
+ echo debug
+ tr '[:upper:]' '[:lower:]'
+ '[' release '=' debug ]
+ cmp_lc release release
+ clean release
+ echo release
+ tr -d -c a-zA-Z0-9-
+ to_lc release
+ echo release
+ tr '[:upper:]' '[:lower:]'
+ clean release
+ echo release
+ tr -d -c a-zA-Z0-9-
+ to_lc release
+ echo release
+ tr '[:upper:]' '[:lower:]'
+ '[' release '=' release ]
/usr/local/bin/entry.sh: line 66: can't create /etc/motd: Permission denied
+ '[' -e /usr/share/torrust/container/message ]
/usr/local/bin/entry.sh: line 72: can't create /etc/motd: Permission denied
+ chmod 0644 /etc/motd
chmod: /etc/motd: No such file or directory
/usr/local/bin/entry.sh: line 77: can't create /etc/profile: Permission denied
+ cd /home/torrust
/usr/local/bin/entry.sh: cd: line 79: can't cd to /home/torrust: No such file or directory
+ exit 1
@josecelano josecelano added Bug Incorrect Behavior Documentation Improves Instructions, Guides, and Notices labels Sep 27, 2024
@josecelano josecelano added this to the v3.0.0 milestone Sep 27, 2024
@josecelano
Copy link
Member Author

The new docker configuration requires executing the container as root. We can't pass this argument: --user="$USER_ID" \.

cd /tmp \
  && mkdir torrust-index \
  && cd torrust-index \
  && export USER_ID=1000 \
  && docker run -it \
    --env USER_ID="$USER_ID" \
    --publish 3001:3001/tcp \
    --volume "$(pwd)/storage/index/lib":"/var/lib/torrust/index" \
    --volume "$(pwd)/storage/index/log":"/var/log/torrust/index" \
    --volume "$(pwd)/storage/index/etc":"/etc/torrust/index" \
    torrust/index:develop

You can also create the needed folder manually:

cd /tmp \
  && mkdir torrust-index \
  && cd torrust-index \
  && mkdir -p ./storage/index/lib/database \
  && mkdir -p ./storage/index/log \
  && mkdir -p ./storage/index/etc \
  && sqlite3 "./storage/index/lib/database/sqlite3.db" "VACUUM;" \
  && export USER_ID=1000 \
  && docker run -it \
    --env USER_ID="$USER_ID" \
    --publish 3001:3001/tcp \
    --volume "$(pwd)/storage/index/lib":"/var/lib/torrust/index" \
    --volume "$(pwd)/storage/index/log":"/var/log/torrust/index" \
    --volume "$(pwd)/storage/index/etc":"/etc/torrust/index" \
    torrust/index:develop

@josecelano
Copy link
Member Author

@josecelano josecelano self-assigned this Sep 30, 2024
@josecelano josecelano linked a pull request Oct 2, 2024 that will close this issue
josecelano added a commit to josecelano/torrust-index that referenced this issue Oct 2, 2024
josecelano added a commit that referenced this issue Oct 2, 2024
7f605b1 fix: clippy errors (Jose Celano)
fdf62e9 docs: [#739] fix command to run with docker (Jose Celano)
15adcb9 docs: [#738] fix command (Jose Celano)

Pull request description:

  Fix the command to run the index from sources after compilation.

ACKs for top commit:
  josecelano:
    ACK 7f605b1

Tree-SHA512: f0b7161fc038db601da31b30f5a1dad4ecd90d1cfda7630526b612b6895e543ae15adbae91aef9274b420cb3ec172c3c914072df62121f2feb9b1d69f80f2da1
josecelano added a commit that referenced this issue Oct 2, 2024
8383e3b release: version 3.0.0 (Jose Celano)
7f605b1 fix: clippy errors (Jose Celano)
fdf62e9 docs: [#739] fix command to run with docker (Jose Celano)
15adcb9 docs: [#738] fix command (Jose Celano)
17de729 refactor: moved test to authorization mod (Mario)
e3baeda test: new authorization test for guests to download a torrent file searching by info hash (Mario)
6df7a7e refactor: moved test to new authorization mod (Mario)
3c046b1 refactor: move authorization test for guests to new mod (Mario)
840e1d8 ci: move testing with MySQL to a new workflow (Jose Celano)
b0a458c develop: bump to version 3.0.0-develop (Jose Celano)

Pull request description:

  Release Version 3.0.0

ACKs for top commit:
  josecelano:
    ACK 8383e3b

Tree-SHA512: 9a623e32ba350fc11798bf18b3f494bb95ced3a012d378447fa64dc658d306de2755d17d15d5a241478d3ecb54ed30e86392f3ec02360753a4fbf9bb64fc52dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Incorrect Behavior Documentation Improves Instructions, Guides, and Notices
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant