Skip to content

Commit

Permalink
fix: clean up Docker directory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed May 2, 2021
1 parent 4f96b2c commit a97d0b3
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 66 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ jobs:
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: agoric/cosmic-swingset-solo
dockerfile: packages/cosmic-swingset/lib/ag-solo/Dockerfile
context: packages/cosmic-swingset/lib/ag-solo
dockerfile: packages/solo/Dockerfile
context: packages/solo
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
snapshot: true
Expand Down
2 changes: 1 addition & 1 deletion docker/ag-setup-solo
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ else
fi
exec docker run \
-p127.0.0.1:$HOST_PORT:$PORT \
--volume=ag-solo-state:/agoric/solo \
--volume=ag-solo-state:/data/solo \
--volume=$HOME/.agoric:/root/.agoric \
-eAG_SOLO_BASEDIR="$SOLO_HOME" \
--rm -it $FLAGS \
Expand Down
2 changes: 1 addition & 1 deletion docker/ag-solo
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ else
FLAGS=-p127.0.0.1:$HOST_PORT:$PORT
fi
exec docker run \
--volume=ag-solo-state:/agoric/solo \
--volume=ag-solo-state:/data/solo \
--volume=$HOME/.agoric:/root/.agoric \
-eAG_SOLO_BASEDIR="$SOLO_HOME" \
--rm -it $FLAGS \
Expand Down
4 changes: 0 additions & 4 deletions packages/cosmic-swingset/.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ provisioning-server
solo
build
node_modules
lib/ag-solo/ui/node_modules
lib/ag-solo/ui/build
lib/lib*.h
lib/lib*.so
ve[0-9]
t[0-9]
binding.gyp
Expand Down
2 changes: 1 addition & 1 deletion packages/cosmic-swingset/bin/ag-nchainz
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ thisdir=$(cd "$(dirname -- "$real0")" && pwd -P)
PATHCONFIG=nchainz/config/paths
CLI=ag-cosmos-helper
DAEMON=ag-chain-cosmos
SOLO=$thisdir/ag-solo
SOLO=$thisdir/../solo/bin/ag-solo
SKIP=no
COMMAND=

Expand Down
5 changes: 1 addition & 4 deletions packages/deployment/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ RUN ln -sf $PWD/ag-setup-cosmos /usr/local/bin/
COPY package*.json .
RUN npm install --production

# Add the ag-solo, so we can deploy it via Ansible.
COPY --from=agoric/cosmic-swingset-solo /usr/src/agoric-sdk/packages/cosmic-swingset/lib/ag-solo/ /usr/src/agoric-sdk/packages/cosmic-swingset/lib/ag-solo/

COPY . .
WORKDIR /agoric/chains
WORKDIR /data/chains

ENTRYPOINT [ "ag-setup-cosmos" ]
3 changes: 3 additions & 0 deletions packages/deployment/Dockerfile.sdk
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ WORKDIR /usr/src
COPY --from=build-js /usr/src/agoric-sdk agoric-sdk
COPY --from=build-js /root/go/bin/ag-cosmos-helper /usr/local/bin/
RUN ln -s /usr/src/agoric-sdk/packages/cosmic-swingset/bin/ag-chain-cosmos /usr/local/bin/
RUN ln -s /usr/src/agoric-sdk/packages/solo/bin/ag-solo /usr/local/bin/
RUN ln -s /usr/src/agoric-sdk/packages/agoric-cli/bin/agoric /usr/local/bin/
COPY . lib/ag-solo/

# By default, run the daemon with specified arguments.
WORKDIR /root
Expand Down
2 changes: 1 addition & 1 deletion packages/deployment/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ docker-build-setup:
docker tag $(REPOSITORY)-setup:$(TAG) $(REPOSITORY)-setup:latest

docker-build-solo:
docker build --build-arg=TAG=$(TAG) -t $(REPOSITORY)-solo:$(TAG) $(SS)lib/ag-solo
docker build --build-arg=TAG=$(TAG) -t $(REPOSITORY)-solo:$(TAG) ../solo
docker tag $(REPOSITORY)-solo:$(TAG) $(REPOSITORY)-solo:latest

docker-build-deployment:
Expand Down
50 changes: 3 additions & 47 deletions packages/deployment/ansible/roles/copy/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,6 @@
mode: push
when: HELPER_BINARY is defined

- name: Agoric SDK exists
delegate_to: localhost
stat:
path: "/usr/src/agoric-sdk"
register: ws

- name: "Synchronize install directory {{APPDIR}}"
synchronize:
src: "{{APPDIR}}/"
dest: "/usr/src/cosmic-swingset/"
dirs: yes
delete: yes
checksum: yes
mode: push
rsync_opts:
- "--exclude=.git"
- "--exclude=setup"
- "--exclude=.vscode"
- "--exclude=chains"
- "--exclude=x"
- "--exclude=t[0-9]*"
- "--exclude=provisioning-server"
when: not ws.stat.exists

- name: Synchronize Agoric SDK
synchronize:
src: "/usr/src/agoric-sdk/"
Expand All @@ -39,35 +15,15 @@
delete: yes
checksum: yes
mode: push
when: ws.stat.exists

- name: Remove cosmic-swingset to prepare for linking
file:
path: /usr/src/cosmic-swingset
state: absent
when: ws.stat.exists

- name: Symlink cosmic-swingset
file:
src: /usr/src/agoric-sdk/packages/cosmic-swingset
dest: /usr/src/cosmic-swingset
state: link
when: ws.stat.exists

- name: "Symlink ag-chain-cosmos"
file:
src: "/usr/src/cosmic-swingset/bin/ag-chain-cosmos"
src: "/usr/src/agoric-sdk/packages/cosmic-swingset/bin/ag-chain-cosmos"
dest: "/usr/local/bin/ag-chain-cosmos"
state: link

- name: "Symlink /usr/src/ag-solo"
file:
src: "/usr/src/cosmic-swingset"
dest: /usr/src/ag-solo
state: link

- name: "Symlink /usr/local/bin/ag-solo"
- name: "Symlink ag-solo"
file:
src: "/usr/src/cosmic-swingset/bin/ag-solo"
src: "/usr/src/agoric-sdk/packages/solo/bin/ag-solo"
dest: "/usr/local/bin/ag-solo"
state: link
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ DELEGATE_COINS=62000000ubld,93000000urun
OP=$1
shift

case $OP in
show-faucet-address)
exec ag-cosmos-helper --home=$FAUCET_HOME \
keys show -a \
--keyring-backend=test \
-- faucet
exit $?
;;
done

chainName=$(cat "$thisdir/ag-chain-cosmos/chain-name.txt")
IFS=, read -r -a origRpcAddrs <<<"$(AG_SETUP_COSMOS_HOME=$thisdir ag-setup-cosmos show-rpcaddrs)"

Expand Down
2 changes: 1 addition & 1 deletion packages/deployment/docker/ag-setup-cosmos
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ show-*)
;;
esac
exec docker run --rm $TTY $FLAGS \
--volume=ag-setup-cosmos-chains:/agoric/chains \
--volume=ag-setup-cosmos-chains:/data/chains \
--volume=ag-chain-cosmos-state:/root/.ag-chain-cosmos \
--volume=/var/run/docker.sock:/var/run/docker.sock \
--env AG_SETUP_COSMOS_NAME=$NETWORK_NAME \
Expand Down
5 changes: 5 additions & 0 deletions packages/deployment/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,13 +380,17 @@ show-config display the client connection parameters
const allIds = await needBacktick(
`${shellEscape(progname)} show-all-ids`,
);
const faucetAddress = await needBacktick(
`${shellEscape(progname)} show-faucet-address`,
);
await Promise.all(
dsts.map(async (dst, i) => {
// Update the config.toml and genesis.json.
await needDoRun([
agoricCli,
`set-defaults`,
`ag-chain-cosmos`,
`--bootstrap-address=${faucetAddress}`,
`--persistent-peers=${peers}`,
`--seeds=${seeds}`,
`--unconditional-peer-ids=${allIds}`,
Expand Down Expand Up @@ -514,6 +518,7 @@ ${chalk.yellow.bold(`ag-setup-solo --netconfig='${dwebHost}/network-config'`)}
break;
}

case 'show-faucet-address':
case 'add-egress':
case 'add-delegate': {
await inited();
Expand Down
5 changes: 1 addition & 4 deletions packages/solo/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
ARG TAG=latest
FROM agoric/agoric-sdk:$TAG

WORKDIR /usr/src/agoric-sdk/packages/cosmic-swingset
RUN ln -sf $PWD/bin/ag-solo $PWD/node_modules/.bin/agoric /usr/local/bin/
COPY . lib/ag-solo/
WORKDIR /agoric/solo
WORKDIR /data/solo

EXPOSE 8000
ENTRYPOINT [ "ag-solo", "--webhost=0.0.0.0", "--webport=8000" ]

0 comments on commit a97d0b3

Please sign in to comment.