-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
118 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,39 @@ | ||
# python 3 | ||
FROM continuumio/miniconda3 | ||
|
||
MAINTAINER Attawit Kittikrairit | ||
|
||
# set working directory | ||
WORKDIR /usr/src/app | ||
|
||
# clone from repo | ||
RUN git clone https://github.com/e-mission/e-mission-server.git . | ||
|
||
# setup python environment | ||
RUN conda env update --name emission --file setup/environment36.yml | ||
RUN /bin/bash -c "source activate emission; pip install six --upgrade" | ||
|
||
# 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 | ||
WORKDIR /usr/src/app/webapp | ||
RUN bower update --allow-root | ||
WORKDIR /usr/src/app | ||
|
||
# install nano for editing | ||
RUN apt-get -y install nano vim | ||
|
||
# cleanup | ||
RUN apt-get -y remove --purge build-essential | ||
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
# start the server | ||
ADD docker/start_script.sh /usr/src/app/start_script.sh | ||
RUN chmod u+x /usr/src/app/start_script.sh | ||
|
||
EXPOSE 8080 | ||
|
||
CMD ["/bin/bash", "/usr/src/app/start_script.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,16 @@ | ||
{ | ||
"paths" : { | ||
"static_path" : "webapp/www/", | ||
"python_path" : "main", | ||
"log_base_dir" : ".", | ||
"log_file" : "debug.log" | ||
}, | ||
"__comment" : "Fill this in for the production server. port will almost certainly be 80 or 443. For iOS, using localhost allows you to test without an internet connection. For AWS and android, make sure that the host 0.0.0.0, localhost does not seem to work", | ||
"server" : { | ||
"host" : "0.0.0.0", | ||
"port" : "8080", | ||
"__comment": "1 hour = 60 min = 60 * 60 sec", | ||
"timeout" : "3600", | ||
"auth": "skip" | ||
} | ||
} |
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,5 @@ | ||
{ | ||
"timeseries": { | ||
"url": "e-mission-mongo-1" | ||
} | ||
} |
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,51 @@ | ||
### Docker Usage Instructions | ||
|
||
1. Build docker image | ||
|
||
``` | ||
docker build -t e-mission-server:latest . | ||
``` | ||
|
||
2. Create docker network | ||
|
||
We will be creating network name `e-mission` which will allows any docker container in the network refer to each other by its `name` instead of IP Address which can be changed over time. | ||
|
||
``` | ||
docker network create e-mission --driver=bridge | ||
``` | ||
|
||
3. Run MongoDB | ||
|
||
We will be using Official MongoDB Docker image, so no need to build one. | ||
|
||
``` | ||
docker run -d \ | ||
--name=e-mission-mongo-1 \ | ||
--net="e-mission" \ | ||
--restart=always \ | ||
--mount source=e-mission-mongo-1_data,target=/data/db \ | ||
--mount source=e-mission-mongo-1_config,target=/data/configdb \ | ||
mongo:latest \ | ||
--bind_ip_all | ||
``` | ||
|
||
FOR ADVANCED USER: If you would like to access to MongoDB directly for debugging purpose, you can add the line | ||
|
||
``` | ||
-p 27017:27017 \ | ||
``` | ||
|
||
and access it like MongoDB is running on your host machine. | ||
|
||
4. Run the server | ||
|
||
``` | ||
docker run -d \ | ||
-p 8080:8080 \ | ||
--name=e-mission-server-1 \ | ||
--net="e-mission" \ | ||
--restart=always \ | ||
--mount type=bind,source="$(pwd)"/conf/storage/db.conf.docker.sample,target=/usr/src/app/conf/storage/db.conf,readonly \ | ||
--mount type=bind,source="$(pwd)"/conf/net/api/webserver.conf.docker.sample,target=/usr/src/app/conf/net/api/webserver.conf,readonly \ | ||
e-mission-server:latest | ||
``` |
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,7 @@ | ||
#!bin/bash | ||
|
||
# change python environment | ||
source activate emission | ||
|
||
# launch the webapp | ||
./e-mission-py.bash emission/net/api/cfc_webapp.py |