Skip to content

Commit

Permalink
remove unused files & fix dev env
Browse files Browse the repository at this point in the history
  • Loading branch information
furkhat committed Oct 31, 2019
1 parent 9782f11 commit d5ce818
Show file tree
Hide file tree
Showing 15 changed files with 48 additions and 58 deletions.
43 changes: 0 additions & 43 deletions .gitlab-ci.yml

This file was deleted.

4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ endif
start-local:
@kubectl apply -f ./etc/kube/minikube/server.yaml
@kubectl apply -f ./etc/kube/minikube/prover.yaml
./bin/dev-update-server-vars
./bin/kube-update-server-vars
@kubectl apply -f ./etc/kube/minikube/postgres.yaml
@kubectl apply -f ./etc/kube/minikube/geth.yaml

Expand Down Expand Up @@ -271,11 +271,13 @@ dev-up:
@kubectl apply -f ./etc/kube/minikube/postgres.yaml
@kubectl create configmap tesseracts-config --from-file=./etc/tesseracts/tesseracts.toml
@kubectl apply -f ./etc/kube/minikube/geth.yaml
./bin/update-services-url-env-vars

dev-down:
@kubectl delete -f ./etc/kube/minikube/postgres.yaml
@kubectl delete -f ./etc/kube/minikube/geth.yaml
@kubectl delete configmap tesseracts-config
./bin/reset-services-url-env-vars

# Auxillary docker containers for dev environment (usually no need to build, just use images from dockerhub)

Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ Prepare dev environment prerequisites: see [docs/setup-dev.md](docs/setup-dev.md

Setup:

```franklin init```
```
franklin dev-up
franklin init
```

To completely reset the dev environment:

Expand Down Expand Up @@ -45,7 +48,7 @@ Switch between configurations:
## Monitoring & management:

Seed for Metamask: fine music test violin matrix prize squirrel panther purchase material script deal
Geth: ```geth attach $(bin/dev-geth-url)```
Geth: ```geth attach $(bin/kube-geth-url)```

NOTE: if you are resetting geth, each Metamask account must be manually reset via Settings > Advanced > Reset account.

Expand Down Expand Up @@ -83,7 +86,7 @@ Make sure you have environment variables set right, you can check it by running:

## Start server and prover in minikube (this setup is closest to prod):

- Prerequisite: ```franklin init```
- Prerequisite: ```franklin dev-up; franklin init```

- Start:
```franklin start```
Expand Down
6 changes: 4 additions & 2 deletions bin/.setup_env
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ then
eval $(grep -v '^#' $ENV_FILE | sed 's/^/export /')
set +o allexport

# Postprocessing for all configs
export KUBECONFIG=etc/kube/clusters/kubeconfig-main.yaml
if [ "dev" != "$FRANKLIN_ENV" ]
then
export KUBECONFIG=etc/kube/clusters/kubeconfig-main.yaml
fi

popd > /dev/null
fi
1 change: 1 addition & 0 deletions bin/check-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ check_tool() {

echo Checking environment

check_tool minikube
check_tool yarn
check_tool node
node --version | grep "v10.*" > /dev/null || (echo "Node version 10 is supported" && exit 1)
Expand Down
1 change: 1 addition & 0 deletions bin/db-wait
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

. .setup_env

echo $DATABASE_URL
for i in $(seq 1 5);
do pg_isready -d "$DATABASE_URL" && s=0 && break || s=$? && sleep 5;
done;
Expand Down
2 changes: 1 addition & 1 deletion bin/init
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ set -e

check-environment.sh

franklin dev-up
franklin env
franklin yarn || true # It can fail.
franklin db-wait
franklin db-setup
franklin build-contracts
franklin genesis
franklin redeploy
echo done.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions bin/reset-services-url-env-vars
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

. .setup_env

export LABEL=$FRANKLIN_ENV-Contract_deploy-`date +%Y-%m-%d-%H%M%S`
mkdir -p logs/$LABEL/
cp ./$ENV_FILE logs/$LABEL/$FRANKLIN_ENV.bak

python3 bin/replace-env-variable.py ./$ENV_FILE $(cat $ENV_FILE.example|grep "DATABASE_URL")
python3 bin/replace-env-variable.py ./$ENV_FILE $(cat $ENV_FILE.example|grep "PROVER_DATABASE_URL")
python3 bin/replace-env-variable.py ./$ENV_FILE $(cat $ENV_FILE.example|grep "WEB3_URL")
python3 bin/replace-env-variable.py ./$ENV_FILE $(cat $ENV_FILE.example|grep "TESSERACTS_URL")
12 changes: 12 additions & 0 deletions bin/update-services-url-env-vars
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

. .setup_env

export LABEL=$FRANKLIN_ENV-Contract_deploy-`date +%Y-%m-%d-%H%M%S`
mkdir -p logs/$LABEL/
cp ./$ENV_FILE logs/$LABEL/$FRANKLIN_ENV.bak

python3 bin/replace-env-variable.py ./$ENV_FILE DATABASE_URL=$(bin/kube-database-url)
python3 bin/replace-env-variable.py ./$ENV_FILE PROVER_DATABASE_URL=$(bin/kube-database-url)
python3 bin/replace-env-variable.py ./$ENV_FILE WEB3_URL=$(bin/kube-database-url)
python3 bin/replace-env-variable.py ./$ENV_FILE TESSERACTS_URL=$(bin/kube-database-url)
4 changes: 4 additions & 0 deletions docs/setup-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

Install docker.

## Minikube

https://kubernetes.io/docs/tasks/tools/install-minikube

## Node & Yarn

Install Node.
Expand Down
12 changes: 4 additions & 8 deletions etc/env/dev.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ OPERATOR_ETH_ACCOUNT_PASSWORD="fine music test"
# account stored on the local eth node.
GENESIS_ROOT=0x16026b70a351d68d7119a9a743c5e21e072bc3cb40d2355e623079499ce58f44

WEB3_URL=$(bin/dev-geth-url)
TESSERACTS_URL=$(bin/dev-tesseracts-url)
WEB3_URL=http://localhost:8545
TESSERACTS_URL=http://localhost:8000
TRUFFLE_NETWORK=universal

# Client
Expand All @@ -33,12 +33,8 @@ LOGDIR=~/var/log/
LOGFILE=$~/var/log/plasma.log

# For more details see service configuration at <franklink-dir>/etc/kube/minikube/postgres.yaml
DATABASE_URL=$(bin/dev-database-url)
PROVER_DATABASE_URL=$(bin/dev-database-url)

# in docker
#DATABASE_URL=postgres://[email protected]/plasma
#PROVER_DATABASE_URL=postgres://[email protected]/plasma
DATABASE_URL=postgres://postgres@localhost/plasma
PROVER_DATABASE_URL=postgres://postgres@localhost/plasma

DB_POOL_SIZE=10

Expand Down

0 comments on commit d5ce818

Please sign in to comment.