-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[skip audit]Pre release 1.0.1 (#873)
* Separate bin_dir and work_dir * Add docker diretory for build release images * Bug fix for handling quota used error when Revert. (#870)
- Loading branch information
Showing
7 changed files
with
314 additions
and
153 deletions.
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Docker image for CITA release | ||
|
||
## Build image | ||
|
||
Script is comming soon! | ||
|
||
## Usage | ||
|
||
### Using docker command | ||
|
||
* Create a CITA chain config. | ||
|
||
```shell | ||
docker run -v `pwd`:/opt/cita-run cita/cita-release:1.0.0-secp256k1-sha3 cita create --super_admin "0x37d1c7449bfe76fe9c445e626da06265e9377601" --nodes "127.0.0.1:4000" | ||
``` | ||
|
||
Tips: CITA image uses `/opt/cita-run` as its default work_dir, so you should mount `pwd` to it. | ||
|
||
* Setup & run CITA | ||
|
||
```shell | ||
docker run -d -p 1337:1337 -v `pwd`:/opt/cita-run cita/cita-release:1.0.0-secp256k1-sha3 /bin/bash -c 'cita setup test-chain/0 && cita start test-chain/0 && sleep infinity' | ||
``` | ||
|
||
Cool! Just two simple command, you have build a CITA blockchain in you computer. | ||
Enjoy it! | ||
|
||
### Using docker-compose | ||
|
||
```shell | ||
cd sample && docker-compose up | ||
``` |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
FROM cita/cita-run:ubuntu-18.04-20190829 | ||
LABEL maintainer="Cryptape Technologies <[email protected]>" | ||
|
||
## Install CITA release here | ||
ARG ENCRYPTION_ALG=secp256k1 | ||
ARG HASH_ALG=sha3 | ||
RUN mkdir -p /opt/cita | ||
|
||
WORKDIR /opt/cita | ||
COPY cita_${ENCRYPTION_ALG}_${HASH_ALG}.tar.gz . | ||
|
||
# Keep tar package here for md5 test | ||
RUN tar -xf cita_${ENCRYPTION_ALG}_${HASH_ALG}.tar.gz \ | ||
&& mv cita_${ENCRYPTION_ALG}_${HASH_ALG}/* /opt/cita \ | ||
&& rm -rf cita_${ENCRYPTION_ALG}_${HASH_ALG} | ||
|
||
# Set CITA_HOME | ||
ENV CITA_HOME=/opt/cita | ||
# Set PATH to cita binary | ||
ENV PATH=/opt/cita/bin:${PATH} | ||
## End of install CITA release | ||
|
||
COPY entrypoint.sh /usr/bin/ | ||
RUN chmod +x /usr/bin/entrypoint.sh | ||
|
||
WORKDIR /opt/cita-run | ||
|
||
ENTRYPOINT ["/usr/bin/entrypoint.sh"] | ||
CMD ["cita", "bebop", "help"] |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
if [ "${USER_ID}" = "0" ] || [ "${USER_ID}" = "" ]; then | ||
# Run with "root" | ||
exec "$@" | ||
else | ||
# Add local user(name=user) use USER_ID | ||
useradd --shell /bin/bash -u "${USER_ID}" -o -c "" -d /opt user | ||
# Can use sudo without password | ||
echo "user ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers | ||
|
||
exec /usr/sbin/gosu user "$@" | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
version: '3' | ||
|
||
services: | ||
config: | ||
container_name: config | ||
environment: | ||
- USER_ID | ||
- SUPER_ADMIN=0x4b5ae4567ad5d9fb92bc9afd6a657e6fa13a2523 | ||
- NODES_CONFIG=node0:4000, node1:4001 | ||
image: cita/cita-release:1.0.0-secp256k1-sha3 | ||
hostname: config | ||
networks: | ||
main: | ||
aliases: | ||
- config | ||
volumes: | ||
- ./:/opt/cita-run | ||
command: | | ||
bash -c ' | ||
echo "Create config files..."; | ||
cita create --super_admin "$$SUPER_ADMIN" --nodes "$$NODES_CONFIG"; | ||
echo "Done config"' | ||
node0: | ||
container_name: node0 | ||
depends_on: | ||
- config | ||
environment: | ||
- USER_ID | ||
image: cita/cita-release:1.0.0-secp256k1-sha3 | ||
hostname: node0 | ||
networks: | ||
main: | ||
aliases: | ||
- node0 | ||
volumes: | ||
- ./:/opt/cita-run | ||
ports: | ||
- "1337:1337" | ||
command: | | ||
bash -c ' | ||
while [[ ! -d /opt/cita-run/test-chain ]]; do sleep 1; done; | ||
sleep 10; | ||
cita setup test-chain/0; | ||
cita start test-chain/0; | ||
sleep infinity' | ||
node1: | ||
container_name: node1 | ||
depends_on: | ||
- config | ||
environment: | ||
- USER_ID | ||
image: cita/cita-release:1.0.0-secp256k1-sha3 | ||
hostname: node1 | ||
networks: | ||
main: | ||
aliases: | ||
- node1 | ||
volumes: | ||
- ./:/opt/cita-run | ||
ports: | ||
- "1338:1338" | ||
command: | | ||
bash -c ' | ||
while [[ ! -d /opt/cita-run/test-chain ]]; do sleep 1; done; | ||
sleep 10; | ||
cita setup test-chain/1; | ||
cita start test-chain/1; | ||
sleep infinity' | ||
networks: | ||
main: |
Oops, something went wrong.