Permalink
Browse files

chore: run Zanata and DB via docker-compose (#548)

  • Loading branch information...
seanf committed Oct 5, 2017
1 parent 79b0160 commit a792d674337d2c1dece13adb26ee607c23572a5a
View
@@ -1,3 +1,5 @@
# TODO rename Dockerfile to Dockerfile.zanata-base
FROM jboss/wildfly:10.1.0.Final
# MAIL_USERNAME and MAIL_PASSWORD can not be empty as they are used in wildfly standalone-full.xml.
@@ -0,0 +1,4 @@
FROM wildfly-zanata-base
# Add the war file
ADD ROOT.war /opt/jboss/wildfly/standalone/deployments/
@@ -0,0 +1,33 @@
---
# TODO upgrade to version 2.1 after Fedora 27 is GA (when F25 is EOL)
version: '2.0'
services:
zanatadb:
image: mariadb:10.1
command: --character-set-server=utf8 --collation-server=utf8_general_ci
environment:
MYSQL_ROOT_PASSWORD: supersecret
MYSQL_DATABASE: zanata
MYSQL_USER: zanata
MYSQL_PASSWORD: zanatapw
volumes:
- $HOME/docker-volumes/zanata-mariadb:/var/lib/mysql:Z
# This requires docker-compose file version 2.1
# healthcheck:
# test: ["CMD", "mysqladmin", "ping", "--silent"]
zanata:
# build: .
image: zanata-dev
links:
- zanatadb
environment:
DB_HOSTNAME: zanatadb
DB_NAME: zanata
DB_USER: zanata
DB_PASSWORD: zanatapw
# TODO MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD
PREPEND_JAVA_OPTS: "-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/jboss/zanata"
ports:
- 8080:8080
volumes:
- $HOME/docker-volumes/zanata:/opt/jboss/zanata:Z
View
@@ -105,7 +105,8 @@ ZANATA_DIR=$HOME/docker-volumes/zanata
mkdir -p $ZANATA_DIR
# build the docker dev image
docker build -t zanata/server-dev docker/
# TODO rename docker/Dockerfile to docker/Dockerfile.zanata-base
docker build --tag zanata/server-dev --file docker/Dockerfile docker/
# OutOfMemoryError handling:
# The heap will be dumped to a file on the host, eg ~/docker-volumes/zanata/java_pid63.hprof
@@ -114,6 +115,8 @@ docker build -t zanata/server-dev docker/
JBOSS_DEPLOYMENT_VOLUME=/opt/jboss/wildfly/standalone/deployments/
# TODO run docker-compose up, passing in user options
# runs zanata/server-dev:latest docker image
docker run \
-e PREPEND_JAVA_OPTS="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/jboss/zanata" \
View
@@ -0,0 +1,25 @@
#!/bin/bash
# determine directory containing this script
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(realpath "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
cd $DIR
docker build --tag wildfly-zanata-base .
# First transform flattens everything
# Second transform renames the versioned zanata war to ROOT.war
tar --create \
Dockerfile.zanata \
../zanata-war/target/zanata-*.war \
--transform 's,.*/,,' \
--transform 's/zanata-.*\.war/ROOT.war/' |
docker build -t zanata-dev --file Dockerfile.zanata -
docker-compose up

0 comments on commit a792d67

Please sign in to comment.