diff --git a/README.md b/README.md index 1f7e093..b06a929 100644 --- a/README.md +++ b/README.md @@ -1,56 +1,88 @@ epiph ====== epiph is a webapp to facilitate psychological trials based on questionnaires. You can enter your own questionnaires with multiple question/answer types (multiple-choice (single/multi selection), text, date, etc.). Design your study and schedule visits by defining which questionnaires have to be filled out in which visit. After creating patients, you are ready to fill out questionnaires. Epiph supports exporting the gathered answers as a csv or save it to a (MongoDB) collection for direct access from multiple statistic tools (ex. R). ## Usage ### Development / run locally This webapp is based on [Meteor](http://meteor.com). If you haven't installed it already, this is how you get it. ``` curl https://install.meteor.com/ | sh ``` Once meteor is installed, this command checks out the repo and starts the app. ``` git clone https://github.com/TeamEpiph/epiph.git cd epiph/app meteor ``` The app now runs with an empty database on http://localhost:3000 ### Deployment +This app can be easily hosted using docker-compose. + +#### Preparation: install docker-compose -This app can be easily deployed using docker-compose. If you haven't installed Docker and Docker Compose already, check the official documentation for the installation details: [Docker](https://docs.docker.com/install/) and [Docker Compose](https://docs.docker.com/compose/install/). +#### Preparation: docker network +Create the web network with the following command: +``` +docker network create web +``` + +#### Run epiph ``` git clone https://github.com/TeamEpiph/epiph.git + cd epiph/app -docker-compose up + +vi docker-compose.yml # adapt traefik.basic.frontend.rule to your domain +docker-compose up -d ``` +Now epiph is running on http://localhost:3000 +If you want to expose the service to the public via a domain, follow the next steps. + +#### External Access and HTTPS +Make sure port 80 and 443 are accessible from external and that you set up DNS +correctly. The domain name you are going to specify needs to resolve to your IP. +Traefik is going to request an TLS certificate from Let's Encrypt and +needs these ports to be available in order to verify the request. + +``` +cd epiph/traefik +touch acme.json && chmod 600 acme.json +cp traefik.toml.example traefik.toml +vi traefik.toml # set domain and email + +docker-compose up -d +``` + +The app should be up on the domain you specified eg. https://epiph.ch + ### Default User for login to epiph * email: admin@admin.com * username: admin * password: password ## Copyright and license Code and documentation copyright 2016 Patrick Recher, Ronan Zimmermann and University of Basel. Code is licensed under GPLv3. diff --git a/app/docker-compose.yml b/app/docker-compose.yml index bcd413f..e571788 100644 --- a/app/docker-compose.yml +++ b/app/docker-compose.yml @@ -1,28 +1,41 @@ version: '3' services: meteor: image: epiph:latest build: context: . dockerfile: Dockerfile restart: always ports: - "3000:3000" expose: - "3000" links: - mongo depends_on: - mongo environment: MONGO_URL: mongodb://mongo:27017/epiph + networks: + - web + - default + labels: + - "traefik.docker.network=web" + - "traefik.enable=true" + - "traefik.basic.frontend.rule=Host:epiph.ch" + - "traefik.basic.port=3000" + - "traefik.basic.protocol=http" mongo: image: mongo:latest restart: always ports: - "27017:27017" expose: - "27017" volumes: - ./docker-data/mongo:/data/db + +networks: + web: + external: true diff --git a/traefik/.gitignore b/traefik/.gitignore new file mode 100644 index 0000000..d527c8c --- /dev/null +++ b/traefik/.gitignore @@ -0,0 +1,2 @@ +traefik.toml +acme.json diff --git a/traefik/docker-compose.yml b/traefik/docker-compose.yml new file mode 100644 index 0000000..50842fa --- /dev/null +++ b/traefik/docker-compose.yml @@ -0,0 +1,21 @@ +version: '2' + +services: + traefik: + image: traefik:1.7 + restart: always + ports: + - 80:80 + - 443:443 + networks: + - web + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ./traefik.toml:/traefik.toml + - ./acme.json:/acme.json + container_name: traefik + +networks: + web: + external: true + diff --git a/traefik/traefik.toml.example b/traefik/traefik.toml.example new file mode 100644 index 0000000..1e909c0 --- /dev/null +++ b/traefik/traefik.toml.example @@ -0,0 +1,29 @@ +debug = false + +logLevel = "ERROR" +defaultEntryPoints = ["https","http"] + +[entryPoints] + [entryPoints.http] + address = ":80" + [entryPoints.http.redirect] + entryPoint = "https" + [entryPoints.https] + address = ":443" + [entryPoints.https.tls] + +[retry] + +[docker] +endpoint = "unix:///var/run/docker.sock" +domain = "my-awesome-app.org" +watch = true +exposedByDefault = false + +[acme] +email = "your-email-here@my-awesome-app.org" +storage = "acme.json" +entryPoint = "https" +onHostRule = true +[acme.httpChallenge] +entryPoint = "http"