diff --git a/README.md b/README.md index 3099b1c..8cf21b7 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..a9d39b6 --- /dev/null +++ b/docker/Dockerfile @@ -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 diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml new file mode 100644 index 0000000..af9ae10 --- /dev/null +++ b/docker/docker-compose.yml @@ -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 diff --git a/docker/explain.json b/docker/explain.json new file mode 100644 index 0000000..0657fc1 --- /dev/null +++ b/docker/explain.json @@ -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 + } + } +}