1
0
mirror of https://gitlab.com/depesz/explain.depesz.com.git synced 2024-11-30 09:06:42 +02:00

Add docker-compose build steps

docker-compose is a quick way to spin up this project.
This commit is contained in:
Will Thames 2019-04-02 20:19:06 +10:00
parent db4b2d7f16
commit 998681abaf
4 changed files with 74 additions and 0 deletions

View File

@ -29,6 +29,16 @@ Point your browser on http://192.168.44.55 (or use `/etc/hosts` entry explain.de
1. Open `explain.pp` and fix line 5 with correct project dir value
1. Call `sudo puppet apply --logdest console explain.pp` on your working copy directory.
## Docker Compose setup
*NOTE* This setup should be considered for quick analysis purposes only - while docker-compose
does keep DBs around from run to run, don't rely on it to store your history long term.
```
cd docker
docker-compose up --build
```
## Manual setup
### 1) Mojolicious

29
docker/Dockerfile Normal file
View File

@ -0,0 +1,29 @@
FROM debian:stretch
WORKDIR /explain
RUN curl -L cpanmin.us | perl - -n Mojolicious
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y libmojolicious-perl \
libemail-sender-perl \
libdate-simple-perl \
libemail-valid-perl \
libxml-simple-perl \
libdbd-pg-perl \
libmodule-build-perl \
libyaml-perl \
libjson-perl \
libclone-perl \
libtest-deep-perl \
libtest-exception-perl
RUN cpan install Pg::Explain
COPY lib/ ./lib/
RUN sed -i s/Mail::Sender/Email::Sender/g lib/Explain/Plugin/MailSender.pm
COPY docker/explain.json explain.pl ./
COPY layout/ /layout/
COPY public/ ./public/
COPY templates/ ./templates
ENTRYPOINT ./explain.pl daemon

18
docker/docker-compose.yml Normal file
View File

@ -0,0 +1,18 @@
version: '3'
services:
web:
build:
context: ..
dockerfile: docker/Dockerfile
ports:
- "3000:3000"
depends_on:
- "db"
db:
image: "postgres:10.7"
environment:
POSTGRES_USER: explaind
POSTGRES_PASSWORD: explain
POSTGRES_DB: explain
volumes:
- ../sql:/docker-entrypoint-initdb.d

17
docker/explain.json Normal file
View File

@ -0,0 +1,17 @@
{
"title" : "explain.localhost",
"secret" : "probablynotimportantforephemeral",
"database" : {
"dsn" : "dbi:Pg:database=explain;host=db;port=5432",
"username" : "explaind",
"password" : "explain",
"options" : {
"auto_commit" : 1,
"pg_server_prepare" : 0,
"RaiseError" : 1,
"PrintError" : 1
}
}
}