Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

[WIP] added some hints for the troubleshooting; fixed sleep instructions #119

Merged
merged 9 commits into from
Sep 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 15 additions & 25 deletions DEPLOYMENT_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,17 @@ Welcome to HospitalRun Deployment Documentation. You can log issues, comments or
Here are some configuration scripts that have been used in designing this application. It is important you know exactly what they do, so you can manipulate your configuration or scale them as you desire.

* docker-compose.yml

* config-example.js

* Dockerfile

* utils/elasticsearch.sh

* nginx/conf/certbot-auto

* nginx/conf/*.tmpl, nginx/conf/*.conf

* nginx/conf/entrypoint.sh

* nginx/Dockerfile

* logstash/pipeline/logstash.conf

* logstash/Dockerfile

* data

* conf/initcouch.sh

* conf/entrypoint.sh

# **Deploying HospitalRun to a Production Environment**
Expand All @@ -55,29 +43,35 @@ Here are some configuration scripts that have been used in designing this applic
Follow these five easy steps to get HospitalRun up and running

1. Clone the repository `git clone [email protected]:HospitalRun/hospitalrun-server.git`.

2. Run `cd hospitalrun-server`. This should take you into the `hospitalrun-server` root folder
3. From this location, edit the `docker-compose.yml` file.
* To use automatic SSL cert generation, edit the `DOMAIN_NAME` argument and replace `www.example.com` as shown in the image below with the publicly accessible domain name that HospitalRun will run on.
* To instead use your own SSL cert, change the `SSL_TYPE` argument to `self` and place your certificate files at `data/nginx/cert/ssl.crt` and `data/nginx/cert/ssl.key`. You will need to create a `data/nginx/cert` path from the root folder if you haven't run the server yet.
![screenshot](screenshot.png)
4. Save the file and run `docker-compose up --build`. You should wait for some ten minutes or less for your environment to be up and running. Deployment speed will vary based on your internet connection speed and the quality of your infrastructure
5. Go to [http://localhost/](http://localhost/) in a browser and login with username ```hradmin``` and password ```test```

3. From this location, edit the `docker-compose.yml` file.
## Troubleshooting

To use automatic SSL cert generation, edit the `DOMAIN_NAME` argument and replace `www.example.com` as shown in the image below with the publicly accessible domain name that HospitalRun will run on.
### Check which containers run and which do not

To instead use your own SSL cert, change the `SSL_TYPE` argument to `self` and place your certificate files at `data/nginx/cert/ssl.crt` and `data/nginx/cert/ssl.key`. You will need to create a `data/nginx/cert` path from the root folder if you haven't run the server yet.
Run `docker-compose ps`. Note the `State` column of the command's output.

4. Save the file and run `docker-compose up --build -d`. You should wait for some ten minutes or less for your environment to be up and running. Deployment speed will vary based on your internet connection speed and the quality of your infrastructure
### Error starting userland proxy: Bind for 0.0.0.0:80: unexpected error Permission denied'

5. Go to [http://localhost/](http://localhost/) in a browser and login with username ```hradmin``` and password ```test```
or something similar: the port `80` is in use already. Either find which application uses that and free the port
or edit the `docker-compose.yml` and change the `"80:80"` into `"<another port which is free>:80"`.

### Nginx container shuts down soon after being started

![screenshot](screenshot.png)
Usually due to SSL configuration being incorrect. Either 'auto' configuration and the cert generation is failing, or 'self' and the cert files are not placed correctly. Viewing the container's log output should provide more info.

# **The Data Folder**

This folder contains all the data needed to be available should the containers be shutdown, or restarted for any reason. It should contain after startup, the following:

1. Nginx folder, and Let's Encrypt certificates

2. CouchDB Data

3. Elasticsearch Data

If you delete this folder, you WILL lose all your data and installed SSL certificate
Expand All @@ -87,13 +81,9 @@ If you delete this folder, you WILL lose all your data and installed SSL certifi
**List of Containers:**

1. Nginx - WebServer

2. HospitalRun - Node.JS App Server

3. Logstash - Log Streaming Application

4. Elasticsearch - For Search

5. CouchDB - NoSQL Data Store

**Nginx**
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:boron-slim
FROM node:10-slim
LABEL maintainer Mofesola Babalola <[email protected]>

#Get required applications
Expand All @@ -11,6 +11,7 @@ WORKDIR /usr/src/app

#Install Dependencies
COPY package.json /usr/src/app
COPY package-lock.json /usr/src/app
RUN npm install --loglevel silent

COPY . /usr/src/app
Expand Down
8 changes: 4 additions & 4 deletions conf/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# It will generally take about 40 seconds for elasticsearch and couchdb to be ready to receive connections
echo 'Scheduling setup scripts to run in 40 seconds...'
sleep 40 && /usr/src/app/conf/initcouch.sh 2>&1 && /usr/src/app/utils/elasticsearch.sh couchadmin test 2>&1 &
echo 'Scheduling setup scripts to run in 120 seconds...'
sleep 120 && /usr/src/app/conf/initcouch.sh 2>&1 && /usr/src/app/utils/elasticsearch.sh couchadmin test 2>&1 &
npm start
sleep 40
/usr/src/app/conf/initcouch.sh 2>&1 && /usr/src/app/utils/elasticsearch.sh couchadmin test 2>&1

npm start
Loading