-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/NetCoreTemplates/razor-pages …
…into main
- Loading branch information
Showing
2 changed files
with
8 additions
and
14 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,21 +29,17 @@ docker-compose -f ~/nginx-proxy-compose.yml up -d | |
This will run an nginx reverse proxy along with a companion container that will watch for additional containers in the same docker network and attempt to initialize them with valid TLS certificates. | ||
|
||
## GitHub Repository setup | ||
The `release.yml` assumes 6 secrets have been setup. | ||
The `release.yml` uses the following secrets. | ||
|
||
- CR_PAT - GitHub Personal Token with read/write access to packages. | ||
- DEPLOY_HOST - hostname used to SSH to, this can either be an IP address or subdomain with A record pointing to the server. | ||
- DEPLOY_PORT - SSH port, usually `22`. | ||
- DEPLOY_USERNAME - the username being logged into via SSH. Eg, `ubuntu`, `ec2-user`, `root` etc. | ||
- DEPLOY_KEY - SSH private key used to remotely access deploy server/app host. | ||
- LETSENCRYPT_EMAIL - Email address, required for Let's Encrypt automated TLS certificates. | ||
|
||
These secrets can use the [GitHub CLI](https://cli.github.com/manual/gh_secret_set) for ease of creation. Eg, using the GitHub CLI the following can be set. | ||
|
||
```bash | ||
gh secret set CR_PAT -b"<CR_PAT, Container Registry Personal Access Token>" | ||
gh secret set DEPLOY_HOST -b"<DEPLOY_HOST, domain or subdomain for your application and server host.>" | ||
gh secret set DEPLOY_PORT -b"<DEPLOY_PORT, eg SSH port, usually 22>" | ||
gh secret set DEPLOY_USERNAME -b"<DEPLOY_USERNAME, the username being logged into via SSH. Eg, `ubuntu`, `ec2-user`, `root` etc.>" | ||
gh secret set DEPLOY_KEY -b"<DEPLOY_KEY, SSH private key used to remotely access deploy server/app host.>" | ||
gh secret set LETSENCRYPT_EMAIL -b"<LETSENCRYPT_EMAIL, Email address for your TLS certificate generation, eg [email protected]>" | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
name: Release | ||
permissions: | ||
packages: write | ||
contents: write | ||
on: | ||
# Triggered on new GitHub Release | ||
release: | ||
|
@@ -60,8 +63,8 @@ jobs: | |
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.CR_PAT }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Build and push new docker image, skip for manual redeploy other than 'latest' | ||
- name: Build and push Docker images | ||
|
@@ -125,17 +128,12 @@ jobs: | |
source: ".deploy/${{ github.event.repository.name }}-docker-compose.yml" | ||
target: "~/" | ||
|
||
- name: Set the value | ||
run: | | ||
echo "GH_TOKEN=${{ secrets.CR_PAT }}" >> $GITHUB_ENV | ||
echo "USERNAME=${{ secrets.DEPLOY_USERNAME }}" >> $GITHUB_ENV | ||
# Deploy Docker image with ServiceStack application using `docker compose up` remotely | ||
- name: remote docker-compose up via ssh | ||
uses: appleboy/[email protected] | ||
env: | ||
APPTOKEN: ${{ env.GH_TOKEN }} | ||
USERNAME: ${{ env.USERNAME }} | ||
APPTOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
USERNAME: ${{ secrets.DEPLOY_USERNAME }} | ||
with: | ||
host: ${{ secrets.DEPLOY_HOST }} | ||
username: ${{ secrets.DEPLOY_USERNAME }} | ||
|