Skip to content

Commit

Permalink
Update docker compose (jakearchibald#24)
Browse files Browse the repository at this point in the history
* Update docker-compose.yml to run using a volume

* Add package-lock.json

* Update package-lock.json

* Add start script to package.json
It runs npm install if node_modules folder doesn't exist then runs the serve script

* Add a newline at the end of docker-compose.yml file

* Update README.md

* Add start.sh script and use it in docker-compose.yml

* Add newline at the end of start.sh script

* Small update in README.md

* Update container_name in docker-compose.yml

* Update package-lock.json to fix `npm ERR! code EINTEGRITY`

* Update docker-compose.yml command to use start.sh script

* Remove start script from package.json

* Rename service name in docker-compose from witter to wittr

* Remove package-lock.json

* Remove start.sh, update the command in docker-compose.yml and update README.md

* Update README.md, moving the running on local machine section on top

* Minor grammar changes
  • Loading branch information
a-magdy authored and jakearchibald committed Nov 16, 2017
1 parent 196c7d4 commit 28d9ac3
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 12 deletions.
38 changes: 31 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

This is a silly little demo app for an offline-first course.

# Installing
You could run the app either using machine dependnecies, or using docker

## Running using local machine

### Installing

Dependencies:

Expand All @@ -14,12 +18,14 @@ Then check out the project and run:
npm install
```

# Running
### Running

```sh
npm run serve
```

### Using the app

You should now have the app server at [localhost:8888](http://localhost:8888) and the config server at [localhost:8889](http://localhost:8889).

You can also configure the ports:
Expand All @@ -28,9 +34,27 @@ You can also configure the ports:
npm run serve -- --server-port=8000 --config-server-port=8001
```

# Troubleshooting
## Running using docker

```sh
docker-compose up
```

Here also you should have the app server at [localhost:8888](http://localhost:8888) and the config server at [localhost:8889](http://localhost:8889).

You can configure the ports by changing them in `docker-compose.yml` before starting:

```yml
ports:
# <host>:<container>
- 8000:8888
- 8001:8889
```
## Troubleshooting
- Errors while executing `npm run serve`
- The first thing to try is to upgrade to latest version of node
- If latest version also produces errors, try installing v4.5.0
- An easy for that would be to use `nvm` as discussed [here](http://stackoverflow.com/a/7718438/1585523)
* Errors while executing `npm run serve`.
* The first thing to try is to upgrade to latest version of node.
* If latest version also produces errors, try installing v4.5.0.
* An easy fix for that would be [to use `nvm`](http://stackoverflow.com/a/7718438/1585523).
* If you get any node-sass errors, try running `npm rebuild node-sass --force` or the remove `node_modules` folder and run `npm install` again
24 changes: 19 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
witter:
build: .
ports:
- 8888:8888
- 8889:8889
version: '2.1'

services:
wittr:
image: node:latest
container_name: c-wittr
command: /bin/bash -c "if [ ! -d node_modules ] ; then npm install ; fi && npm run serve"
working_dir: /usr/src/app
volumes:
- .:/usr/src/app
ports:
- 8888:8888
- 8889:8889
healthcheck:
test: "wget -q -O - http://localhost:8888"
interval: 1s
timeout: 30s
retries: 300
restart: unless-stopped

0 comments on commit 28d9ac3

Please sign in to comment.