Merge branch 'feature/ci' into develop
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
commit
b7e2c6c15c
54
.mage.yml
54
.mage.yml
|
@ -1,54 +0,0 @@
|
||||||
magephp:
|
|
||||||
environments:
|
|
||||||
prod:
|
|
||||||
user: suivi_intervention_prod
|
|
||||||
from: ./
|
|
||||||
to: /home/suivi_intervention_prod/app
|
|
||||||
host_path: /home/suivi_intervention_prod/app
|
|
||||||
rsync: '-avz --delete'
|
|
||||||
exclude:
|
|
||||||
- "/.git"
|
|
||||||
- "*.swp"
|
|
||||||
- "*.swo"
|
|
||||||
- "/.env.local"
|
|
||||||
- "/data"
|
|
||||||
- "/migrations/*"
|
|
||||||
- "/public/uploads/"
|
|
||||||
- "/public/files/"
|
|
||||||
- "/var/cache/*"
|
|
||||||
- "/var/log/*"
|
|
||||||
- "/var/data.db"
|
|
||||||
- "/public/js/fos_js_routes.json"
|
|
||||||
- "/public/build"
|
|
||||||
- "/public/media"
|
|
||||||
hosts:
|
|
||||||
- chat.tinternet.deblan.org
|
|
||||||
on-deploy:
|
|
||||||
- exec: { cmd: 'make clean', desc: 'cache' }
|
|
||||||
- exec: { cmd: 'test -f .build && make build || true', desc: 'build' }
|
|
||||||
oldprod:
|
|
||||||
user: webtinternetsuiviinter
|
|
||||||
from: ./
|
|
||||||
to: /var/www/service-web/www/suivi-interventions.tinternet.net/app/
|
|
||||||
host_path: /var/www/service-web/www/suivi-interventions.tinternet.net/app/
|
|
||||||
rsync: '-avz --delete'
|
|
||||||
exclude:
|
|
||||||
- "/.git"
|
|
||||||
- "*.swp"
|
|
||||||
- "*.swo"
|
|
||||||
- "/.env.local"
|
|
||||||
- "/data"
|
|
||||||
- "/migrations/*"
|
|
||||||
- "/public/uploads/"
|
|
||||||
- "/public/files/"
|
|
||||||
- "/var/cache/*"
|
|
||||||
- "/var/log/*"
|
|
||||||
- "/var/data.db"
|
|
||||||
- "/public/js/fos_js_routes.json"
|
|
||||||
- "/public/build"
|
|
||||||
- "/public/media"
|
|
||||||
hosts:
|
|
||||||
- deblan.fr
|
|
||||||
on-deploy:
|
|
||||||
- exec: { cmd: 'make clean', desc: 'cache' }
|
|
||||||
- exec: { cmd: 'test -f .build && make build || true', desc: 'build' }
|
|
30
.mage.yml.dist
Normal file
30
.mage.yml.dist
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
magephp:
|
||||||
|
environments:
|
||||||
|
prod:
|
||||||
|
user: ssh_user
|
||||||
|
from: ./
|
||||||
|
to: /home/ssh_user/app
|
||||||
|
host_path: /home/ssh_user/app
|
||||||
|
rsync: '-avz --delete'
|
||||||
|
exclude:
|
||||||
|
- "/.git"
|
||||||
|
- "*.swp"
|
||||||
|
- "*.swo"
|
||||||
|
- "/.env.local"
|
||||||
|
- "/data"
|
||||||
|
- "/migrations/*"
|
||||||
|
- "/public/uploads/"
|
||||||
|
- "/public/files/"
|
||||||
|
- "/var/cache/*"
|
||||||
|
- "/var/log/*"
|
||||||
|
- "/var/data.db"
|
||||||
|
- "/public/js/fos_js_routes.json"
|
||||||
|
- "/public/build"
|
||||||
|
- "/public/media"
|
||||||
|
hosts:
|
||||||
|
- ssh_host
|
||||||
|
on-deploy:
|
||||||
|
- exec: { cmd: 'make clean', desc: 'cache' }
|
||||||
|
- exec: { cmd: 'make doctrine-migration', desc: 'migration' }
|
||||||
|
- exec: { cmd: 'php ./bin/console cache:warmup', desc: 'warmup' }
|
||||||
|
- exec: { cmd: 'php ./bin/console cache:warmup', desc: 'warmup2' }
|
69
.woodpecker/build.yml
Normal file
69
.woodpecker/build.yml
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
variables:
|
||||||
|
- &volumes
|
||||||
|
- node16_cache:/root/.npm
|
||||||
|
- /data/${CI_REPO}:/builds
|
||||||
|
|
||||||
|
when:
|
||||||
|
event: [push, pull_request, tag, manual]
|
||||||
|
branch: [master, master-*, develop, develop-*, feature/*]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
db-wait:
|
||||||
|
image: gitnet.fr/deblan/timeout:latest
|
||||||
|
commands:
|
||||||
|
- /bin/timeout -t 30 -v -c 'while true; do nc -z -v db 3306 2>&1 | grep succeeded && exit 0; sleep 0.5; done'
|
||||||
|
|
||||||
|
db-create:
|
||||||
|
image: mariadb:10.3
|
||||||
|
secrets: [mysqldump]
|
||||||
|
commands:
|
||||||
|
- mysql -hdb -uroot -proot -e "CREATE DATABASE app"
|
||||||
|
|
||||||
|
app-config:
|
||||||
|
image: deblan/php:8.0
|
||||||
|
commands:
|
||||||
|
- echo APP_ENV=prod >> .env.local
|
||||||
|
- echo APP_SECRET=$(openssl rand -hex 32) >> .env.local
|
||||||
|
- echo DATABASE_URL=mysql://root:root@db/app >> .env.local
|
||||||
|
|
||||||
|
php-composer:
|
||||||
|
image: deblan/php:8.0
|
||||||
|
commands:
|
||||||
|
- apt-get update && apt-get -y install git
|
||||||
|
- composer install --no-scripts
|
||||||
|
|
||||||
|
php-build:
|
||||||
|
image: deblan/php:8.0
|
||||||
|
environment:
|
||||||
|
- PHP=php
|
||||||
|
commands:
|
||||||
|
- ./bin/doctrine-migrate
|
||||||
|
- php bin/console fos:js-routing:dump --format=json --target=public/js/fos_js_routes.json
|
||||||
|
|
||||||
|
node-build:
|
||||||
|
image: node:16-alpine
|
||||||
|
commands:
|
||||||
|
- yarn
|
||||||
|
- npm run build
|
||||||
|
|
||||||
|
security-check:
|
||||||
|
image: gitnet.fr/deblan/osv-detector:v0.9
|
||||||
|
commands:
|
||||||
|
- osv-detector composer.lock yarn.lock
|
||||||
|
failure: ignore
|
||||||
|
|
||||||
|
cache-build:
|
||||||
|
image: deblan/mage
|
||||||
|
volumes: *volumes
|
||||||
|
commands:
|
||||||
|
- cd /builds
|
||||||
|
- rsync -az "$CI_WORKSPACE/" "$CI_COMMIT_SHA"
|
||||||
|
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: mariadb:10.3
|
||||||
|
environment:
|
||||||
|
- MARIADB_ROOT_PASSWORD=root
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
node16_cache:
|
25
.woodpecker/deploy.yml
Normal file
25
.woodpecker/deploy.yml
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
variables:
|
||||||
|
- &volumes
|
||||||
|
- /data/${CI_REPO}:/builds
|
||||||
|
|
||||||
|
when:
|
||||||
|
event: [deployment]
|
||||||
|
|
||||||
|
skip_clone: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
app-deploy:
|
||||||
|
image: deblan/mage
|
||||||
|
secrets: [ssh_user, ssh_host, ssh_priv_key, app_directory]
|
||||||
|
volumes: *volumes
|
||||||
|
commands:
|
||||||
|
- cd "/builds/$CI_COMMIT_SHA"
|
||||||
|
- mkdir "$HOME/.ssh"
|
||||||
|
- echo "$SSH_PRIV_KEY" > "$HOME/.ssh/id_ed25519"
|
||||||
|
- chmod 700 "$HOME/.ssh"
|
||||||
|
- chmod 600 "$HOME/.ssh/id_ed25519"
|
||||||
|
- cp .mage.yml.dist .mage.yml
|
||||||
|
- sed -i "s/ssh_user/$SSH_USER/g" .mage.yml
|
||||||
|
- sed -i "s/ssh_host/$SSH_HOST/g" .mage.yml
|
||||||
|
- sed -i "s#app_directory#$APP_DIRECTORY#g" .mage.yml
|
||||||
|
- mage deploy "$CI_PIPELINE_DEPLOY_TARGET"
|
Loading…
Reference in a new issue