Skip to content

Commit

Permalink
add DOCKER_IMAGE_NAME to setup to allow for renaming the image
Browse files Browse the repository at this point in the history
add docs for security setting for actions to allow build and push to repo for gh-pages release.
  • Loading branch information
guFalcon committed Apr 9, 2024
1 parent 81441ce commit 3c61dd2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/docs-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
file: ./Dockerfile
platforms: linux/amd64,linux/arm64/v8
push: true
tags: ${{ secrets.DOCKER_HUB_USER }}/safe-learn:latest
tags: ${{ secrets.DOCKER_HUB_USER }}/${{ secrets.DOCKER_IMAGE_NAME}}:latest
deploy:
name: Deployment 💻
runs-on: ubuntu-latest
Expand Down Expand Up @@ -139,6 +139,7 @@ jobs:
echo WEBSERVER_PORT=${{ secrets.WEBSERVER_PORT }} >> ./deploy/.env
echo INTERNAL_PORT=${{ secrets.PORT }} >> ./deploy/.env
echo DOCKER_HUB_USER=${{ secrets.DOCKER_HUB_USER }} >> ./deploy/.env
echo DOCKER_IMAGE_NAME=${{ secrets.DOCKER_IMAGE_NAME }} >> ./deploy/.env
- name: Deploy using SSH 🚛
uses: UnterrainerInformatik/ssh-deploy-action@v1
with:
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ To build, there is a Github action in this repository, but in order to configure
| DEPLOY_SSH_USER | The user for SSH authentication (local user). |
| DOCKER_HUB_PASSWORD | An access-token of your docker-hub account. |
| DOCKER_HUB_USER | The user of your docker-hub account. |
| DOCKER_IMAGE_NAME | The image name that should be built and deployed (example: `safe-learn` with DOCKER_HUB_USER `gufalcon` would result in pulling the image `gufalcon/safe-learn:latest`) |
| KEYCLOAK_FILE | The copy-pasted contents of the file you get when you enter your Keycloak-realm as admin -> Client -> Installation -> Keycloak JSON File. |
| PORT | -> `.env`<br>The port your web-server will be accessible when started later on (for example: `8080`).<br>This variable will be written to a newly generated `.env` file that will reside in the root-directory of the node web-server.<br>So that port is INSIDE this web-servers' docker-image that is created. |
| WEBSERVER_PORT | This is the EXTERNAL port of the web-server that is created.<br>This port must be unique and accessible on the deployment-machine. |
Expand All @@ -270,6 +271,12 @@ Upon entering any page you'll be prompted to login at the given Keycloak server

If your repository is private, which makes sense, Github will force you to either pay for Github Enterprise, or to have your own, self-hosted Github Runner. Because this repository however is public, the build-action-script refers to the runner as `runs-on: ubuntu-latest`. So in order to use your private self-hosted-runners you'll have to label them `ubuntu-latest` so Github will take care of that. Your runners will have slightly higher priority than the public ones.

### Github Actions Settings
You'll have to enable write-access for actions by enabling these options:
![[Pasted image 20240409164504.png]]
`Project-Settings -> Actions -> General -> Workflow permissions -> Read and write permissions AND Allow GitHub Actions to create and approve pull requests`.


## Debugging
To test the portions of the web-site that isn't directly connected to the gh-pages generation and Asciidoc conversion, you may want to start it using VSCode.
Just do the following:
Expand Down
3 changes: 1 addition & 2 deletions deploy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ version: '3'
services:

test:
image: ${DOCKER_HUB_USER}/safe-learn:latest
container_name: safe-learn
image: ${DOCKER_HUB_USER}/${DOCKER_IMAGE_NAME}:latest
restart: unless-stopped
ports:
- "${WEBSERVER_PORT}:${INTERNAL_PORT}"
Expand Down
Binary file added md/assets/Pasted image 20240409164504.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3c61dd2

Please sign in to comment.