Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Refactor to use workflow artifacts
Browse files Browse the repository at this point in the history
Avoid on-host builds, faster provisioning
  • Loading branch information
aduth committed Feb 28, 2021
1 parent cc16592 commit fdb90ac
Show file tree
Hide file tree
Showing 22 changed files with 8,240 additions and 672 deletions.
9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
# Bare repository (keep configuration)
/source/*
!/source/config

# Pull clones
/trees/*
!/trees/.gitkeep

# Dependencies
node_modules

# Transient
/build
*.min.css
*.min.js

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ The following options exist, configured by the presence of environment variables
- `MYSQL_ROOT_PASSWORD`: Password to use as root for the MySQL database (default `password`)
- `CONTAINER_TTL_SECONDS`: Container lifetime, in seconds (default `86400`)
- `SENTRY_DSN`: [Sentry data source name](https://docs.sentry.io/platforms/javascript/?platform=node), when using Sentry for error logging
- `BUILD_TTL_DAYS`: The length in time to keep built archives after last provision, in days (default `30`)

You can assign values to these by creating a [`.env` file](https://docs.docker.com/compose/env-file/) at the root of the project directory, or as a persistent user or system environment variable.

Expand Down
3 changes: 0 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,9 @@ services:
build: ./images/gutenbergrun-cleaner
environment:
- CONTAINER_TTL_SECONDS=${CONTAINER_TTL_SECONDS:-86400}
- BUILD_TTL_DAYS=${BUILD_TTL_DAYS:-30}
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-password}
volumes:
- /var/run/docker.sock:/var/run/docker.sock:delegated
- ./build:/src/build:delegated
- ./trees:/src/trees:delegated
depends_on:
- db
networks:
Expand Down
3 changes: 1 addition & 2 deletions images/gutenbergrun-cleaner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ FROM alpine
RUN apk add docker coreutils mariadb-client

COPY ./purge-containers.sh /purge-containers.sh
COPY ./purge-trees.sh /purge-trees.sh
COPY ./entrypoint.sh /entrypoint.sh
RUN chmod +x /purge-containers.sh /purge-trees.sh /entrypoint.sh
RUN chmod +x /purge-containers.sh /entrypoint.sh

# Setup cronjob
COPY ./cronjobs /etc/crontabs/root
Expand Down
1 change: 0 additions & 1 deletion images/gutenbergrun-cleaner/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ do
sleep 2
done

/bin/sh -e /purge-trees.sh
/bin/sh -e /purge-containers.sh

# Run Cron in foreground to keep container alive.
Expand Down
6 changes: 0 additions & 6 deletions images/gutenbergrun-cleaner/purge-containers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,3 @@ do
mysql -uroot --password="$MYSQL_ROOT_PASSWORD" -h db -e "DROP DATABASE IF EXISTS container_$container_name;"
docker rm -f $container_id
done

#============================
# Remove builds files last modified two weeks ago.
#============================

find /src/build -type f -mtime +$BUILD_TTL_DAYS -maxdepth 1 -delete
3 changes: 0 additions & 3 deletions images/gutenbergrun-cleaner/purge-trees.sh

This file was deleted.

2 changes: 1 addition & 1 deletion images/gutenbergrun-site/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ EXPOSE 9000
RUN apk add curl sudo mariadb-client php7-json php7-phar php7-common \
php7-iconv php7-json php7-gd php7-curl php7-xml php7-imap php7-cgi fcgi \
php7-pdo php7-pdo_mysql php7-mysqli php7-mysqlnd php7-xmlrpc php7-posix \
php7-mcrypt php7-gettext php7-ldap php7-ctype php7-dom
php7-mcrypt php7-gettext php7-ldap php7-ctype php7-dom zip

# Install WP-CLI

Expand Down
13 changes: 0 additions & 13 deletions images/gutenbergrun-worker/Dockerfile

This file was deleted.

9 changes: 0 additions & 9 deletions source/config

This file was deleted.

Empty file removed trees/.gitkeep
Empty file.
8 changes: 1 addition & 7 deletions web/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,8 @@ module.exports.SENTRY_DSN = process.env.SENTRY_DSN;
module.exports.CONTAINER_TTL_SECONDS = Number( process.env.CONTAINER_TTL_SECONDS );
module.exports.PUBLIC_NETWORK_NAME = 'gutenbergrun_public';
module.exports.SITE_IMAGE = 'gutenbergrun-site';
module.exports.WORKER_IMAGE = 'gutenbergrun-worker';
module.exports.SHORTID_LENGTH = 8;
module.exports.APP_ROOT = __dirname;
module.exports.ROOT = join( module.exports.APP_ROOT, '..' );
module.exports.SOURCE_ROOT = join( module.exports.ROOT, 'source' );
module.exports.BUILD_ROOT = join( module.exports.ROOT, 'build' );
module.exports.HOST_BUILD_ROOT = join( module.exports.HOST_ROOT, 'build' );
module.exports.TREES_ROOT = join( module.exports.ROOT, 'trees' );
module.exports.HOST_TREES_ROOT = join( module.exports.HOST_ROOT, 'trees' );
module.exports.IMAGES_ROOT = join( module.exports.ROOT, 'images' );
module.exports.STATIC_ROOT = join( module.exports.APP_ROOT, 'static' );
module.exports.ARTIFACT_DOWNLOAD_URL = 'https://gutenberg-artifact.aduth.workers.dev/';
Loading

0 comments on commit fdb90ac

Please sign in to comment.