Signed-off-by: Max Schmidt <max.schmidt@outlook.de>
This commit is contained in:
Max Schmidt 2023-05-17 17:03:20 +02:00
parent ec0e7601c4
commit 21fe6de0ec
4 changed files with 13 additions and 14 deletions

View File

View File

@ -22,14 +22,14 @@ jobs:
mkdir ${{ secrets.PATH }} mkdir ${{ secrets.PATH }}
cd ${{ secrets.PATH }} cd ${{ secrets.PATH }}
git clone -b prod https://github.com/${{ github.repository }} . git clone -b prod https://github.com/${{ github.repository }} .
mv .env.dev .env.prod cp .env ./astro/.env
sed -i "s/ASTRO_URL=.*/ASTRO_URL=${{ vars.ASTRO_URL }}/" .env.prod sed -i "s/ASTRO_URL=.*/ASTRO_URL=${{ vars.ASTRO_URL }}/" .env
sed -i "s/PAYLOAD_URL=.*/PAYLOAD_URL=${{ vars.PAYLOAD_URL }}/" .env.prod sed -i "s/PAYLOAD_URL=.*/PAYLOAD_URL=${{ vars.PAYLOAD_URL }}/" .env
sed -i "s/PAYLOAD_PORT=.*/PAYLOAD_PORT=${{ secrets.PAYLOAD_PORT }}/" .env.prod sed -i "s/PAYLOAD_PORT=.*/PAYLOAD_PORT=${{ secrets.PAYLOAD_PORT }}/" .env
sed -i "s/PAYLOAD_SECRET=.*/PAYLOAD_SECRET=${{ secrets.PAYLOAD_SECRET }}/" .env.prod sed -i "s/PAYLOAD_SECRET=.*/PAYLOAD_SECRET=${{ secrets.PAYLOAD_SECRET }}/" .env
sed -i "s/MONGODB_URI=.*/MONGODB_URI=${{ secrets.MONGODB_URI }}/" .env.prod sed -i "s/MONGODB_URI=.*/MONGODB_URI=${{ secrets.MONGODB_URI }}/" .env
sed -i "s/MONGODB_USER=.*/MONGODB_USER=${{ secrets.MONGODB_USER }}/" .env.prod sed -i "s/MONGODB_USER=.*/MONGODB_USER=${{ secrets.MONGODB_USER }}/" .env
sed -i "s/MONGODB_PW=.*/MONGODB_PW=${{ secrets.MONGODB_PW }}/" .env.prod sed -i "s/MONGODB_PW=.*/MONGODB_PW=${{ secrets.MONGODB_PW }}/" .env
sed -i "s/NAME=.*/NAME=${{ vars.NAME }}/" .env.prod sed -i "s/NAME=.*/NAME=${{ vars.NAME }}/" .env
fi fi
yarn prod yarn prod

View File

@ -25,4 +25,4 @@ Because Astro is completely static, a content change in the CMS must trigger a n
Ensure you have Traefik set up as a reverse proxy before deployment. The prod script will launch your site in a production-ready environment. Ensure you have Traefik set up as a reverse proxy before deployment. The prod script will launch your site in a production-ready environment.
Please note that since deployment is done through Github Workflows, you need to define the necessary secrets and envs in the settings. You can find which secrets and envs are used in the `.github/workflows/push.yml` file. This file converts the existing `.env.dev` to `.env.prod` and adds the secrets and envs that have already been defined. Please note that since deployment is done through Github Workflows, you need to define the necessary secrets and envs in the settings. You can find which secrets and envs are used in the `.github/workflows/push.yml` file. This file adds the secrets and envs to the `.env` that have already been defined.

View File

@ -2,9 +2,8 @@
"name": "astrotus", "name": "astrotus",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"dev": "docker compose -f docker-compose.yml -f docker-compose-dev.yml --env-file .env.dev up -d", "dev": "docker compose -f docker-compose.yml -f docker-compose-dev.yml up -d",
"prod": "docker compose -f docker-compose.yml -f docker-compose-prod.yml --env-file .env.prod up -d --build", "prod": "docker compose -f docker-compose.yml -f docker-compose-prod.yml up -d --build",
"stop": "docker compose -f docker-compose.yml -f docker-compose-dev.yml --env-file .env.dev down && docker compose -f docker-compose.yml -f docker-compose-prod.yml --env-file .env.prod down", "stop": "docker compose -f docker-compose.yml -f docker-compose-dev.yml down && docker compose -f docker-compose.yml -f docker-compose-prod.yml down"
"dump": "docker exec -i astrotus_database /bin/sh -c 'PGPASSWORD=password pg_dump --username directus directus' > ./dump.sql"
} }
} }