-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #377 from district0x/config-via-env
Load & serve config from filesystem during runtime (SERVER_CONFIG_PATH, UI_CONFIG_PATH)
- Loading branch information
Showing
39 changed files
with
1,894 additions
and
1,605 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 |
---|---|---|
|
@@ -13,4 +13,3 @@ designs/deploy | |
tags | ||
temp | ||
release | ||
config |
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
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
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
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 |
---|---|---|
@@ -1,41 +1,53 @@ | ||
ETHLANCE_SOURCE_ROOT=/home/madis/code/district0x/ethlance | ||
ETHLANCE_ENV=qa | ||
export ETHLANCE_ENV=qa | ||
DEPLOY_TARGET=mad.is:~/www/ethlance | ||
|
||
## Smart contracts | ||
cd $ETHLANCE_SOURCE_ROOT | ||
ETHLANCE_ENV=qa npx truffle migrate --network ethlance.mad.is-testnet --reset | ||
# | ||
|
||
##################### | ||
## UI: prepare assets | ||
##################### | ||
cd $ETHLANCE_SOURCE_ROOT/ui && yarn | ||
rm -rf .cpcache/* .shadow-cljs/* | ||
cd $ETHLANCE_SOURCE_ROOT/ui && ETHLANCE_ENV=qa npx shadow-cljs -A:local-deps release dev-ui | ||
export ETHLANCE_CONFIG_PATH=/home/madis/code/district0x/ethlance-config/config/ui-config-qa.edn | ||
export SMART_CONTRACTS_BUILD_PATH=/home/madis/code/district0x/ethlance/resources/public/contracts/build | ||
export SMART_CONTRACTS=/home/madis/code/district0x/ethlance/shared/src/ethlance/shared/smart_contracts_qa.cljs | ||
cd $ETHLANCE_SOURCE_ROOT/ui && ETHLANCE_ENV=qa npx shadow-cljs release dev-ui | ||
# To compile with local dependencies defined under :local-deps alias | ||
ETHLANCE_ENV=qa clj -A:dev:shadow-cljs:local-deps release dev-ui | ||
|
||
cd $ETHLANCE_SOURCE_ROOT/ui && ./node_modules/less/bin/lessc resources/public/less/main.less resources/public/css/main.css --verbose | ||
|
||
## UI: copy assets | ||
rsync --progress -ru resources/public/{css,images,index.html,js} ../resources/public/contracts $DEPLOY_TARGET/ui | ||
|
||
################## | ||
## Server: compile | ||
################## | ||
ETHLANCE_SERVER_ROOT=/home/madis/temp/ethlance/server | ||
|
||
cd $ETHLANCE_SOURCE_ROOT/server | ||
# Need to clear shadow-cljs cache to force the slurp macro to be evaluated again | ||
# because the clojure file didn't change but the .edn config file did | ||
# Alternatively the ethlance.server.core must be touched after changing config | ||
rm -rf .shadow-cljs/* .cpcache/* | ||
rm -rf .shadow-cljs/* .cpcache/* out/* | ||
|
||
# Release deployment | ||
ETHLANCE_ENV=qa npx shadow-cljs -A:local-deps release dev-server | ||
export ETHLANCE_CONFIG_PATH=/home/madis/code/district0x/ethlance-config/config/server-config-qa.edn | ||
ETHLANCE_ENV=qa npx shadow-cljs release dev-server | ||
# To compile including local changes to libraries: | ||
ETHLANCE_ENV=qa clj -A:dev:shadow-cljs:local-deps release dev-server | ||
rsync --progress -ru out/ethlance_server.js out/ethlance_server.js.map package.json $DEPLOY_TARGET/server | ||
|
||
## Start server (on remote machine/container) | ||
cd $ETHLANCE_SERVER_ROOT && yarn | ||
cd $ETHLANCE_SERVER_ROOT && node ethlance_server.js | ||
|
||
## Server Postgres | ||
# $ sudo -u postgres psql | ||
# > CREATE DATABASE ethlance; | ||
# > CREATE USER ethlanceuser WITH ENCRYPTED PASSWORD 'pass'; | ||
# > GRANT ALL PRIVILEGES ON DATABASE ethlance TO ethlanceuser; | ||
sudo -u postgres psql <<EOS | ||
CREATE DATABASE ethlance; | ||
CREATE USER ethlanceuser WITH ENCRYPTED PASSWORD 'pass'; | ||
GRANT ALL PRIVILEGES ON DATABASE ethlance TO ethlanceuser; | ||
EOS |
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
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.