Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

WIP: Apply paas scaffold to the saas scaffold. #32

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d3462dd
Apply paas scaffold to the saas scaffold.
simesy Dec 5, 2019
1916fc6
Pseudocode for saas-paas-mashup.
simesy Dec 5, 2019
5c63c7c
Misssing files from paas scaffold.
simesy Dec 6, 2019
4b44f59
Processing scripts updates.
simesy Dec 6, 2019
9103143
Commits.
simesy Dec 7, 2019
0956659
Need custom composer in container.
simesy Dec 7, 2019
5ee43bb
Set up custom dir only if not exists.
simesy Dec 7, 2019
37b2e3c
Paths and strucctures.
simesy Dec 7, 2019
5863537
Ensure govcms-deploy called from scaffold-tooling.
simesy Dec 10, 2019
be9dc0a
Latest stable is preferred not a tag.
simesy Dec 10, 2019
b3fc5fe
New lagoon.yml for pre/post rollout task detai.
simesy Dec 11, 2019
96d41a8
Update after reivew.
simesy Dec 12, 2019
0bda846
Shortening.
simesy Dec 12, 2019
2c0ca04
Use bash for commands.
simesy Dec 12, 2019
835b590
Brackets.
simesy Dec 12, 2019
106b47f
Brackets.
simesy Dec 12, 2019
ad20555
More readable shorter mv.
simesy Dec 12, 2019
0a58edb
Cex logic fixes and alias name fix.
simesy Dec 12, 2019
fac7b04
Latest.
simesy Dec 12, 2019
5e364c1
fix
simesy Dec 12, 2019
85a9349
Add a SNAPSHOTS env for future use.
simesy Dec 12, 2019
277c08e
Quiet
simesy Dec 13, 2019
1d75135
Ensure backups dir exists during transition
simesy Dec 13, 2019
2287709
up first
simesy Dec 13, 2019
4ad12aa
Clean up drush aliases.
simesy Dec 13, 2019
05e1ff7
Add baseline drush yml.
simesy Dec 13, 2019
ae05c11
Various drush and script fixes.
simesy Dec 13, 2019
f1b66f1
Drupal 9 compatible import.
simesy Dec 14, 2019
de2cb27
Simplify settings.php, move docs to wiki, add settings location var t…
simesy Dec 14, 2019
fc18a7d
Fixes from working on the new lagoon.yml
simesy Dec 16, 2019
7ce8bfb
Merge branch 'feature/use-lagoon-yml' into paas-saas-mash-up
simesy Dec 16, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 20 additions & 31 deletions .ahoy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ commands:
else
ahoy confirm "Running this command will destroy your current site, database and build? Are you sure you didn't mean ahoy stop?" &&
# Run this if confirm returns true
docker-compose down --volumes ||
docker-compose down --volumes ||
# Run this if confirm returns false
echo "OK, probably a wise choice..."
fi
Expand All @@ -32,7 +32,7 @@ commands:
cmd: docker-compose exec -T cli bash -c "$@"

govcms-deploy:
usage: Runs deployment commands (config import, updb, cr, set up file_stage_proxy)
usage: Runs deployment commands (e.g. config import, updb, cr, set up file_stage_proxy)
cmd: docker-compose exec -T cli govcms-deploy

drush:
Expand All @@ -57,35 +57,12 @@ commands:

install:
usage: Install the profile.
cmd: docker-compose exec -T cli drush si -y govcms "$@"; ahoy govcms-deploy
cmd: docker-compose exec -T cli drush si -y "$@"; ahoy govcms-deploy

login:
usage: Login to a website.
cmd: docker-compose exec -T cli drush uli "$@"

cex:
usage: Export site configuration to default location.
cmd: docker-compose exec -T cli drush cex sync

cim:
usage: Import site configuration. Will perform partial configuration overrides if a parameter is provided.
cmd: |
if [ -f ./config/default/system.site.yml ]; then
configUuid="$(cat ./config/default/system.site.yml | grep uuid | tail -c +7 | head -c 36)"
docker-compose exec -T cli drush config-set system.site uuid $configUuid
fi

# No support for config import for entire site install.
docker-compose exec -T cli drush ev '\Drupal::entityManager()->getStorage("shortcut_set")->load("default")->delete();'
docker-compose exec -T cli drush pm-uninstall shortcut

if [ "$#" -eq 0 ]
then
docker-compose exec -T cli drush cim sync
else
docker-compose exec -T cli drush cim "$@" --partial
fi

mysql-import:
usage: Pipe in a sql file. `ahoy mysql-import local.sql`
cmd: |
Expand All @@ -101,15 +78,22 @@ commands:

lint:
usage: Lint code
cmd: docker-compose exec -T test lint-theme
cmd: docker-compose exec -T test ./vendor/bin/govcms-lint web/themes/custom

tests:
usage: Run all tests.
cmd: |
ahoy test-behat
ahoy test-phpunit
ahoy lint

test-behat:
usage: Run Behat tests.
cmd: docker-compose exec -T test behat "$@"
cmd: docker-compose exec -T test ./vendor/bin/govcms-behat "$@"

test-phpunit:
usage: Run PHPUnit tests.
cmd: docker-compose exec -T test phpunit "$@"
usage: Run phpunit tests
cmd: docker-compose exec -T test ./vendor/bin/govcms-phpunit --testsuite govcms

pull:
usage: Pull latest docker images.
Expand All @@ -126,7 +110,7 @@ commands:

audit-site:
usage: Run site audit
cmd: docker-compose exec -T test drutiny profile:run ci @self "$@"
cmd: docker-compose exec -T test ./vendor/bin/govcms-audit

confirm:
cmd: |
Expand All @@ -138,3 +122,8 @@ commands:
false
fi
hide: true

my:
usage: Custom commands for this project. See `ahoy my help`.
imports:
- 'custom/ahoy.yml'
35 changes: 30 additions & 5 deletions .docker/Dockerfile.cli
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
##
# @see https://govcms.gov.au/wiki-advanced#docker
#

ARG CLI_IMAGE
ARG GOVCMS_IMAGE_VERSION=latest

FROM govcms8lagoon/govcms8:${GOVCMS_IMAGE_VERSION}

COPY themes/ /app/web/themes/custom
COPY config /app/config
ENV WEBROOT=web

# @todo Can be removed when we can trust files from govcms/govcms8lagoon images.
RUN rm -rf /app

COPY composer.json composer.lock /app/
COPY custom/composer /app/custom/composer
COPY scripts /app/scripts

# Run composer. Additional `rm`s can be added to reduce the image size, with diminishing returns.
RUN composer install --no-dev --no-interaction --no-suggest \
&& rm -rf ~/.composer/cache \
&& rm -rf /app/web/core/tests \
&& rm -rf /app/web/modules/contrib/webform/tests

# Place remaining files from repository, note exclusions in .dockerignore.
COPY . /app

# @todo Move this alias file to govcms/govcms8lagoon.
COPY .docker/config/cli/govcms.site.yml /app/drush/sites/

# Default application favicon this will be used for files and server
# error pages all other favicon requests will be surfaced via Drupal.
COPY favicon.ico /app/web
# Set up platform modules from scaffold. This only needs to happen in lagoon and locally you won't see the effect due to mounting of /app.
RUN rm -Rf /app/web/sites/all \
&& mkdir -p /app/web/sites/all \
&& cp -Rf /app/vendor/govcms/scaffold-tooling/drupal/modules /app/web/sites/all/
12 changes: 11 additions & 1 deletion .docker/Dockerfile.nginx-drupal
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
##
# @see https://govcms.gov.au/wiki-advanced#docker
#

ARG CLI_IMAGE

ARG GOVCMS_IMAGE_VERSION=latest

FROM ${CLI_IMAGE} as cli
FROM govcms8lagoon/nginx-drupal:${GOVCMS_IMAGE_VERSION}

COPY --from=cli /app /app
ENV WEBROOT=web

RUN rm -rf /app

# nginx only needs the root and any static files that are there, the rest is handled by the php container.
COPY --from=cli /app/web /app/web
5 changes: 5 additions & 0 deletions .docker/Dockerfile.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
##
# @see https://govcms.gov.au/wiki-advanced#docker
#

ARG CLI_IMAGE
ARG GOVCMS_IMAGE_VERSION=latest

FROM ${CLI_IMAGE} as cli
FROM govcms8lagoon/php:${GOVCMS_IMAGE_VERSION}

RUN rm -rf /app
COPY --from=cli /app /app
18 changes: 18 additions & 0 deletions .docker/Dockerfile.solr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
##
# @see https://govcms.gov.au/wiki-advanced#docker
#

ARG GOVCMS_IMAGE_VERSION=latest

FROM govcms8lagoon/solr:${GOVCMS_IMAGE_VERSION}

# Copy the Solr configuration files.
COPY .docker/config/solr /solr-conf/conf

USER root
RUN sed -i -e "s#<dataDir>\${solr.data.dir:}#<dataDir>/var/solr/\${solr.core.name}#g" /solr-conf/conf/solrconfig.xml \
&& sed -i -e "s#solr.lock.type:native#solr.lock.type:none#g" /solr-conf/conf/solrconfig.xml

USER solr
RUN precreate-core drupal /solr-conf
CMD ["solr-foreground"]
31 changes: 26 additions & 5 deletions .docker/Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,10 +1,31 @@
##
# @see https://govcms.gov.au/wiki-advanced#docker
#

ARG CLI_IMAGE
ARG GOVCMS_IMAGE_VERSION=latest

FROM ${CLI_IMAGE} as cli
FROM govcms8lagoon/test:${GOVCMS_IMAGE_VERSION}

COPY themes/ /app/web/themes/custom
ENV WEBROOT=web

# @todo find out why this.
RUN mv /app/tests /tests

RUN rm -rf /app
COPY --from=cli /app /app

# Copy the test scripts.
RUN cp /app/vendor/govcms/scaffold-tooling/scripts/* /usr/local/bin/
RUN chmod +x /usr/local/bin/*

RUN rm -Rf /app/tests/behat/features/*
COPY tests/behat/features/ /app/tests/behat/features
# Build govcms/site-audit outside of the mount, although it needs to go into /app at test time.
# @todo audit-site/drutiny (probably the phar) should be available in test container upstream. Not doing any optimisation or cleanup here.
WORKDIR /opt
RUN git clone --branch 7.x-3.x --depth 1 https://github.com/govCMS/audit-site.git
RUN composer --working-dir=audit-site update --ignore-platform-reqs --no-interaction --no-suggest
WORKDIR /app

RUN rm -Rf /app/tests/phpunit/tests/*
COPY tests/phpunit/tests/ /app/tests/phpunit/tests
# Drutiny expects "drush-launcher" which is not the idea of drush-launcher. Hack around it.
RUN cp /usr/local/bin/drush /usr/local/bin/drush-launcher && chmod +x /usr/local/bin/drush-launcher
16 changes: 16 additions & 0 deletions .docker/config/cli/govcms.site.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
##
# File /etc/drush/sites/ci.site.yml
# @todo move upstream, see Dockerfile.cli
#
# This is used in integration and workflow processes in Openshift and GitLab.
# It is not intended to be used by clients.
# Run with `drush --alias-path=/etc/drush/sites ci.ALIASNAME`
#

prod:
root: /app
host: ssh.lagoon.svc
user: ${env.LAGOON_PROJECT}-master
uri: nginx-${env.LAGOON_PROJECT}-master.govcms.amazee.io
ssh:
options: -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 2020 -F /dev/null
27 changes: 27 additions & 0 deletions .docker/config/solr/elevate.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" ?>

<!--
This file allows you to boost certain search items to the top of search
results. You can find out an item's ID by searching directly on the Solr
server. Search API generally constructs item IDs (esp. for entities) as:
$document->id = "$site_hash-$index_id-$datasource:$entity_id:$language_id";

If you want this file to be automatically re-loaded when a Solr commit takes
place (e.g., if you have an automatic script active which updates elevate.xml
according to newly-indexed data), place it into Solr's data/ directory.
Otherwise, place it with the other configuration files into the conf/
directory.

See http://wiki.apache.org/solr/QueryElevationComponent for more information.
-->

<elevate>
<!-- Example for ranking the node #789 first in searches for "example query": -->
<!--
<query text="example query">
<doc id="ab12cd34-site_index-entity:789:en" />
</query>
-->
<!-- Multiple <query> elements can be specified, contained in one <elevate>. -->
<!-- <query text="...">...</query> -->
</elevate>
14 changes: 14 additions & 0 deletions .docker/config/solr/mapping-ISOLatin1Accent.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# This file contains character mappings for the default fulltext field type.
# The source characters (on the left) will be replaced by the respective target
# characters before any other processing takes place.
# Lines starting with a pound character # are ignored.
#
# For sensible defaults, use the mapping-ISOLatin1Accent.txt file distributed
# with the example application of your Solr version.
#
# Examples:
# "À" => "A"
# "\u00c4" => "A"
# "\u00c4" => "\u0041"
# "æ" => "ae"
# "\n" => " "
7 changes: 7 additions & 0 deletions .docker/config/solr/protwords.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#-----------------------------------------------------------------------
# This file blocks words from being operated on by the stemmer and word delimiter.
&amp;
&lt;
&gt;
&#039;
&quot;
Loading