Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
21 changes: 21 additions & 0 deletions .docker/Dockerfile.app
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM uselagoon/node-16-builder:latest as builder

COPY ./nuxt/ /app/
RUN yarn

FROM uselagoon/node-16:latest

COPY --from=builder /app/node_modules /app/node_modules
COPY ./nuxt/ /app/
COPY ./.env /app/

ARG OAUTH_CLIENT_ID

ENV OAUTH_CLIENT_ID ${OAUTH_CLIENT_ID}

RUN yarn build && yarn generate

ENV HOST 0.0.0.0
EXPOSE 3000

CMD ["yarn", "start"]
10 changes: 10 additions & 0 deletions .docker/Dockerfile.cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM amazeeio/php:8.1-cli-drupal

COPY ./drupal/composer.* /app/
COPY ./drupal/assets /app/assets
RUN composer install --no-dev
COPY ./drupal/ /app
RUN mkdir -p -v -m775 /app/web/sites/default/files

# Define where the Drupal Root is located
ENV WEBROOT=web
9 changes: 9 additions & 0 deletions .docker/Dockerfile.nginx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ARG CLI_IMAGE
FROM ${CLI_IMAGE} as cli

FROM amazeeio/nginx-drupal

COPY --from=cli /app /app

# Define where the Drupal Root is located
ENV WEBROOT=web
6 changes: 6 additions & 0 deletions .docker/Dockerfile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ARG CLI_IMAGE
FROM ${CLI_IMAGE} as cli

FROM amazeeio/php:8.1-fpm

COPY --from=cli /app /app
22 changes: 22 additions & 0 deletions .docker/Dockerfile.storybook
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM uselagoon/node-16-builder:latest as builder

COPY ./nuxt/ /app/

RUN yarn

FROM uselagoon/node-16:latest

COPY --from=builder /app/node_modules /app/node_modules
COPY ./nuxt/ /app/
COPY ./.env /app/

ARG OAUTH_CLIENT_ID

ENV OAUTH_CLIENT_ID ${OAUTH_CLIENT_ID}

ENV HOST 0.0.0.0
EXPOSE 3000

WORKDIR /app

CMD ["yarn", "storybook", "-p", "3000"]
4 changes: 4 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
BASE_URL=https://api.commerce.demo.druxtjs.org

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

on:
push:
branches:
- develop
- feature/5-lagoon

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

environment:
name: staging
url: https://app.staging-frontend.druxtjs-org-demo-commerce.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-commerce.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-commerce.au2.amazee.io'
responseCode: 200
timeout: 600000
interval: 15000

# - name: Setup upterm session
# uses: lhotari/action-upterm@v1
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ typings/
# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

Expand Down
30 changes: 30 additions & 0 deletions .lagoon.backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
docker-compose-yaml: 'docker-compose.backend.yml'

project: druxtjs-org-demo-commerce

tasks:
post-rollout:
- run:
name: drush tome:install
command: drush -y tome:install
service: cli

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

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

project: druxtjs-org-demo-commerce

environments:
staging/frontend:
routes:
- app:
- staging.commerce.demo.druxtjs.org
- storybook:
- storybook.staging.commerce.demo.druxtjs.org
production/frontend:
routes:
- app:
- commerce.demo.druxtjs.org
- storybook:
- storybook.commerce.demo.druxtjs.org
42 changes: 42 additions & 0 deletions .lagoon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
docker-compose-yaml: 'docker-compose.yml'

project: druxtjs-org-demo-commerce

tasks:
post-rollout:
- run:
name: drush tome:install
command: drush -y tome:install
service: cli

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

environments:
staging/frontend:
routes:
- app:
- staging.commerce.demo.druxtjs.org
- storybook:
- storybook.staging.commerce.demo.druxtjs.org
staging/backend:
routes:
- nginx:
- api.staging.commerce.demo.druxtjs.org
production/frontend:
routes:
- app:
- commerce.demo.druxtjs.org
- storybook:
- storybook.commerce.demo.druxtjs.org
production/backend:
routes:
- nginx:
- api.commerce.demo.druxtjs.org
cronjobs:
- name: drush cron
schedule: "*/15 * * * *"
command: drush cron
service: cli
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 druxtjs-org-demo-commerce-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
38 changes: 38 additions & 0 deletions docker-compose.frontend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '2.3'

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

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

networks:
amazeeio-network:
external: true
Loading