-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a version of the server that checks out the repo as well
Next step: mounting local drive + reload support
- Loading branch information
Showing
4 changed files
with
133 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# python 3 | ||
FROM continuumio/miniconda3 | ||
|
||
MAINTAINER K. Shankari (shankari@eecs.berkeley.edu) | ||
|
||
# set working directory | ||
WORKDIR /src | ||
|
||
# install nodejs, npm and bower | ||
RUN apt-get update | ||
RUN apt-get install -y build-essential | ||
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - | ||
RUN apt-get -y install nodejs | ||
RUN npm install -g bower | ||
|
||
# cleanup | ||
RUN apt-get -y remove --purge build-essential | ||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
#declare environment variables | ||
ENV DB_HOST='' | ||
ENV WEB_SERVER_HOST='' | ||
|
||
ADD clone_and_start_server.sh /clone_and_start_server.sh | ||
RUN chmod u+x /clone_and_start_server.sh | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["/bin/bash", "/clone_and_start_server.sh"] |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#set phone repo using environment variable | ||
echo "Cloning from repo "${SERVER_REPO}" and branch "$SERVER_BRANCH | ||
|
||
mkdir -p /src | ||
cd /src | ||
git clone $SERVER_REPO | ||
cd e-mission-server | ||
git clone https://github.com/driftyco/ionic-package-hooks.git ./package-hooks | ||
git fetch origin $SERVER_BRANCH | ||
git checkout -f $SERVER_BRANCH | ||
|
||
conda env update --name emission --file setup/environment36.yml | ||
conda clean -t | ||
conda clean -p | ||
|
||
pushd webapp | ||
bower update --allow-root | ||
popd | ||
|
||
echo ${DB_HOST} | ||
if [ -z ${DB_HOST} ] ; then | ||
local_host=`hostname -i` | ||
sed "s_localhost_${local_host}_" conf/storage/db.conf.sample > conf/storage/db.conf | ||
else | ||
sed "s_localhost_${DB_HOST}_" conf/storage/db.conf.sample > conf/storage/db.conf | ||
fi | ||
cat conf/storage/db.conf | ||
|
||
#set Web Server host using environment variable | ||
echo ${WEB_SERVER_HOST} | ||
if [ -z ${WEB_SERVER_HOST}} ] ; then | ||
local_host=`hostname -i` | ||
sed "s_localhost_${local_host}_" conf/net/api/webserver.conf.sample > conf/net/api/webserver.conf | ||
else | ||
sed "s_localhost_${WEB_SERVER_HOST}_" conf/net/api/webserver.conf.sample > conf/net/api/webserver.conf | ||
fi | ||
cat conf/net/api/webserver.conf | ||
|
||
source activate emission | ||
|
||
# launch the webapp | ||
./e-mission-py.bash emission/net/api/cfc_webapp.py | ||
|
||
# use this as the launch script instead if the webapp is crashing | ||
# note that you need to manually start the server in that case | ||
# tail -f /clone_and_start_server.sh |
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
version: "3" | ||
services: | ||
web-server: | ||
image: emission/e-mission-server.dev.server-only:latest | ||
depends_on: | ||
- db | ||
environment: | ||
- SERVER_REPO=https://github.com/e-mission/e-mission-server.git | ||
- SERVER_BRANCH=master | ||
- DB_HOST=db | ||
- WEB_SERVER_HOST=0.0.0.0 | ||
# CHANGEME: enable this for autoreloading | ||
# - CHOKIDAR_USEPOLLING=true | ||
deploy: | ||
replicas: 1 | ||
restart_policy: | ||
condition: on-failure | ||
ports: | ||
- "8080:8080" | ||
# 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/ | ||
networks: | ||
- emission | ||
db: | ||
image: mongo:3.4 | ||
deploy: | ||
replicas: 1 | ||
restart_policy: | ||
condition: on-failure | ||
ports: | ||
#This port binding allows you to access the database server outside the host machine. Remove this is you don't need this | ||
#functionality | ||
- "27017:27017" | ||
|
||
#Volumes is the preferred way to persist data generated by a container. In this case we use a volume to persist the contents | ||
#of the data base. Learn more about how to use volumes here: https://docs.docker.com/storage/volumes/ | ||
# And learn how to configure volumes in your compose file here: https://docs.docker.com/compose/compose-file/#volume-configuration-reference | ||
volumes: | ||
- mongo-data:/data/db | ||
networks: | ||
- emission | ||
|
||
networks: | ||
emission: | ||
|
||
volumes: | ||
mongo-data: | ||
|
||
|