Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions deployment/kamal.md
Original file line number Diff line number Diff line change
Expand Up @@ -474,3 +474,25 @@ ALLOWED_HOSTS = [

It is recommended to read [the security documentation](https://docs.djangoproject.com/en/5.0/topics/security/#host-headers-virtual-hosting)
for this feature to understand the implications of it being included.


### Deploy with GitHub Actions

Your repository also includes a GitHub Actions workflow that can be used to deploy your app to Kamal
(look for it in `.github/workflows/kamal_deploy.yml`). To configure the workflow you will set some secrets
in your repository settings.

In your repositories settings page, go to the "Secrets and variables -> Actions" section and add the following
secrets:

- `DOCKER_REGISTRY_USERNAME`
- Your Docker Hub username.
- `DOCKER_REGISTRY_KEY`
- The Docker Hub access token you created above.
- `SSH_KEY`
- A private key you use to SSH into your server. This must be a passwordless key.
- `SSH_KNOWN_HOSTS`
- The known hosts file for your server. You can generate this by running `ssh-keyscan <your-server-ip>`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What exactly do I use here? If I run that command I get something like this:

# www.translationcreator.com:22 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.10
www.translationcreator.com ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAA....
# www.translationcreator.com:22 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.10
www.translationcreator.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHA....
# www.translationcreator.com:22 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.10
# www.translationcreator.com:22 SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.10

Do I just paste that whole thing into the environment variable?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might also want a note here about it being tied to docker hub with a one-liner about how to chnage it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a note about this. Depending on the repo there may be different steps required. I could add a second file for AWS ECR which is a bit different.

With these secrets set, the GitHub Actions workflow will be able to deploy your app to Kamal. To test it
go to the "Actions" tab in your repository, click on the "Kamal Deploy" workflow, and then click "Run workflow".
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(It will also then run on every push to main, right?)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we also have to tell them to uncomment the workflow_run section of the deploy file, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it stands you can run it manually. For automated deploys you have to uncomment the lines in the workflow file as indicated by the comment in that file.