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

Commit

Permalink
added readme instructions and added dockerfile and modified server sc…
Browse files Browse the repository at this point in the history
…ript
  • Loading branch information
n7down committed Aug 18, 2016
1 parent ba92f12 commit bb41d09
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 3 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM ubuntu:14.04

# install couchdb
RUN apt-get update && apt-get install curl sudo git wget -y

# install hospital run
RUN curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
RUN apt-get update && apt-get install nodejs -y
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
COPY . /usr/src/app
RUN npm install -g npm && npm install -g ember-cli@latest && npm install -g bower
RUN npm install
RUN bower install --allow-root
COPY ./server/config-example.js ./server/config.js

RUN sed -i -e 's/URL="localhost"/URL="couchdb"/g' ./script/initcouch.sh
RUN sed -i -e "s/couchDbServer: 'localhost'/couchDbServer: 'couchdb'/g" ./server/config.js
RUN sed -i -e "s/localhost:5984/couchdb:5984/g" ./script/server

EXPOSE 4200

ENTRYPOINT ./script/initcouch.sh && npm start
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ To start the frontend please do the following:
- Start the server by running `npm start` in the repo folder.
- Go to [http://localhost:4200/](http://localhost:4200/) in a browser and login with username `hradmin` and password `test`.

## Running with Docker
To run HospitalRun with Docker please do the following:
- Goto [https://docs.docker.com/engine/installation](https://docs.docker.com/engine/installation) to download and install Docker.
- Clone the repository with the command `git clone https://github.com/HospitalRun/hospitalrun-frontend.git`.
- Change to the hospitalrun-frontend directory `cd hosptialrun-frontend`.
- Build the HosptialRun image with `docker build -t hospitalrun-frontend .`
- Execute `docker run -it --name couchdb -d couchdb` to create the couchdb container.
- Execute `docker run -it --name hospitalrun-frontend -p 4200:4200 --link couchdb:couchdb -d hospitalrun-frontend` to create the HospitalRun container.
- Run the following command to get the ip of the docker machine that the image was created on `docker-machine ip default`.
- Go to `http://<docker-machine ip>:4200` in a browser and login with username `hradmin` and password `test`.

### Troubleshooting your local environment
Always make sure to `git pull` and get the latest from master.

Expand Down
10 changes: 7 additions & 3 deletions script/initcouch.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#!/bin/bash

URL="localhost"
PORT="5984"

if [ -z "${1}" ] || [ -z "${2}" ]; then
HOST="http://127.0.0.1:5984"
HOST="http://$URL:$PORT"
curl -X PUT $HOST/_config/admins/couchadmin -d '"test"'
SECUREHOST="http://couchadmin:test@127.0.0.1:5984"
SECUREHOST="http://couchadmin:test@$URL:$PORT"
else
SECUREHOST="http://$1:$2@127.0.0.1:5984"
SECUREHOST="http://$1:$2@$URL:$PORT"
fi
curl -X PUT $SECUREHOST/_users/_security -d '{ "admins": { "names": [], "roles": ["admin"]}, "members": { "names": [], "roles": []}}'
curl -X PUT $SECUREHOST/config
Expand Down

0 comments on commit bb41d09

Please sign in to comment.