If your project is on GitHub, GitHub Actions are a great built in way to have an automated Continuous Integration (CI) setup where the configuration is committed to the same repository where your project lives.
GitHub Actions are also very cost effective thanks to the generous free minutes allowance and additional 3000 /month minutes with every paid team member.
To make taking advantage of GitHub Actions with your ServiceStack applications, we've created multiple mix templates to setup your CI process quickly. Most Project Templates provide a build + test step on every commit as well as combinations of Docker image hosting and application deployments focusing on portability.
Since hosting architectures vary so much, these templates are designed to get you started with a simple setup where you can iterate quickly as you develop application. As hosting requirements change, the deployment GitHub Action workflow yml
files can be customized to suit.
The simple build and test step is available using the build, mix template, whilst the mix deployment templates uses the naming convention release-{docker image repository}-{hosting configuration}
.
For example, release-ghr-vanilla
where ghr uses GitHub for the Docker Repository and vanilla
for our minimalist deployment that uses SSH and docker compose.
GitHub Action Templates​
Templates currently available are:
Name | Docker Repository | Deployment and Hosting |
---|---|---|
release-ghr-vanilla | GitHub Container Repository | SSH + docker compose |
release-ecr-vanilla | AWS Elastic Container Repository | SSH + docker compose |
release-hub-vanilla | Docker Hub | SSH + docker compose |
release-ecr-aws | AWS Elastic Container Repository | AWS ECS without Load Balancer |
release-ghr-vanilla​
Using GitHub Container Repository (ghcr.io) and deploying to a Linux host with docker compose
via SSH, this provides a GitHub centric option for prototyping your application. A full tutorial using Digital Ocean as our Linux host provider is available as well as an accompanying video.
Also, a shorter reference documentation that comes with the template when using mix
available that lists the setup as well as the required GitHub Repository Secrets for configuration.
release-ecr-vanilla​
Using AWS ECR (Elastic Container Repository) and deploying to a Linux host with docker compose
via SSH, this provides a portable simple hosting with AWS ECR for those already in the AWS cloud provider environment.
Reference for this GitHub Action configuration is provided with the template itself, also available here along with the required Repository Secrets.
release-hub-vanilla​
Using the original Docker Hub as a Docker image repository and deploying to a Linux host with docker compose
via SSH, this might be more suited to those with existing use of Docker Hub or public application images.
Reference for this GitHub Action configuration is provided with the template itself, also available on GitHub here along with the required Repository Secrets.
release-ecr-aws​
Using AWS ECR (Elastic Container Repository) and deploying via AWS ECS to a dedicated ECS cluster with a single EC2 instance, this template enables a gateway into using AWS ECS without the regular cost of an Application Load Balancer (ALB). Like the other templates, this uses NGINX proxy with Lets Encrypt companion in place of AWS specific managed services to do the same. This will give you a starting point for your prototype until you have the need for scalability and high availability for your application.
We have a full tutorial along with a video walk through available, showing from start to finish getting your ServiceStack application created and deploying via GitHub Actions and ECS.
Reference for this GitHub Action configuration is provided with the template itself, also available on GitHub here along with the required Repository Secrets.
Blazor Litestream​
For a detailed overview for creating and setting up deployment for a new Blazor Litestream App from scratch checkout:
INFO
If you are using the template GitHub Actions and deploying to an Ubuntu 22.04 server, ensure you ssh key is generated using non RSA SHA1 algorithm.
Eg ssh-keygen -t ecdsa
or swap out the use of appleboy/scp-action@v0.1.3
for your own step using the latest version of the scp
command line tool in your CI environment.
For a step by step and other options, see this Ask Ubuntu Answer