Skip to content

Commit

Permalink
Finish the devapp-serve
Browse files Browse the repository at this point in the history
- Change the docker-compose to make non-reloading be the default (for easy start)
- Add the branch to the config to make it easier to test out different branches
- Add a `README` to clarify how everything works
  • Loading branch information
shankari committed Mar 2, 2020
1 parent 966723b commit 9b4ef89
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
22 changes: 22 additions & 0 deletions examples/em-phone-devapp-serve/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
This is an example of setting up a server for the devapp. You can use it over
use case scenarios:
- deploy the code from a particular branch, or
- mount the source from a directory on the host to allow for local editing.

#### Just deploy the code for exploration ####

Use without any changes. The code will be checked out to the container, and
will be removed when the container is removed.

#### Deploy the container for editing ####

- Include the currently commented out volume
- Look through all the `CHANGEME` locations and fill them out.
```
$ grep -r CHANGEME .
```
Some of these are required; others are optional.
- The code will be mounted to a directory on your host
- Edit the code on the host for auto-reload
- Restarting the container will retain changes from previous runs
- If you run into issues - check in your pending changes, remove the host directory and restart, which will check out the repo and set everything up again
14 changes: 10 additions & 4 deletions examples/em-phone-devapp-serve/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ services:
image: emission/e-mission-phone.dev.ui-only:latest
environment:
- PHONE_REPO=https://github.com/e-mission/e-mission-phone.git
- CHOKIDAR_USEPOLLING=true
- PHONE_BRANCH=master
# CHANGEME: enable this for autoreloading
# - CHOKIDAR_USEPOLLING=true
ports:
#This is a default port mapping. In production you might want to use 80:8080,
- "3000:3000"
volumes:
- /tmp/e-mission-phone-docker:/src/
# volumes:
# specify the host directory where the source code should live
# If this is ~/e-mission-phone-docker, then you can edit the files at
# ~/e-mission-phone-docker/e-mission-phone/www/...
# - ~/e-mission-phone-docker:/src/
# - CHANGEME:/src/
# - /tmp/e-mission-phone-docker:/src/


5 changes: 4 additions & 1 deletion start_devapp_serve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ cd /src
git clone $PHONE_REPO
cd e-mission-phone
git clone https://github.com/driftyco/ionic-package-hooks.git ./package-hooks
git fetch origin $PHONE_BRANCH
git checkout -f $PHONE_BRANCH
node ./bin/configure_xml_and_json.js serve

echo "About to install node modules"
Expand All @@ -23,7 +25,8 @@ echo "About to fix autoreload script"
ORIG="path.join(process.cwd(), 'www/../.')"
NEW="path.join(process.cwd(), 'www/js/**/*'), path.join(process.cwd(), 'www/templates/**/*')"
echo "Replacing $ORIG -> $NEW"
sed -i -e 's/$ORIG/$NEW/g' /src/e-mission-phone/node_modules//connect-phonegap/lib/middleware/autoreload.js
sed -i -e "s|$ORIG|$NEW|g" /src/e-mission-phone/node_modules//connect-phonegap/lib/middleware/autoreload.js
grep "path.join" /src/e-mission-phone/node_modules//connect-phonegap/lib/middleware/autoreload.js
# cp /autoreload.js /src/e-mission-phone/node_modules//connect-phonegap/lib/middleware/
# cp /chokidar-index.js /src/e-mission-phone/node_modules/chokidar/index.js

Expand Down

0 comments on commit 9b4ef89

Please sign in to comment.