diff --git a/.env b/.env index 3c24caca0..3aee1a7df 100644 --- a/.env +++ b/.env @@ -19,7 +19,10 @@ ActiveMQ_LOG=WARN ### Drupal # TO DO: Determine if ENVs are needed here to allow for tuning, flexibility in configuration or exposing features # TO DO: Determine what are appropriate logging levels and pipe to stdout, add logging levels below - +# TO DO: Use secrets for password +DRUPAL_MYSQL_DATABASE=isle +DRUPAL_MYSQL_USER=isle +DRUPAL_MYSQL_PASSWORD=moo ### Blazegraph # TO DO: Determine what ENVs are necessary for configuration or startup. @@ -51,12 +54,8 @@ CANTALOUPE_GID=999 # TO DO: Determine if ENVs are needed here to allow for tuning, flexibility in configuration or exposing features # TO DO: Determine what are appropriate logging levels and pipe to stdout, add logging levels below # TO DO: How to expose slow query log abilities? - -MYSQL_ROOT_PASSWORD=# Replace this comment with a recommended password of 26 alpha-numeric characters. Should this be here? -MYSQL_DATABASE=drupal -MYSQL_USER=user -MYSQL_PASSWORD=password -MYSQL_ROOT_PASSWORD=password +# TO DO: Use secrets for passwords +MYSQL_ROOT_PASSWORD=moo ### Postgres @@ -123,11 +122,10 @@ TRAEFIK_API_INSECURE=false # TO DO: Determine what ENVs are necessary for configuration or startup. # TO DO: Determine what are appropriate logging levels and pipe to stdout, add logging levels below. Should this be here? MATOMO_DATABASE_HOST=mysql -MYSQL_PASSWORD=password -MYSQL_DATABASE=matomo -MYSQL_USER=matomo MATOMO_DATABASE_ADAPTER=mysql MATOMO_DATABASE_TABLES_PREFIX=matomo_ MATOMO_DATABASE_USERNAME=matomo MATOMO_DATABASE_PASSWORD=password MATOMO_DATABASE_DBNAME=matomo + +ASSETS_BOOTSTRAP=true diff --git a/build/assets/Dockerfile b/build/assets/Dockerfile new file mode 100644 index 000000000..479fbad83 --- /dev/null +++ b/build/assets/Dockerfile @@ -0,0 +1,15 @@ +FROM alpine:latest +COPY data/assets.tar.gz / +COPY create_dirs.sh / +RUN tar xzvf /assets.tar.gz -C / && \ + sh /create_dirs.sh + +FROM alpine:latest + +RUN apk --no-cache add docker-cli +COPY --from=0 /assets/ /assets +COPY *.sh /bin/ + +RUN chmod 700 /bin/*.sh + +ENTRYPOINT [ "/bin/entrypoint.sh" ] diff --git a/build/assets/bootstrap.sh b/build/assets/bootstrap.sh new file mode 100644 index 000000000..af126cea1 --- /dev/null +++ b/build/assets/bootstrap.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +MYSQL_HOST=isle-dc-mysql-$CONTAINER_SHORT_ID +DRUPAL_HOST=isle-dc-drupal-$CONTAINER_SHORT_ID + +# First, create the Drupal user +echo "Creating Drupal db and user in mysql" +docker exec -i $MYSQL_HOST bash < /usr/local/bin/drush && \ + chmod +x /usr/local/bin/drush && \ + rm -rf /var/www/html/modules && \ + rm -rf /var/www/html/profiles && \ + rm -rf /var/www/html/sites && \ + rm -rf /var/www/html/themes && \ + ln -s /mnt/assets/modules /var/www/html/modules && \ + ln -s /mnt/assets/profiles /var/www/html/profiles && \ + ln -s /mnt/assets/sites /var/www/html/sites && \ + ln -s /mnt/assets/themes /var/www/html/themes diff --git a/docker-compose.mvp1.yml b/docker-compose.mvp1.yml index 2371cc586..18541881a 100644 --- a/docker-compose.mvp1.yml +++ b/docker-compose.mvp1.yml @@ -36,7 +36,8 @@ services: drupal: # review https://github.com/docker-library/docs/blob/master/drupal/content.md - image: drupal:8.8.1-apache + image: birkland/isle-drupal:8.8.2 + build: ./build/drupal container_name: isle-dc-drupal-${CONTAINER_SHORT_ID} env_file: - .env @@ -45,18 +46,11 @@ services: depends_on: - mysql - traefik + - assets ports: - 8080:80 volumes: - # TO DO: Determine what is Drupal volume setup? - # Disagreement re volumes in Drupal community https://github.com/docker-library/drupal/issues/3 - # Is it an idea to only mount sites data and rebuild image with Drupal code changes ? - # Volumes setup should be reviewed https://hub.docker.com/_/drupal/ - # TO DO: Determine what should be in config/drupal? .keep file is in place for now to allow empty dir to appear. - - ./data/drupal/modules:/var/www/html/modules - - ./data/drupal/profiles:/var/www/html/profiles - - ./data/drupal/sites:/var/www/html/sites - - ./data/drupal/themes:/var/www/html/themes + - isle-dc-drupal-data:/mnt/assets # TO DO: Determine what type of container handling is needed restart: always labels: @@ -93,6 +87,7 @@ services: - isle-dc-internal depends_on: - traefik + - assets ports: - "3306:3306" volumes: @@ -115,12 +110,28 @@ services: - isle-dc-internal depends_on: - traefik + - assets ports: - "8082:8080" volumes: - isle-dc-solr-data:/usr/local/solr # TO DO: Determine what type of container handling is needed restart: always + + assets: + image: birkland/isle-assets:0.1.0 + build: ./build/assets + container_name: isle-dc-assets-${CONTAINER_SHORT_ID} + env_file: + - .env + volumes: + - /var/run/docker.sock:/var/run/docker.sock + - ./build/assets/data:/dump + - isle-dc-mysql-data:/assets/mysql + - isle-dc-solr-data:/assets/solr + - isle-dc-drupal-data:/assets/drupal + networks: + - isle-dc-internal networks: @@ -129,6 +140,7 @@ networks: volumes: + isle-dc-drupal-data: isle-dc-mysql-data: # isle-dc-postgres-data # Added to prototype but not currently used isle-dc-solr-data: