This repository was 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.7k
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 all 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [workspace] | ||
| members = [ | ||
| "node", | ||
| "pallets/template", | ||
| "runtime", | ||
| ] | ||
| [profile.release] | ||
| panic = "unwind" |
This file contains hidden or 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 hidden or 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,21 @@ | ||
| 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 | ||
| ports: | ||
| - "9933:9933" | ||
| - "9944:9944" | ||
| - "9615:9615" | ||
| - "30333:30333" | ||
| environment: | ||
| - CARGO_HOME=/var/www/node-template/.cargo | ||
| - CARGO_HOME=/var/www/node-template/target/.cargo | ||
| volumes: | ||
| - .:/var/www/node-template | ||
| - type: bind | ||
| source: ./.local | ||
| target: /root/.local | ||
| command: bash -c "cargo build --release && ./target/release/node-template --dev --ws-external" | ||
| - ../../frame:/var/frame | ||
| - ../../utils:/var/utils | ||
| - ../../client:/var/client | ||
| - ../../primitives:/var/primitives | ||
| - ./entrypoint.sh:/entrypoint.sh | ||
| entrypoint: ["/bin/sh", "/entrypoint.sh"] |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| args=$@ | ||
| cargo build --release | ||
|
|
||
| # we do not need to use `useradd` to create another non-root user since we are | ||
| # using a pre-built image that has already created one called 'nonroot': | ||
| # see https://hub.docker.com/r/paritytech/ci-linux/tags > "production" > Layer 12 | ||
| usermod -u 1000 -s /bin/sh -d /var/www/node-template nonroot | ||
| mkdir -p /data /var/www/node-template/.local/share/node-template | ||
| # change owner to non-root user of static symlink directory for storing chain data | ||
| chown -R nonroot:nonroot /data | ||
| # change owner to non-root user for hidden subdirectories of their home directory | ||
| chown -R nonroot:nonroot /var/www/node-template/.[^.]* | ||
| # change owner to non-root user for non-hidden subdirectories of their home directory | ||
| chown -R nonroot:nonroot /var/www/node-template | ||
|
|
||
| # ignore warning: `Not copying any file from skel directory into it.` | ||
| symlink=/var/www/node-template/.local/share/node-template/data | ||
| # create symlink if not already exist | ||
| [ ! -L ${symlink} ] && ln -s /data /var/www/node-template/.local/share/node-template | ||
| # copy skel files to user nonroot home directory if it already exists | ||
| cp -r /etc/skel/. /var/www/node-template | ||
| # sanity checks | ||
| ldd -d -r -v /var/www/node-template/target/release/node-template | ||
|
|
||
| # switch to non-root user. show version of node-template. | ||
| su -c "printf \"\n*** Changed to the home directory ${PWD} of user: \" && id \ | ||
| && /var/www/node-template/target/release/node-template --version" nonroot | ||
|
|
||
| # handle when arguments not provided. run arguments provided to script. | ||
| if [ "$args" = "" ] ; then | ||
| su -c "printf \"Note: Please try providing an argument to the script.\n\n\"" nonroot | ||
| exit 1 | ||
| else | ||
| su -c "printf \"*** Running the provided arguments: $args\n\n\"" nonroot | ||
| su -c "$args" nonroot | ||
| fi |
This file contains hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.