Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Local dev watch mode #104

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ services:
WEBSSH2_LOCATION: 'http://127.0.0.1:8081'
ports:
- "8080:80"
volumes:
- './src:/usr/share/nginx/html'
# WebSSH2 is also required for terminal functionality - provides a websocket-to-ssh proxy for the front-end
webssh2:
image: "antidotelabs/webssh2:ping-timeout"
Expand Down
6 changes: 2 additions & 4 deletions hack/Dockerfile-dev
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
# This is a DEVELOPMENT dockerfile, and therefore includes no npm build
# steps. It is assumed this has already been run, and therefore needs only
# a webserver. It is also not meant to be built directly, but rather through
# the provided Makefile ("make hack")
# steps. The build steps are accomplished by the dev.sh script in the
# /src/scripts directory.

FROM nginx
COPY src/ /usr/share/nginx/html
COPY launch.sh /
CMD ["/launch.sh"]
4 changes: 4 additions & 0 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
"rollup-plugin-terser": "^5.1.3"
},
"scripts": {
"dev": "CLEAN_INSTALL=true COMPOSE_UP=true sh scripts/dev.sh",
"dev:up": "COMPOSE_UP=true sh scripts/dev.sh",
"dev:down": "COMPOSE_DOWN=true sh scripts/dev.sh",
"dev-restart": "COMPOSE_RESTART=true sh scripts/dev.sh",
"build": "npx rollup -c",
"watch": "npx rollup -cw",
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
38 changes: 38 additions & 0 deletions src/scripts/dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh
# set -x # this line will enable debugs
ANTIDOTE_WEB_ENV=mock
export ANTIDOTE_WEB_ENV
if [ "$CLEAN_INSTALL" == "true" ]; then
# install deps
cd ../src
npm install
# This links the above antidote-ui-components into the src/node_modules directory
npm link ../../antidote-ui-components
# Cleanup
rm -rf advisor/ labs/ stats/ collections/ catalog/
# Set up for a clean build
mkdir -p advisor/ labs/ stats/ collections/ catalog/
cd ../templates
# Create the virtual python environment 'venv'
virtualenv venv/
# Activate the virtual environment
source venv/bin/activate
pip install jinja2
python generate_webapp.py
# Leave the virtual environment
deactivate
fi
if [ "$COMPOSE_UP" == "true" ]; then
docker-compose build --no-cache
docker-compose up -d
echo "Cluster started. Run 'docker-compose logs' to see log output."
fi
if [ "$COMPOSE_DOWN" == "true" ]; then
docker-compose down
fi
if [ "$COMPOSE_RESTART" == "true" ]; then
docker-compose down
docker-compose build --no-cache
docker-compose up -d
echo "Cluster started. Run 'docker-compose logs' to see log output."
fi