Commit d7e4316a authored by Mart Lubbers's avatar Mart Lubbers

Add docker compose support

parent dcf3c5ba
......@@ -103,11 +103,15 @@ statistics are shown on `/stats/longterm.html`.
## Setup using Docker
This is an experimental feature. There are two `Dockerfile`s available: one for
the Cloogle server and one for the live statistics. We need them to share a
`cloogle.log`. Also, both use `--net=host` to easily open their ports. In a
production environment, you should not do this, but instead use `-p` and set up
forwarding rules.
This is the easiest way to setup a cloogle server. After installing
[docker-compose](https://www.docker.com/products/docker-compose) run the
following commands:
```bash
./make_compose_containers_local.sh
docker-compose up
```
Your cloogle server now runs at port `80` on your local machine.
### Cloogle server
......
version: '2'
services:
backend:
image: cloogle-backend
restart: always
frontend:
depends_on:
- backend
image: cloogle-frontend
ports:
- "80:80"
volumes:
- "./frontend/:/var/www/html/"
restart: always
stats:
depends_on:
- frontend
- db
image: cloogle-stats
restart: always
db:
image: mysql:latest
volumes:
- "./db/:/docker-entrypoint-initdb.d/"
environment:
MYSQL_ROOT_PASSWORD: cloogle
MYSQL_DATABASE: cloogledb
MYSQL_USER: cloogle
MYSQL_PASSWORD: cloogle
FROM php:5.6-apache
RUN docker-php-source extract \
&& apt-get update \
&& apt-get install -y php-net-socket\
&& docker-php-ext-install sockets mysqli\
&& docker-php-source delete
<?php
define('SERVER_HOSTNAME', '127.0.0.1');
//define('SERVER_HOSTNAME', '127.0.0.1');
define('SERVER_HOSTNAME', 'backend');
define('SERVER_PORT', 31215);
define('SERVER_TIMEOUT', 8);
......
<?php
define('CLOOGLE_DB_HOST', 'localhost');
define('CLOOGLE_DB_HOST', 'db');
define('CLOOGLE_DB_USER', 'cloogleuser');
define('CLOOGLE_DB_NAME', 'cloogledb');
define('CLOOGLE_DB_PASS', '********');
define('CLOOGLE_DB_PASS', 'clooglepass');
define('CLOOGLE_KEEP_STATISTICS', true);
......@@ -65,7 +65,8 @@ function addConnectionCallbacks(connection) {
console.log('Attempting connection...');
connection = new WebSocket(
(window.location.protocol == 'https:' ? 'wss' : 'ws') + '://' +
window.location.hostname + ':31216/',
'stats' + ':31216/',
//window.location.hostname + ':31216/',
'cloogle-stats');
addConnectionCallbacks(connection);
}
......
#!/bin/bash
set -e
docker build -t cloogle-backend backend
docker build -t cloogle-frontend frontend
docker build -t cloogle-stats frontend/stats
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment