Skip to content

Commit

Permalink
cleanup scripts, documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mosbuma committed Dec 14, 2023
1 parent 22d1d78 commit f85e2b3
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 7 deletions.
15 changes: 15 additions & 0 deletions azure/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# this folder contains scripts related to azure devops

## preparations
- install the azure cli tool

## usage
- first create a .env file by copying .env.example and filling in the values
- next use az-login.sh to login to use the az cli

* az-app-info.sh -> show info about the azure webapp
* az-app-download-logs -> get application logs (useful if the app refuses to start up)
* az-app-restart -> guess what this does :-)

# setup web app for next js startup
* az-app-set-config -> setup web app for next js startup (node server.js)
4 changes: 4 additions & 0 deletions azure/az-app-useful.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
set -o allexport; source .env; set +o allexport

# az webapp log tail --name $AZURE_WEBAPP_NAME --resource-group $AZURE_RESOURCE_GROUP
az webapp ssh --name $AZURE_WEBAPP_NAME --resource-group $AZURE_RESOURCE_GROUP
28 changes: 28 additions & 0 deletions github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# this folder contains scripts related to setting up github actions for CI/CD

# preparations

- in the github folder, copy variables.env.example to variables.env and fill in the missing values
- get the publishsettings for the webapp (from azure) and save them as production.PublishSettings in the github folder (see example.PublishSettings)

- use the install-gh.sh script to install the github commandline tool

# adding secrets to the repository and enabling actions

- from the root folder run

```
bash github/setup-actions.sh
```

now check the variables in the script output

#changing the database url separately

```
gh variable set DATABASE_URL --body "connection string"
cd azure
bash az-login.sh
bash az-app-restart.sh
```
1 change: 0 additions & 1 deletion github/secrets.env.example

This file was deleted.

1 change: 0 additions & 1 deletion github/secrets.prod.env

This file was deleted.

8 changes: 3 additions & 5 deletions github/setup-actions.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
REPOSITORY=mosbuma/fietsberaad-veiligstallen-app
# gh api --method PUT -H "Accept: application/vnd.github+json" repos/$REPOSITORY/environments/$ENVIRONMENT

#publish or update the workflow variables
gh variable set -f ./github/variables.env

#publish or update secret azure publish profile (set separately because it is a multiline value)
gh variable set AZUREAPPSERVICE_PUBLISHPROFILE_VEILIGSTALLEN < ./github/vstfb-eu-acc-app01.PublishSettings

#publish or update remainder of the secrets are set in a single file
# gh secret set -a actions AZUREAPPSERVICE_PUBLISHPROFILE_VEILIGSTALLEN -f ./github/secrets.env
gh variable set AZUREAPPSERVICE_PUBLISHPROFILE_VEILIGSTALLEN < ./github/production.PublishSettings

#enable the ci/cd action
gh workflow enable azure-webapps-node.yml

gh variable list
2 changes: 2 additions & 0 deletions github/variables.env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
AZURE_APP_NAME=
NEXTAUTH_SECRET=
NEXTAUTH_URL=/login
NEXT_PUBLIC_MAPBOX_TOKEN=
DATABASE_URL=
NEXT_PUBLIC_API_BASE_URL=/
NEXT_PUBLIC_WEB_BASE_URL=/

0 comments on commit f85e2b3

Please sign in to comment.