Skip to content

Commit

Permalink
add draft for testing upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
kingjia90 committed Sep 11, 2023
1 parent eadca21 commit d0e5d62
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 2 deletions.
55 changes: 55 additions & 0 deletions .github/ci/files/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
services:
redis:
image: redis:alpine
command: [ redis-server, --maxmemory, 128mb, --maxmemory-policy, volatile-lru, --save, '""' ]

db:
image: mysql:latest
working_dir: /application
command: [ mysqld, --character-set-server=utf8mb4, --collation-server=utf8mb4_unicode_ci, --innodb-file-per-table=1 ]
volumes:
- pimcore-demo-mysql-database:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: ROOT
MYSQL_DATABASE: pimcore
MYSQL_USER: pimcore
MYSQL_PASSWORD: pimcore

nginx:
image: nginx:stable-alpine
ports:
- "80:80"
volumes:
- .:/var/www/html:ro
- ./.docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro
depends_on:
- php

php:
#user: '1000:1000' # set to your uid:gid
image: pimcore/pimcore:php8.2-debug-latest
environment:
COMPOSER_HOME: /var/www/html
PHP_IDE_CONFIG: serverName=localhost
depends_on:
- db
volumes:
- .:/var/www/html

supervisord:
#user: '1000:1000' # set to your uid:gid
image: pimcore/pimcore:php8.2-supervisord-latest
depends_on:
- db
volumes:
- .:/var/www/html
- ./.docker/supervisord.conf:/etc/supervisor/conf.d/pimcore.conf:ro

chrome:
image: browserless/chrome

gotenberg:
image: gotenberg/gotenberg:7

volumes:
pimcore-demo-mysql-database:
7 changes: 7 additions & 0 deletions .github/ci/files/scripts/setup-pimcore-environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -eu

mkdir -p var/config

cp .github/ci/files/docker-compose.yaml docker-compose.yaml
110 changes: 110 additions & 0 deletions .github/workflows/pimcore-demo-mysql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Test Pimcore Demo on Mysql

on:
schedule:
- cron: '0 3 * * 1,3,5'
pull_request:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
push:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
- "*_actions"

jobs:
test-pimcore-demo:
runs-on: ubuntu-latest
steps:
# Check out the repo in a sub-dir to see if it can serve as
# template for `composer create-project`
# See: https://github.com/actions/checkout#usage
- uses: actions/checkout@v2
with:
path: 'demo'

- name: Pull latest pimcore image
run: |
# Echo commands and terminate on first error
set -ex
# Pull latest build of pimcore's image
docker pull docker.io/pimcore/pimcore:php8.2-latest
- name: Create project from demo in latest pimcore environment
run: |
# Echo commands and terminate on first error
set -ex
# Try creating a new project with composer using contents of this repo as the package.
# We execute composer within docker container to suttisfy platform requirements.
# The value of ´"url":` must match checkout path in the first step.
#
# See: https://getcomposer.org/doc/03-cli.md#create-project
# See: https://getcomposer.org/doc/05-repositories.md#path
docker run \
--volume=${{ github.workspace }}/:/test/ \
--workdir=/test/ \
--user=$(id -u):$(id -g) \
docker.io/pimcore/pimcore:php8.2-latest \
composer create-project \
pimcore/demo:@dev \
--repository='{"type": "path", "url": "./demo"}' \
sample-project
- name: "Setup Pimcore environment"
run: |
.github/ci/scripts/setup-pimcore-environment.sh
- name: Smoke-test compose file
run: |
# Echo commands and terminate on first error
set -ex
# Check (lint) the compose file
docker-compose -v
cd sample-project/
docker-compose config
- name: Test pimcore installation
run: |
# Echo commands and terminate on first error
set -ex
cd sample-project/
# Start containers
docker-compose pull --quiet
docker-compose down -v --remove-orphans
docker-compose up -d
# Install dockerize into the php container. We need it to block until
# database is ready to serve connections.
docker-compose exec -T -- php bash -c '\
curl -sfL https://github.com/powerman/dockerize/releases/download/v0.11.5/dockerize-`uname -s`-`uname -m` \
| install /dev/stdin /usr/local/bin/dockerize'
# Wait for the database to set up.
docker-compose exec -T -- php dockerize -wait tcp://db:3306 -timeout 5m
# Run pimcore installation.
docker-compose exec -T \
-e PIMCORE_INSTALL_ADMIN_USERNAME=pimcore \
-e PIMCORE_INSTALL_ADMIN_PASSWORD=pimcore \
-e PIMCORE_INSTALL_MYSQL_USERNAME=pimcore \
-e PIMCORE_INSTALL_MYSQL_PASSWORD=pimcore \
-- \
php vendor/bin/pimcore-install -n --mysql-host-socket=db --mysql-database=pimcore
# Change owner
sudo chown -R www-data .
# Check if website is reachable
response=$(docker-compose exec -T -- php bash -c 'curl -s "nginx:80"')
if [[ ! $response =~ "Satisfaction" ]]; then
echo "Install failed, skipping build"
exit 1;
fi
docker-compose down -v --remove-orphans
4 changes: 2 additions & 2 deletions .github/workflows/pimcore-demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
# Check out the repo in a sub-dir to see if it can serve as
# teplate for `composer create-project`
# template for `composer create-project`
# See: https://github.com/actions/checkout#usage
- uses: actions/checkout@v2
with:
Expand All @@ -38,7 +38,7 @@ jobs:
set -ex
# Try creating a new project with composer using contents of this repo as the package.
# We execute composer within docker container to suttisfy platform requirements.
# We execute composer within docker container to satisfy platform requirements.
# The value of ´"url":` must match checkout path in the first step.
#
# See: https://getcomposer.org/doc/03-cli.md#create-project
Expand Down

0 comments on commit d0e5d62

Please sign in to comment.