-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from AdvancedPhotonSource/docker-dev
add docker files, configurations, and doc
- Loading branch information
Showing
11 changed files
with
190 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,24 @@ | ||
FROM node:8 | ||
RUN apt-get update && \ | ||
apt-get install -y openssl | ||
|
||
# Add Tini, see https://github.com/krallin/tini for why | ||
ENV TINI_VERSION v0.18.0 | ||
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini | ||
RUN chmod +x /tini | ||
ENTRYPOINT ["/tini", "--"] | ||
|
||
EXPOSE 3001 | ||
COPY . /app | ||
# create the certification file for ssl | ||
WORKDIR /app/docker | ||
RUN openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 && \ | ||
openssl rsa -passin pass:x -in server.pass.key -out server.key && \ | ||
rm server.pass.key && \ | ||
openssl req -new -key server.key -out server.csr \ | ||
-subj "/C=US/ST=WA/L=Seattle/O=Traveler/OU=Dev/CN=example.com" && \ | ||
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt | ||
WORKDIR /app | ||
RUN npm install | ||
# RUN bower install | ||
CMD ["node", "app.js"] |
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,19 @@ | ||
version: "3" | ||
networks: | ||
default: | ||
external: | ||
name: traveler-dev | ||
services: | ||
web: | ||
build: . | ||
volumes: | ||
- ./lib:/app/lib | ||
- ./routes:/app/routes | ||
- ./model:/app/model | ||
- ./views:/app/views | ||
ports: | ||
- "3001:3001" | ||
restart: unless-stopped | ||
environment: | ||
- TRAVELER_CONFIG_REL_PATH=docker | ||
|
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,44 @@ | ||
# use docker to set up traveler development environment | ||
|
||
## install docker | ||
|
||
See <https://docs.docker.com/install/> for instructions. | ||
|
||
## create development network | ||
|
||
The traveler application and its dependencies will be running in the same network named `traveler-dev`. Run the following to create the network. | ||
|
||
``` | ||
docker network create -d bridge --subnet 172.18.1.0/24 traveler-dev | ||
``` | ||
|
||
## get the dependencies | ||
|
||
See <https://github.com/dongliu/traveler-mongo> for mongodb and mongo express. | ||
|
||
See <https://github.com/dongliu/traveler-ldap> for open ldap and a php ldap admin web interface. | ||
|
||
## build and run the application | ||
|
||
The traveler application can be run by running | ||
``` | ||
docker-compose up | ||
``` | ||
|
||
The traveler application can be accessed at <https://localhost:3001> | ||
|
||
When you run for the first time, docker will build the image for you. If the application does not start successfully, try | ||
``` | ||
docker-compose --verbose up | ||
``` | ||
for detailed information. You should also check the logs of mongodb and open ldap service to see if there is an issue with those services. You can ssh into the running container with `docker exec -it traveler-aps_web_1 /bin/bash`, where `traveler-aps_web_1` is the running container name. | ||
|
||
Run | ||
``` | ||
docker-compose down | ||
``` | ||
to stop the appplication. | ||
|
||
You can run with `docker-compose up -d` in a detached mode. Then you can run `docker-compose logs -f` to check the application log. | ||
|
||
|
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,27 @@ | ||
{ | ||
"url": "ldap://ldap-service", | ||
"adminDn": "cn=admin,dc=example,dc=org", | ||
"adminPassword": "admin", | ||
"searchBase": "dc=example,dc=org", | ||
"searchFilter": "(&(objectClass=inetOrgPerson)(uid=_id))", | ||
"nameFilter": "(&(objectClass=inetOrgPerson)(displayName=_name)(company=Engineering))", | ||
"groupSearchBase": "dc=example", | ||
"groupSearchFilter": "(&(objectClass=group)(uid=_id))", | ||
"objAttributes": ["uid", "displayName", "ou", "mail", "homephone"], | ||
"memberAttributes": ["uid", "displayName", "ou", "mail", "homephone", "memberOf"], | ||
"groupAttributes": ["uid","displayName","mail"], | ||
"rawAttributes": ["jpegPhoto"], | ||
"defaultKeys": { | ||
"displayName": "displayName", | ||
"memberOf": "memberOf", | ||
"mail": "mail", | ||
"company": "o", | ||
"thumbnailPhoto": "jpegPhoto", | ||
"uid": "uid", | ||
"telephoneNumber": "homephone" | ||
}, | ||
|
||
"shareUsers": true, | ||
"shareGroups": false, | ||
"transferOwnership": false | ||
} |
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,3 @@ | ||
{ | ||
"group.new.name" : "goup.old.name" | ||
} |
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,9 @@ | ||
{ | ||
"api_users" : { | ||
"api_read": "api_read_password", | ||
"api_write": "api_write_password" | ||
}, | ||
"app_port" : "3443", | ||
"ssl_key": "server.key", | ||
"ssl_cert": "server.crt" | ||
} |
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,25 @@ | ||
{ | ||
"app_port": "3001", | ||
"ssl_key": "server.key", | ||
"ssl_cert": "server.crt", | ||
"top_bar_urls" : [ | ||
{ | ||
"text": "Controls", | ||
"url": "https://controls.frib.msu.edu/" | ||
}, | ||
{ | ||
"text": "Report a problem", | ||
"url": "https://controls.frib.msu.edu/controlshelp/" | ||
} | ||
], | ||
"link_target": "_self", | ||
"deployment_name": "development", | ||
"upload_dir" : "../traveler_uploads/", | ||
"log_dir" : "../logs/", | ||
"cookie_sec": "traveler", | ||
"cookie_life": 28800000, | ||
"upload_size" : 5, | ||
"default_form_public_access" : -1, | ||
"default_traveler_public_access" : 0, | ||
"default_binder_public_access" : 0 | ||
} |
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,9 @@ | ||
{ | ||
"type": "ldap", | ||
"service": "https://localhost:3001", | ||
"login_service": "https://localhost:3001/login", | ||
"default_roles": [ | ||
"read_all_forms", | ||
"write_public_travelers" | ||
] | ||
} |
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,10 @@ | ||
{ | ||
"server_address": "mongo", | ||
"server_port": "27017", | ||
"traveler_db": "traveler", | ||
"username": "traveler", | ||
"password": "travelerpassword", | ||
"auth": { | ||
"authdb": "traveler" | ||
} | ||
} |
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,12 @@ | ||
{ | ||
"device_application": "devices", | ||
"device": { | ||
"url": "https://controlsapp1/conf/rs/v0/component/physical" | ||
}, | ||
"legacy_traveler": { | ||
"api": "https://controls.frib.msu.edu/traveler1/api.php", | ||
"travelers": "https://controls.frib.msu.edu/traveler1/api.php?resource=travelers", | ||
"devices": "https://controls.frib.msu.edu/traveler1/api.php?resource=travelers&device=", | ||
"assigned": "https://controls.frib.msu.edu/traveler1/showForm.php?assigned=" | ||
} | ||
} |
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,8 @@ | ||
{ | ||
"terminology": { | ||
"form": "form", | ||
"traveler": "traveler", | ||
"device": "device", | ||
"travelBtn": "Travel" | ||
} | ||
} |