From fce630b6c93bd429bef8ddc7eee4826cce1ffb3c Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Tue, 24 Nov 2020 00:03:01 -0500 Subject: [PATCH] Add basic arkhamdb setup --- .gitignore | 2 ++ Dockerfile | 9 +++++++++ docker-compose.yml | 29 +++++++++++++++++++++++++++++ nginx.conf | 38 ++++++++++++++++++++++++++++++++++++++ parameters.yml | 32 ++++++++++++++++++++++++++++++++ setup.sh | 10 ++++++++++ 6 files changed, 120 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 nginx.conf create mode 100644 parameters.yml create mode 100755 setup.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6465d59 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/arkhamdb-json-data/ +/arkhamdb/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4d96dc2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM php:fpm +RUN docker-php-ext-install mysqli pdo pdo_mysql + +COPY ./arkhamdb/ /srv +RUN chown -R www-data: /srv +COPY parameters.yml /srv/app/config/parameters.yml + +COPY --from=composer:1 /usr/bin/composer /usr/bin/composer +RUN cd /srv/ && composer install diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4754691 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +version: '3' +services: + arkhamdb: + build: . + working_dir: /var/www/html + depends_on: + - database + restart: always + volumes: + - ./arkhamdb-json-data:/srv/arkhamdb-json-data + - ./000-default.conf:/etc/apache2/sites-enabled/000-default.conf + nginx: + image: nginx + depends_on: + - arkhamdb + restart: always + ports: + - 127.0.0.1:80:80 + volumes: + - ./arkhamdb:/srv + - ./nginx.conf:/etc/nginx/conf.d/default.conf + database: + image: mariadb + restart: always + environment: + MYSQL_RANDOM_ROOT_PASSWORD: 'yes' + MYSQL_DATABASE: arkhamdb + MYSQL_USER: arkhamdb + MYSQL_PASSWORD: arkhamdb diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..304d42e --- /dev/null +++ b/nginx.conf @@ -0,0 +1,38 @@ +server { + listen 80; + + root /srv/web/; + index app.php; + + location / { + # try to serve file directly, fallback to app.php + try_files $uri /app.php$is_args$args; + } + + location ~ ^/app\.php(/|$) { + fastcgi_pass arkhamdb:9000; + fastcgi_split_path_info ^(.+\.php)(/.*)$; + fastcgi_param SCRIPT_FILENAME /srv/web/app.php; + include fastcgi_params; + + # When you are using symlinks to link the document root to the + # current version of your application, you should pass the real + # application path instead of the path to the symlink to PHP + # FPM. + # Otherwise, PHP's OPcache may not properly detect changes to + # your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126 + # for more information). + fastcgi_param SCRIPT_FILENAME /srv/web/app.php; + fastcgi_param DOCUMENT_ROOT /srv/web; + # Prevents URIs that include the front controller. This will 404: + # http://domain.tld/app.php/some-path + # Remove the internal directive to allow URIs like this + internal; + } + + # return 404 for all other php files not matching the front controller + # this prevents access to other php files you don't want to be accessible. + location ~ \.php$ { + return 404; + } +} diff --git a/parameters.yml b/parameters.yml new file mode 100644 index 0000000..1ce44af --- /dev/null +++ b/parameters.yml @@ -0,0 +1,32 @@ +parameters: + database_host: database + database_port: 3306 + database_name: arkhamdb + database_user: arkhamdb + database_password: arkhamdb + + mailer_transport: smtp + mailer_host: 127.0.0.1 + mailer_user: null + mailer_password: null + + # A secret key that's used to generate certain security-related tokens + secret: ThisTokenIsNotSoSecretChangeIt + + # units: seconds + cache_expiration: 600 + + # Email sender + email_sender_address: whatever@example.com + email_sender_name: Whatever + + # Branding + website_name: Docker ArkhamDB + website_url: localhost + game_name: Arkham Horror LCG + publisher_name: Fantasy Flight Games + + # Analytics & AdSense + google_analytics_tracking_code: UA-00000000-1 + google_adsense_client: ca-pub-000000000000000 + google_adsense_slot: 0000000000 diff --git a/setup.sh b/setup.sh new file mode 100755 index 0000000..32816a6 --- /dev/null +++ b/setup.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -e + +git clone https://github.com/Kamalisk/arkhamdb +git clone https://github.com/ad1217/arkhamdb-json-data + +docker-compose up -d + +docker-compose exec -T -w /srv/ arkhamdb php bin/console doctrine:schema:create +docker-compose exec -T -w /srv/ arkhamdb php bin/console app:import:std ./arkhamdb-json-data/