Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Web deploy prerequisites #1851

Merged
merged 71 commits into from
Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from 54 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
016018e
reduce bundle size
sabau Jan 17, 2019
d3848ed
Trying to remove lcdMockClient from our production build
sabau Jan 17, 2019
7b2b801
split per module, this will boost network in modern browsers
sabau Jan 17, 2019
46f4f20
Merge branch 'web' into sabau/web/1833-deploy-prerequisites
sabau Jan 21, 2019
64c81d8
add +e error flag for security circleci check
sabau Jan 21, 2019
d64e66e
remove unnecessary test, mock removed from node
sabau Jan 21, 2019
967ffb1
test audit job
sabau Jan 21, 2019
1edf21d
Undo audit job test
sabau Jan 21, 2019
ac5e061
Merge remote-tracking branch 'origin/sabau/web/1833-deploy-prerequisi…
sabau Jan 21, 2019
36f4120
remove Low from security audit check
sabau Jan 21, 2019
27b8aa7
WIP automation to deploy frontend and backend
sabau Jan 22, 2019
1b67222
fix certificate names
sabau Jan 22, 2019
95c9c0b
Merge branch 'web' into sabau/web/1833-deploy-prerequisites
sabau Jan 24, 2019
f5ce8e7
boot scripts, S3 to pass info and autofaucet stuff
sabau Jan 24, 2019
1026a0c
Merge remote-tracking branch 'origin/sabau/web/1833-deploy-prerequisi…
sabau Jan 24, 2019
0a7feb4
working boot process
sabau Jan 24, 2019
05a2cd1
progress on automation
sabau Jan 25, 2019
56bc3fd
Merge branch 'develop' into sabau/web/1833-deploy-prerequisites
sabau Jan 29, 2019
753fd41
clean deploy
sabau Jan 30, 2019
7cc72f8
route to voyager.ninja
sabau Jan 30, 2019
feaaca6
route to voyager.ninja
sabau Jan 30, 2019
6c0cba7
favicon, config and restore full lodash for a single instance using it
sabau Jan 30, 2019
4a2bbcc
Merge remote-tracking branch 'origin/develop' into sabau/web/1833-dep…
Jan 30, 2019
350162d
fix for empty accounts
Jan 30, 2019
5ddd0de
add aliases, replace bash deploy with orb sync job, seems easier to read
sabau Jan 31, 2019
7afb09d
Merge branch 'sabau/web/1833-deploy-prerequisites' of github.com:cosm…
sabau Jan 31, 2019
f8e549c
fix commands definition
sabau Jan 31, 2019
3add0a3
fix commands definition
sabau Jan 31, 2019
ad0e32d
indentation fix on circleci commands
sabau Jan 31, 2019
f4a7d6e
indentation fix on circleci commands
sabau Jan 31, 2019
6de0f30
simplify workflow until we merge mircea work
sabau Jan 31, 2019
66cf411
only after test we deploy
sabau Jan 31, 2019
f81241e
damsn build is everywhere
sabau Jan 31, 2019
ce35078
renaming
sabau Jan 31, 2019
db13411
no params for now
sabau Jan 31, 2019
15245af
restore build job
sabau Jan 31, 2019
c5cf5d5
build only clean and safe dependency
sabau Jan 31, 2019
2177370
changelog
sabau Jan 31, 2019
08e998e
random naming does not make circleci happy
sabau Jan 31, 2019
08496c8
mkdir for stats
sabau Jan 31, 2019
a72e9cb
build do not need the bundle on circle ci
sabau Jan 31, 2019
8023c9e
experiment deploy on this branch
sabau Jan 31, 2019
fb97647
Merge branch 'develop' into sabau/web/1833-deploy-prerequisites
sabau Jan 31, 2019
a474d0d
remove side effect: helpers taken out to be tested, runner does not r…
sabau Jan 31, 2019
f01e1b9
reduce unnecessary movements, keep things where they are
sabau Jan 31, 2019
65364ee
little refactor circleci
sabau Jan 31, 2019
ef6904c
rename folders, try to upload without nesting
sabau Jan 31, 2019
303282a
comments on circleci configuration
sabau Jan 31, 2019
7ffa670
dev dependency fix
sabau Jan 31, 2019
ffa9e31
check mounted of App
sabau Feb 1, 2019
3925acc
add some test on store
sabau Feb 1, 2019
a41e20d
config to js to switch localhost VS remote nodes
sabau Feb 1, 2019
e4215d4
import properly new pumped up config.js
sabau Feb 1, 2019
82d34dc
fix node env flag
sabau Feb 1, 2019
5a99626
Update circle.ebs_deploy.sh
faboweb Feb 1, 2019
9a0d2a6
- restore source map for Sentry
sabau Feb 1, 2019
be42509
Merge remote-tracking branch 'origin/sabau/web/1833-deploy-prerequisi…
sabau Feb 1, 2019
09c8d76
fallback configuration to allow builder to choose their values
sabau Feb 1, 2019
d45f655
keep the old name, now is hardcoded on github
sabau Feb 1, 2019
163bbcf
remove duplicated yarn upgrade, restore fixed version
sabau Feb 1, 2019
0b87b33
wait for genesis from main node
sabau Feb 2, 2019
081e394
Merge branch 'develop' into sabau/web/1833-deploy-prerequisites
sabau Feb 5, 2019
70feb28
Update app/src/renderer/vuex/store.js
faboweb Feb 5, 2019
32d91e2
subscribe logic
sabau Feb 8, 2019
200f406
custom image for voyager build / AWS deployment (#1942)
Feb 12, 2019
ea4d09e
test startApp
sabau Feb 12, 2019
88f6b4a
test route guard
sabau Feb 12, 2019
5bb6b87
comment e2e code in circleci, in this moment is not used, remove aws …
sabau Feb 12, 2019
bb6bd6c
Document build command with parameters, remove deploy bash script
sabau Feb 12, 2019
24ff2c4
patch for cosmos-sdk new mandatory parameter
sabau Feb 12, 2019
386e076
Update test/unit/specs/App.spec.js
faboweb Feb 13, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .aws/.ebextensions/00_ssl_certificate.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
container_commands:
copy_ssl_key:
command: cp .ebextensions/star.voyager.ninja.key /etc/nginx/conf.d/star.voyager.ninja.key
copy_ssl_crt:
command: cp .ebextensions/star.voyager.ninja.crt /etc/nginx/conf.d/star.voyager.ninja.crt
copy_ssl_dhparam:
command: cp .ebextensions/dhparam.pem /etc/nginx/conf.d/dhparam.pem
60 changes: 60 additions & 0 deletions .aws/.ebextensions/01_nginx_custom.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
files:
sabau marked this conversation as resolved.
Show resolved Hide resolved
"/etc/nginx/conf.d/elasticbeanstalk-nginx-docker-proxy.conf":
mode: "000644"
owner: root
group: root
content: |
map $http_upgrade $connection_upgrade {
default "upgrade";
"" "";
}

server {
listen 80;
listen 443 ssl http2;

ssl_certificate /etc/nginx/conf.d/ninja.voyager.com.crt;
ssl_certificate_key /etc/nginx/conf.d/ninja.voyager.com.key;

ssl_prefer_server_ciphers on;
ssl_ciphers #ADDPROPER ONE#!MD5;

ssl_dhparam /etc/nginx/conf.d/dhparam.pem;
ssl_session_cache shared:SSL:5m;
ssl_session_timeout 1h;

# add_header Strict-Transport-Security "max-age=15768000; includeSubDomains" always;


gzip on;
gzip_comp_level 4;
gzip_types text/html text/plain text/css application/json

if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})T(\d{2})") {
set $year $1;
set $month $2;
set $day $3;
set $hour $4;
}
access_log /var/log/nginx/healthd/application.log.$year-$month-$day-$hour healthd;

access_log /var/log/nginx/access.log;

location / {
proxy_pass http://docker;
proxy_http_version 1.1;

proxy_set_header Connection $connection_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

container_commands:
# Remove the default nginx configuration generated by elastic beanstalk
removeconfig:
command: "rm -f /etc/nginx/sites-available/elasticbeanstalk-nginx-docker-proxy.conf /etc/nginx/sites-enabled/elasticbeanstalk-nginx-docker-proxy.conf"
# nginx_restart:
# command: "service nginx restart"
2 changes: 2 additions & 0 deletions .aws/.ebextensions/dhparam.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-----BEGIN DH PARAMETERS-----
-----END DH PARAMETERS-----
9 changes: 9 additions & 0 deletions .aws/.ebextensions/https-instance-securitygroup.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Resources:
sslSecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
Properties:
GroupId: {"Fn::GetAtt" : ["AWSEBSecurityGroup", "GroupId"]}
IpProtocol: tcp
ToPort: 443
FromPort: 443
CidrIp: 0.0.0.0/0
Empty file added .aws/Dockerfile
Empty file.
16 changes: 16 additions & 0 deletions .aws/Dockerrun.aws.tpl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "<DOCKER_REPO_URL>:<BUILD_NO>",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "9070"
},
{
"ContainerPort": "26657"
}
],
"Logging": "/home/webadmin/logs/"
}
52 changes: 52 additions & 0 deletions .aws/first.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/bin/bash
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to include .aws files? @cosmos/sre ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those are used by the current (temporary) node setup on EC2, until the real network boot on merge is ready


PASSWORD=1234567890
ACCOUNT=main_account
PORT=26657
API_PORT=8080
NETWORK=testnet
AMOUNT=100stake

./gaiad init --home . --moniker ${ACCOUNT} --chain-id ${NETWORK}
sabau marked this conversation as resolved.
Show resolved Hide resolved
NODEID=$(./gaiad tendermint show-node-id --home .)
echo ${PASSWORD} | ./gaiacli keys add ${ACCOUNT} --home . > main_node.log
./gaiad add-genesis-account $(./gaiacli keys show ${ACCOUNT} --home . --address) 150000stake,100000photino,123cococoin --home .

echo ${PASSWORD} | ./gaiad gentx --name ${ACCOUNT} --home . --home-client .
./gaiad collect-gentxs --home .

aws s3 cp config/genesis.json s3://cosmos-gaia/genesis.json

# boot proper nodes in reachable detached sessions
screen -dmS gaia ./gaiad start --home .
screen -dmS rest ./gaiacli rest-server --laddr tcp://0.0.0.0:${API_PORT} --home . --node http://localhost:${PORT} --chain-id ${NETWORK} --trust-node true

# get my address to use it as source of richness for others
ADDRESS=$(./gaiacli keys show ${ACCOUNT} --home . --address)

while true
do
# Is anyone asking for money
LIST=$(aws s3 ls s3://cosmos-gaia/addresses/)
sabau marked this conversation as resolved.
Show resolved Hide resolved
if [[ -n "${LIST}" ]];
then
PID=$(lsof -ti tcp:${API_PORT})
jbibla marked this conversation as resolved.
Show resolved Hide resolved
if [[ -n "${PID}" ]];
then
# we cannot use gaiacli while the rest server is running, it locks the resources
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in theory we could have a second gaiacli instance where we import the main key which performs the action

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

correct! @mircea-c told me something like this will become true in their infrastructure + stargate will be on a separate machine, so for now I left the hacky solution, but I'll add a TODO to remember that when we'll adopt the real network deployment this PID stuff has to be removed, sounds ok?

kill -9 ${PID}
fi

echo ${LIST} | while IFS= read -r row || [[ -n "$row" ]]; do
# for every file in the list pick the address and give money to it, then delete the file
DESTINATION=$(echo $row | awk '{print $4}')
# Just in case we were running this command with rest-server switched on
ADDRESS=$(./gaiacli keys show ${ACCOUNT} --home . --address)
echo ${PASSWORD} | ./gaiacli tx send --home . --from ${ADDRESS} --amount=${AMOUNT} --to=${DESTINATION} --chain-id=${NETWORK}
aws s3 rm s3://cosmos-gaia/addresses/${DESTINATION}
done

#restore the server
screen -dmS rest ./gaiacli rest-server --laddr tcp://0.0.0.0:${API_PORT} --home . --node http://localhost:${PORT} --chain-id ${NETWORK} --trust-node true
fi
done
40 changes: 40 additions & 0 deletions .aws/others.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

PASSWORD=1234567890
ACCOUNT=operator_account
PORT=26656
MAINNODEID=d08c69fa85969f3d0173f23aadc40268559d0f66
MAINNODEIP=172.31.35.89
MAINACCOUNT=main_account
NETWORK=testnet
VALIDATOR_AMOUNT=10stake

./gaiad init --home . --moniker ${ACCOUNT} --chain-id ${NETWORK}

# GET Genesis file into config/genesis.json
NODEID=$(./gaiad tendermint show-node-id --home .)

# boot referring to the remote node
screen -dmS gaia ./gaiad start --home . --p2p.laddr=tcp://0.0.0.0:$((PORT)) --address=tcp://0.0.0.0:$((PORT+1)) --rpc.laddr=tcp://0.0.0.0:$((PORT+2)) --p2p.persistent_peers="$MAINNODEID@$MAINNODEIP:$((PORT))"

# get the key to make my node validator
PUBKEY=$(./gaiad tendermint show-validator --home .)
echo ${PASSWORD} | ./gaiacli keys add ${ACCOUNT} --home . > secondary_node.log
ADDRESS=$(./gaiacli keys show ${ACCOUNT} --home . --address)
echo ${PUBKEY} > ./${ADDRESS}

# ask money by declaring my node
aws s3 cp ${ADDRESS} s3://cosmos-gaia/addresses/${ADDRESS}

poor=true
sabau marked this conversation as resolved.
Show resolved Hide resolved
while ${poor}
do
#
ACCOUNT_INFO=$(./gaiacli query account ${ADDRESS} --chain-id ${NETWORK} --trust-node --home .)
if [[ ${ACCOUNT_INFO} == *"auth/Account"* ]]; then
echo "Address funded, thanks main node!"
poor=false
fi
done

echo ${PASSWORD} | ./gaiacli tx staking create-validator --home . --from ${ACCOUNT} --amount=${VALIDATOR_AMOUNT} --pubkey=${PUBKEY} --address-delegator=${ADDRESS} --moniker=${ACCOUNT} --chain-id=${NETWORK} --commission-max-change-rate=0 --commission-max-rate=0 --commission-rate=0 --json
Loading