Created
April 27, 2019 18:11
-
-
Save mcr/bc6335c36bc139962e6de04734bce5bb to your computer and use it in GitHub Desktop.
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
elros-[projects/shg/staging] mcr 10113 %cat staging.sh | |
#!/bin/sh | |
set -e | |
MOUNT="--mount source=comet_certs,target=/app/certificates --mount source=eeylops_devices,target=/app/devices" | |
if docker ps | grep eeylops; then | |
docker stop eeylops_staging | |
docker rm eeylops_staging || true | |
fi | |
set -v | |
docker build -t shg_comet:eeylops comet | |
docker run --rm --link staging_db:postgres -it shg_comet:eeylops bundle _2.0.1_ exec rake db:migrate | |
docker run --rm --link staging_db:postgres $MOUNT shg_comet:eeylops bundle exec rake highway:h0_set_hostname HOSTNAME=eeylops.sandelman.ca PORT=9443 | |
docker run --rm --link staging_db:postgres $MOUNT shg_comet:eeylops bundle exec rake highway:h1_bootstrap_ca highway:h2_bootstrap_masa highway:h3_bootstrap_mud highway:h4_masa_server_cert highway:h5_idevid_ca | |
docker run --name eeylops_staging -p 9443:9443 --rm -itd --link staging_db:postgres $MOUNT shg_comet:eeylops $@ | |
docker network connect --ip 172.30.3.26 --ip6 2607:f0b0:f:3::26 service-network eeylops_staging | |
sleep 1 | |
NSPID=$(docker inspect -f '{{ .State.Pid }}' eeylops_staging) | |
sudo mkdir -p /var/run/netns | |
sudo rm -f "/var/run/netns/$NSPID" | |
sudo ln -s "/proc/$NSPID/ns/net" "/var/run/netns/$NSPID" | |
sudo ip netns exec $NSPID ip ad add 209.87.249.26/32 dev eth1 | |
sudo ip netns exec $NSPID ip ad sh | |
sudo ip netns exec $NSPID ip route change default via 172.30.3.1 src 209.87.249.26 | |
sudo ip netns exec $NSPID sysctl -w net.ipv4.ip_forward=1 | |
sudo ip netns exec $NSPID sysctl -w net.ipv6.conf.all.forwarding=1 | |
#docker exec -it eeylops_staging tail -f log/production.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment