Skip to content

Commit

Permalink
chore: update lagoon config (#446)
Browse files Browse the repository at this point in the history
* chore: update app dockerfile

* chore: update lagoon project id

* chore: update app dockerfile

* chore: backend test

* chore: split lagoon and docker files

* chore: update ci test workflow

* chore: add ci deploy job

* chore(lagoon): add staging workflow
  • Loading branch information
Decipher committed Sep 9, 2022
1 parent 2debce1 commit 0581e4f
Show file tree
Hide file tree
Showing 10 changed files with 320 additions and 6 deletions.
2 changes: 0 additions & 2 deletions .docker/Dockerfile.app
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ COPY --from=builder /app/node_modules /app/node_modules
COPY ./nuxt/ /app/
COPY ./.env /app/

RUN yarn

ARG GITHUB_CLIENT_ID
ARG GITHUB_CLIENT_SECRET
ARG OAUTH_CLIENT_ID
Expand Down
7 changes: 7 additions & 0 deletions .env.staging
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
BASE_URL=https://nginx.staging-backend.druxtjs-org-demo-umami.au2.amazee.io
API_PROXY=1

# OAuth settings - Uncomment and set value as per backend.
#OAUTH_CLIENT_ID=
#GITHUB_CLIENT_ID=
#GITHUB_CLIENT_SECRET=
65 changes: 65 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: deploy-production

on:
push:
branches:
- main

jobs:
ci:
runs-on: ${{ matrix.os }}

environment:
name: staging
# @TODO - umami.demo.druxtjs.org
url: https://demo.druxtjs.org

strategy:
matrix:
os: [ubuntu-latest]
node: [16]

steps:
- name: Checkout 🛎
uses: actions/checkout@master

- name: Configure git
run: |
git config --global user.name 'Deploy workflow'
git config --global user.email "ci@{$GITHUB_HEAD_REF}"
- name: Deploy backend
run: |
git checkout -b production/backend
cp .lagoon.backend.yml .lagoon.yml
git commit -am "chore(ci): add backend lagoon configuration"
git push origin production/backend --force
- name: Sleep
run: sleep 120s
- name: Wait for backend
uses: nev7n/wait_for_response@v1
with:
url: 'https://nginx.production-backend.druxtjs-org-demo-umami.au2.amazee.io/jsonapi'
responseCode: 200
timeout: 600000
interval: 15000

- name: Deploy frontend
run: |
git checkout $GITHUB_HEAD_REF
git checkout -b production/frontend
cp .lagoon.frontend.yml .lagoon.yml
git commit -am "chore(ci): add frontend lagoon configuration"
git push origin production/frontend --force
- name: Wait for frontend
uses: nev7n/wait_for_response@v1
with:
url: 'https://demo.druxtjs.org'
responseCode: 200
timeout: 600000
interval: 15000

# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
65 changes: 65 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: deploy-staging

on:
push:
branches:
- develop

jobs:
deploy:
runs-on: ${{ matrix.os }}

environment:
name: staging
url: https://app.staging-frontend.druxtjs-org-demo-umami.au2.amazee.io

strategy:
matrix:
os: [ubuntu-latest]
node: [16]

steps:
- name: Checkout 🛎
uses: actions/checkout@master

- name: Configure git
run: |
git config --global user.name 'Deploy workflow'
git config --global user.email "ci@{$GITHUB_HEAD_REF}"
- name: Deploy backend
run: |
git checkout -b staging/backend
cp .lagoon.backend.yml .lagoon.yml
git commit -am "chore(ci): add backend lagoon configuration"
git push origin staging/backend --force
- name: Sleep
run: sleep 120s
- name: Wait for backend
uses: nev7n/wait_for_response@v1
with:
url: 'https://nginx.staging-backend.druxtjs-org-demo-umami.au2.amazee.io/jsonapi'
responseCode: 200
timeout: 600000
interval: 15000

- name: Deploy frontend
run: |
git checkout $GITHUB_HEAD_REF
git checkout -b staging/frontend
cp .lagoon.frontend.yml .lagoon.yml
cp .env.staging .env
git commit -am "chore(ci): add frontend lagoon configuration"
git push origin staging/frontend --force
- name: Wait for frontend
uses: nev7n/wait_for_response@v1
with:
url: 'https://app.staging-frontend.druxtjs-org-demo-umami.au2.amazee.io'
responseCode: 200
timeout: 600000
interval: 15000

# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml → .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ci
name: test

on:
push:
Expand Down Expand Up @@ -42,7 +42,7 @@ jobs:
restore-keys: |
${{ runner.os }}-node-
- name: Install dependencies 👨🏻‍💻
- name: Install frontend dependencies 👨🏻‍💻
run: cd nuxt && yarn install

- name: Run linter 👀
Expand Down
48 changes: 48 additions & 0 deletions .lagoon.backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
docker-compose-yaml: docker-compose.backend.yml

project: druxtjs-org-demo-umami

tasks:
post-rollout:
- run:
name: drush si
command: drush -y si demo_umami
service: cli

- run:
name: drush en
command: drush -y en druxt_umami
service: cli

- run:
name: drush rap
command: drush rap anonymous 'access druxt resources'
service: cli

- run:
name: drush config:set
command: |
drush config:set druxt_node_preview.settings frontends "Production|https://demo.druxtjs.org/node/preview/[view_mode]#[jsonapi_node_preview]" -y
drush config:set jsonapi.settings read_only 0 -y
service: cli

- run:
name: drush search-api:index
command: drush search-api:index
service: cli

- run:
name: drush user:login
command: drush user:login
service: cli

environments:
main:
routes:
- nginx:
- demo-api.druxtjs.org
cronjobs:
- name: drush cron
schedule: "*/15 * * * *"
command: drush cron
service: cli
11 changes: 11 additions & 0 deletions .lagoon.frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
docker-compose-yaml: 'docker-compose.frontend.yml'

project: druxtjs-org-demo-umami

environments:
main:
routes:
- app:
- demo.druxtjs.org
- storybook:
- storybook.demo.druxtjs.org
4 changes: 2 additions & 2 deletions .lagoon.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
docker-compose-yaml: docker-compose.yml
docker-compose-yaml: 'docker-compose.yml'

project: demo-druxtjs-org
project: druxtjs-org-demo-umami

tasks:
post-rollout:
Expand Down
78 changes: 78 additions & 0 deletions docker-compose.backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
version: '2.3'

x-user:
&default-user
# The default user under which the containers should run. Change this if you are on linux and run with another user than id `1000`
user: '1000'

services:
cli:
build:
context: .
dockerfile: .docker/Dockerfile.cli
image: &cli-image druxt-umami-cli
labels:
lagoon.type: cli-persistent
lagoon.persistent.name: nginx
lagoon.persistent: /app/web/sites/default/files/
lando.type: php-cli-drupal
# << : *default-volumes
user: root
volumes_from: ### mount the ssh-agent from the pygmy or cachalot ssh-agent. Automatically removed in CI.
- container:amazeeio-ssh-agent ### Local overrides to mount host SSH keys. Automatically removed in CI.
# environment:
# << : *default-environment # loads the defined environment variables from the top

nginx:
build:
context: .
dockerfile: .docker/Dockerfile.nginx
args:
CLI_IMAGE: *cli-image # Inject the name of the cli image
labels:
lagoon.type: nginx-php-persistent
lagoon.persistent: /app/web/sites/default/files/ # define where the persistent storage should be mounted too
lando.type: nginx-drupal
# << : *default-volumes # loads the defined volumes from the top
<< : *default-user # uses the defined user from top
depends_on:
- cli # basically just tells docker-compose to build the cli first
# environment:
# << : *default-environment # loads the defined environment variables from the top
# LAGOON_LOCALDEV_URL: *default-url
networks:
- amazeeio-network
- default

php:
build:
context: .
dockerfile: .docker/Dockerfile.php
args:
CLI_IMAGE: *cli-image
labels:
lagoon.type: nginx-php-persistent
lagoon.name: nginx # we want this service be part of the nginx pod in Lagoon
lagoon.persistent: /app/web/sites/default/files/ # define where the persistent storage should be mounted too
lando.type: php-fpm
# << : *default-volumes # loads the defined volumes from the top
# << : *default-user # uses the defined user from top
depends_on:
- cli # basically just tells docker-compose to build the cli first
# environment:
# << : *default-environment # loads the defined environment variables from the top

mariadb:
image: amazeeiolagoon/mariadb-drupal:pr-892
labels:
lagoon.type: mariadb
lando.type: mariadb-drupal
ports:
- "3306" # exposes the port 3306 with a random local port, find it with `docker-compose port mariadb 3306`
# << : *default-user # uses the defined user from top
# environment:
# << : *default-environment

networks:
amazeeio-network:
external: true
42 changes: 42 additions & 0 deletions docker-compose.frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: '2.3'

services:
app:
networks:
- amazeeio-network
- default
build:
context: .
dockerfile: .docker/Dockerfile.app
args:
GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID}
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET}
OAUTH_CLIENT_ID: ${OAUTH_CLIENT_ID}
labels:
lagoon.type: node
lando.type: node
environment:
LAGOON_LOCALDEV_HTTP_PORT: 3000
LAGOON_ROUTE: http://demo-druxtjs-org.docker.amazee.io

storybook:
networks:
- amazeeio-network
- default
build:
context: .
dockerfile: .docker/Dockerfile.storybook
args:
GITHUB_CLIENT_ID: ${GITHUB_CLIENT_ID}
GITHUB_CLIENT_SECRET: ${GITHUB_CLIENT_SECRET}
OAUTH_CLIENT_ID: ${OAUTH_CLIENT_ID}
labels:
lagoon.type: node
lando.type: node
environment:
LAGOON_LOCALDEV_HTTP_PORT: 3000
LAGOON_ROUTE: http://storybook-demo-druxtjs-org.docker.amazee.io

networks:
amazeeio-network:
external: true

0 comments on commit 0581e4f

Please sign in to comment.