Skip to content

Commit

Permalink
Docker-compose setup for Servatrice (#3887)
Browse files Browse the repository at this point in the history
* Docker compose for servatrice

* Update README.md

* Clean up docker-compose specific configuration
  • Loading branch information
pmwheatley committed Mar 17, 2020
1 parent 17efe8c commit 7285f24
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Expand Up @@ -141,6 +141,20 @@ to permit connections to the server.

Find more information on how to use Servatrice with Docker in our [wiki](https://github.com/Cockatrice/Cockatrice/wiki/Setting-up-Servatrice#using-docker).

**Docker compose**

There is also a docker-compose file available which will configure and run both a MySQL server and Servatrice. The docker-compose setup scripts can be found in the `servatrice/docker` folder and vary only slightly from the default sql and server .ini files. The setup scripts can either be modified in place, or docker-compose can mount alternative files into the images, as you prefer.

To run Servatrice via docker-compose, first install docker-compose following the [install instructions](https://docs.docker.com/compose/install/). Once installed, run the following from the root of the repository:
```bash
docker-compose build # Build the Servatrice image using the same Dockerfile as above.
docker-compose up # Setup and run both the MySQL server and Servatrice.
```

>Note: Similar to the above Docker setup, this will expose TCP ports 4747 and 4748.
>Note: The first time running the docker-compose setup, the MySQL server will take a little time to run the initial setup scripts. Due to this, the Servatrice instance may fail the first few attempts to connect to the database. Servatrice is set to `restart: always` in the docker-compose.yml, which will allow it to continue attempting to start up. Once the MySQL scripts have completed, Servatrice should then connect automatically on the next attempt.
# License [![GPLv2 License](https://img.shields.io/github/license/Cockatrice/Cockatrice.svg)](https://github.com/Cockatrice/Cockatrice/blob/master/LICENSE)

Cockatrice is free software, licensed under the [GPLv2](https://github.com/Cockatrice/Cockatrice/blob/master/LICENSE).
27 changes: 27 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,27 @@
version: '3'

services:
mysql:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=root-password
- MYSQL_DATABASE=servatrice
- MYSQL_USER=servatrice
- MYSQL_PASSWORD=password
volumes:
- $PWD/servatrice/servatrice.sql:/docker-entrypoint-initdb.d/servatrice.sql

servatrice:
build:
context: .
dockerfile: Dockerfile
image: servatrice
depends_on:
- mysql
ports:
- "4747:4747"
- "4748:4748"
entrypoint: "/bin/bash -c 'sleep 10; servatrice --config /tmp/servatrice.ini --log-to-console'"
restart: always
volumes:
- $PWD/servatrice/docker/servatrice-docker.ini:/tmp/servatrice.ini
7 changes: 7 additions & 0 deletions servatrice/docker/servatrice-docker.ini
@@ -0,0 +1,7 @@
[database]
type=mysql
prefix=cockatrice
hostname=mysql
database=servatrice
user=servatrice
password=password

0 comments on commit 7285f24

Please sign in to comment.