Install/Update Sera #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Install/Update Sera | |
on: | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: prod | |
timeout-minutes: 20 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
ref: prod | |
fetch-depth: 0 | |
- name: Set env vars | |
run: | | |
echo "${{ secrets.PROD_ENV_FILE }}" >> .env | |
- name: Pull new images | |
run: | | |
docker-compose -f ./prod.docker-compose.yml -p "prod-sera" pull | |
- name: Update the prod | |
run: | | |
docker-compose -f ./prod.docker-compose.yml -p "prod-sera" up -d | |
- name: Remove unused images | |
run: | | |
docker image prune -f | |
- name: Writes the .env file | |
run: | | |
docker exec sera-server sh -c 'echo "${{ secrets.PROD_ENV_FILE }}" > .env' | |
- name: Wait for the database to be ready | |
run: | | |
sleep 5 | |
docker exec -u root sera-server apt-get update | |
docker exec -u root sera-server apt-get install -y netcat-openbsd | |
docker exec sera-server sh -c 'until nc -z -v -w30 sera-mariadb 3306; do echo "Waiting for database connection..."; sleep 5; done' | |
docker exec sera-server sh -c 'until nc -z -v -w30 sera-minio 9000; do echo "Waiting for database connection..."; sleep 5; done' | |
- name: Execute laravel configs | |
run: | | |
docker exec sera-server php artisan cache:clear | |
docker exec sera-server php artisan route:clear | |
docker exec sera-server php artisan key:generate | |
docker exec sera-server php artisan config:cache | |
docker exec sera-server php artisan route:cache | |
docker exec sera-server php artisan view:cache | |
docker exec sera-server php artisan optimize | |
docker exec sera-server php artisan storage:link | |
docker exec sera-server chown -R www-data:www-data /root | |
docker exec sera-server php artisan config:cache | |
docker exec sera-server php artisan config:clear | |
docker exec sera-server /root/minio-binaries/mc alias set myminio http://minio:9000 s3SeraUser SsmHJPoqd | |
docker exec sera-server /root/minio-binaries/mc mb --with-versioning --ignore-existing myminio/sera | |
docker exec sera-server php artisan migrate --force | |
docker exec sera-server php artisan db:seed --class=UserProdSeeder --force |