Last active
February 1, 2019 03:29
-
-
Save ndavison/136c06e3d73f2473d396901db2062fe1 to your computer and use it in GitHub Desktop.
DTA marketplace build v2 (bash only)
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
#!/bin/bash | |
# | |
# Digital Marketplace dev environment build script. | |
# | |
# use brew to install the following before running this script: | |
# | |
# postgres 9.6.x | |
# nvm | |
# yarn | |
# bower | |
# cairo | |
# pango | |
# lighttpd | |
# | |
# you will also need an instance of the marketplace DB running in a Postgres database named 'digitalmarketplace', e.g.: | |
# | |
# createdb digitalmarketplace | |
# psql digitalmarketplace < dump.sql | |
# | |
# this will output the 'start.sh' script, which launches the dev environment. | |
# | |
git clone https://github.com/AusDTO/dto-digitalmarketplace-frontend.git | |
git clone https://github.com/AusDTO/dto-digitalmarketplace-buyer-frontend.git | |
git clone https://github.com/AusDTO/dto-digitalmarketplace-api.git | |
git clone https://github.com/AusDTO/dto-digitalmarketplace-supplier-frontend.git | |
git clone https://github.com/AusDTO/dto-digitalmarketplace-admin-frontend.git | |
nvm install 9.4.0 | |
. $(brew --prefix nvm)/nvm.sh | |
nvm use 9.4.0 | |
cd dto-digitalmarketplace-api | |
virtualenv venv | |
. ./venv/bin/activate | |
make requirements | |
make requirements_for_test | |
# MACOS pycurl fix: | |
pip uninstall pycurl | |
PYCURL_SSL_LIBRARY=openssl LDFLAGS="-L/usr/local/opt/openssl/lib" CPPFLAGS="-I/usr/local/opt/openssl/include" pip install --no-cache-dir pycurl | |
cd .. | |
cd dto-digitalmarketplace-frontend | |
virtualenv venv | |
. ./venv/bin/activate | |
yarn install | |
cd .. | |
cd dto-digitalmarketplace-buyer-frontend | |
virtualenv venv | |
. ./venv/bin/activate | |
pip install -r requirements.txt | |
./scripts/build.sh | |
cd .. | |
cd dto-digitalmarketplace-supplier-frontend | |
virtualenv venv | |
. ./venv/bin/activate | |
pip install -r requirements.txt | |
npm install | |
bower install | |
npm run frontend-build:development | |
cd .. | |
cd dto-digitalmarketplace-admin-frontend | |
virtualenv venv | |
npm install | |
. ./venv/bin/activate | |
make requirements frontend_build | |
cd .. | |
CURDIR=$(pwd) | |
cat <<EOF > start.sh | |
#!/bin/bash | |
trap "exit" INT TERM | |
trap "kill 0" EXIT | |
. \$(brew --prefix nvm)/nvm.sh | |
nvm use stable | |
# start the buyer FE | |
cd "${CURDIR}/dto-digitalmarketplace-buyer-frontend" | |
source ./venv/bin/activate | |
DM_DATA_API_URL=http://localhost:5000/api/ | |
DM_DATA_API_AUTH_TOKEN=myToken | |
REACT_BUNDLE_URL=http://localhost:60000/bundle/ | |
REACT_RENDER_URL=http://localhost:60000/render | |
python application.py runserver & | |
# start the API | |
cd "${CURDIR}/dto-digitalmarketplace-api" | |
source ./venv/bin/activate | |
make app_run & | |
# start the celery worker and beat scheduler | |
cd "${CURDIR}/dto-digitalmarketplace-api" | |
source ./venv/bin/activate | |
./scripts/run_celery_worker_and_beat.sh & | |
# start the FE | |
cd "${CURDIR}/dto-digitalmarketplace-frontend" | |
npm run build:development & | |
npm run server:development & | |
# start the supplier FE | |
cd "${CURDIR}/dto-digitalmarketplace-supplier-frontend" | |
source ./venv/bin/activate | |
DM_DATA_API_URL=http://localhost:5000/api/ | |
DM_DATA_API_AUTH_TOKEN=myToken | |
REACT_BUNDLE_URL=http://localhost:60000/bundle/ | |
REACT_RENDER_URL=http://localhost:60000/render | |
npm run frontend-build:development | |
make run_app & | |
# start the http proxy | |
cd "${CURDIR}/dto-digitalmarketplace-buyer-frontend" | |
./scripts/build.sh | |
./scripts/reverse_proxy.sh & | |
# start the admin FE | |
cd "${CURDIR}/dto-digitalmarketplace-admin-frontend" | |
source ./venv/bin/activate | |
DM_DATA_API_URL=http://localhost:5000/api/ | |
DM_DATA_API_AUTH_TOKEN=myToken | |
REACT_BUNDLE_URL=http://localhost:60000/bundle/ | |
REACT_RENDER_URL=http://localhost:60000/render | |
make run_app & | |
for CPID in \$(jobs -p); do | |
wait $CPID | |
done | |
EOF | |
chmod +x start.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment