Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docker Compose support #534

Merged
merged 6 commits into from
Oct 27, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 8 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,42 +95,18 @@ Importing the Gradle project into Intellij and Eclipse both work.

`./gradlew dependencyUpdates`

## Docker images
## Docker

### Pull the latest stable version from Docker Hub
alf.io can be run for development with Docker Compose:

```
docker pull alfio/alf.io
```

Here's an example of deployment as a 3 tier application using the following images:

* `postgres` --> docker official image for PostgreSQL database
* `alfio/alf.io`--> application runtime.
* `tutum/haproxy` --> front layer proxy, force redirect to https and support load-balancing if multiple alf.io instances are running


### Launch alf.io container instances
docker-compose up

* Define local directory for database data (on docker host, for data to survive postgres image restarts): `/path/to/local/data = /data/postgres/alfio`

* Launch the Postgres instance

```
docker run --name alfio-db -e POSTGRES_DB=postgres -e POSTGRES_USERNAME=postgres -e POSTGRES_PASSWORD=alfiopassword --restart=always -d -v /path/to/local/data:/var/lib/postgresql/data postgres
```
* Note: on Mac volumes don't work (see https://jhipster.github.io/installation.html for a possible workaround), launch the above command without the `-v` parameter (data are lost at every restart)
If you plan on using Docker Compose to run alf.io in production, then you need
to make a couple of changes:

* Launch the alf.io server
```
docker run --name alfio --link alfio-db:postgres -d alfio/alf.io
```
Please note that at the moment, the only alias supported for the DB link is *postgres*

* Launch the proxy
```
docker run --name alfio-proxy --link alfio:web1 -e SSL_CERT="$(awk 1 ORS='\\n' src/main/dist/servercert.pem)" -e FORCE_SSL=yes -e PORT=8080 -p 443:443 -p 80:80 -d tutum/haproxy
```
* Add a mapping for port `8443`
* Handle SSL termination (e.g. with something like `tutum/haproxy`)
* Remove the `SPRING_PROFILES_ACTIVE: dev` environment variable

### Test alf.io application
* Check alfio logs: `docker logs alfio`
Expand Down
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "3"
services:
alfio:
image: alfio/alf.io
environment:
POSTGRES_PORT_5432_TCP_PORT: "5432"
POSTGRES_PORT_5432_TCP_ADDR: postgres
POSTGRES_ENV_POSTGRES_DB: alfio
POSTGRES_ENV_POSTGRES_USERNAME: alfio
POSTGRES_ENV_POSTGRES_PASSWORD: alfio
SPRING_PROFILES_ACTIVE: dev,jdbc-session
ports:
- "8080:8080"
links:
- db:postgres
db:
image: postgres:10
environment:
POSTGRES_DB: alfio
POSTGRES_USER: alfio
POSTGRES_PASSWORD: alfio
volumes:
- data-volume:/var/lib/postgresql/data
volumes:
data-volume: