Skip to content

Instantly share code, notes, and snippets.

@ndavison
Last active February 28, 2018 01:25
Show Gist options
  • Save ndavison/b14df5021a131dc2dcad20bb536e2c01 to your computer and use it in GitHub Desktop.
Save ndavison/b14df5021a131dc2dcad20bb536e2c01 to your computer and use it in GitHub Desktop.
DTA marketplace dev build
#!/bin/bash
#
# Digital Marketplace dev environment build script.
#
# use brew to install the following before running this script:
#
# postgres 9.6.x
# nvm
# 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 clone and install dependencies, and 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
. $(brew --prefix nvm)/nvm.sh
nvm use stable
cd dto-digitalmarketplace-api
virtualenv venv
. ./venv/bin/activate
make requirements
make requirements_for_test
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)
# If you're not on High Sierra, you may need to change the below AppleScript to number the tabs (e.g. tab 1 of front window,
# tab 2 of front window, tab 3... etc) rather than all being tab 1.
cat <<EOF > setup.scpt
tell application "Terminal"
activate
do script "nvm use stable; 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;" in tab 1 of front window
my makeTab()
do script "nvm use stable; cd ${CURDIR}/dto-digitalmarketplace-api;source ./venv/bin/activate; make app_run; " in tab 1 of front window
my makeTab()
do script "nvm use stable; cd ${CURDIR}/dto-digitalmarketplace-frontend;npm run build:development;" in tab 1 of front window
my makeTab()
do script "nvm use stable; cd ${CURDIR}/dto-digitalmarketplace-frontend;npm run server:development;" in tab 1 of front window
my makeTab()
do script "nvm use stable; 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 make run_app;" in tab 1 of front window
my makeTab()
do script "nvm use stable; cd ${CURDIR}/dto-digitalmarketplace-buyer-frontend; sudo -S pkill lighttpd; ./scripts/reverse_proxy.sh;" in tab 1 of front window
my makeTab()
do script "nvm use stable; 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;" in tab 1 of front window
end tell
on makeTab()
tell application "System Events" to keystroke "t" using {command down}
delay 0.2
end makeTab
EOF
cat <<EOF > start.sh
#!/bin/bash
osascript setup.scpt
EOF
chmod +x start.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment