This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: Fixes substrate-node-template docker issues #13039
Closed
ltfschoen
wants to merge
18
commits into
paritytech:ds/template-readme
from
ltfschoen:luke/ds/template-readme
Closed
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ee80cb9
fix substrate-node-template docker issues
ltfschoen b32857b
update readme mention port 9944 must be available
ltfschoen a02f333
use multiline yaml format. use printf instead of echo so newline char…
ltfschoen 56ab70a
remove unnecessary Cargo.lock
ltfschoen e0e7d72
update readme
ltfschoen 4e6b9fa
do not need to specify location of Cargo.toml file
ltfschoen 6f76297
do not need specify where Cargo.toml is with manifest
ltfschoen aa1cdd8
make compatible with legacy versions
ltfschoen afb1053
remove verbose
ltfschoen 3d24527
remove switching on and off the stopping of execution errors showing …
ltfschoen 3efaf03
wip: remove old docker-compose.yml
ltfschoen 815d9b3
wip: rename docker-compose-legacy.yml -> docker-compose.yml
ltfschoen 3b09510
reduce to single docker-compose.yml file with switch for services: line
ltfschoen 811a010
Update bin/node-template/scripts/docker_run.sh
ltfschoen 9af37b2
wip - works but missing ldd /usr/local/bin/node-template as cannot in…
ltfschoen e42b875
fix functionality
ltfschoen 919c639
update gitignore
ltfschoen 08b559e
remove trap debug
ltfschoen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
version: "3.2" | ||
|
||
services: | ||
# first line of this file must be reserved for use by ./scripts/docker_run.sh | ||
dev: | ||
container_name: node-template | ||
image: paritytech/ci-linux:production | ||
working_dir: /var/www/node-template | ||
working_dir: /var/www/node-template/node | ||
ports: | ||
- "9944:9944" | ||
environment: | ||
- CARGO_HOME=/var/www/node-template/.cargo | ||
volumes: | ||
- .:/var/www/node-template | ||
- type: bind | ||
source: ./.local | ||
target: /root/.local | ||
- ./.cargo/registry:/root/.cargo/registry | ||
- ./.local:/root/.local | ||
- ../../.git:/var/www/node-template/.git | ||
- ../../frame:/var/frame | ||
- ../../utils:/var/utils | ||
- ../../client:/var/client | ||
- ../../primitives:/var/primitives | ||
command: bash -c "cargo build --release && ./target/release/node-template --dev --ws-external" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you maybe put them into the
target/
dir, so I wont forget deleting them eventually?Also do you know if there is a way to not make docker chown these folders with root?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cheers, i'm working on fixing all that, i'll push some commits and tell you when its done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i've pushed changes that address your comments.
in the changes when i added a workspace bin/node-template/Cargo.toml file instead of only building the bin/node-template/node directory that fixed the location of the /target directory, and adding to docker-compose.yml
CARGO_HOME=/var/www/node-template/target/.cargo
allows .cargo files to be kept in the /target dir.in the entrypoint.sh script i use
usermod
to load the existing non-root user callednonroot
that has already been added to the prebuilt docker image 'paritytech/ci-linux:production', then i usechown -R nonroot:nonroot ...
to change ownership of the relevant folders like the chain directory and other hidden folders that get used like:/var/www/node-template/target/debug/.cargo-lock
/var/www/node-template/target/.cargo/registry/index/github.com-x/.git/config.lock
/var/www/node-template/target/debug/build/anyhow-x/invoked.timestamp
i also create a symlink from the chain data folder to /data, so we can have a single static dev chain folder, which you can specify with
--base-path=/data
, which makes it easier to access to prune since otherwise the directory might change each time and clutters up storage.i also run arguments that the user passes into the script with
su -c "$args" nonroot
, whereargs=$@
.