1- # Name of your application. Used to uniquely configure containers.
2- service : techstacks-io
1+ # Kamal deploy config for this repository. Uses environment variables:
2+ # - GITHUB_REPOSITORY (e.g. acme/example.org) - included in GitHub Actions
3+ # - GITHUB_ACTOR (e.g. acme) - included in GitHub Actions
4+ # - GITHUB_TOKEN ($GITHUB_TOKEN) - included in GitHub Actions
5+ # - KAMAL_DEPLOY_IP (e.g. 100.100.100.100) - from GitHub Action Secret
6+ # - KAMAL_DEPLOY_HOST (e.g. example.org) - from GitHub Action Secret
7+ # - POSTGRES_PASSWORD (e.g. random-password) - from GitHub Action Secret
38
4- # Name of the container image.
5- image : ghcr.io/netcoreapps/techstacks.io
9+ # Using Environment variables allows re-use of this config for multiple apps.
10+ # Alternatively, they can be replaced with hard-coded values for
11+
12+ # Name of your application. Used to uniquely configure containers. (e.g. example-org)
13+ service : <%= ENV['GITHUB_REPOSITORY'].to_s.split('/').last.tr('.', '-') %>
14+
15+ # Name of the container image. (e.g. ghcr.io/acne/example.org)
16+ image : ghcr.io/<%= ENV['GITHUB_REPOSITORY'].to_s.downcase %>
617
718# Required for use of ASP.NET Core with Kamal-Proxy.
819env :
920 clear :
1021 ASPNETCORE_FORWARDEDHEADERS_ENABLED : true
22+ # secrets from ./kamal/secrets
1123 secret :
1224 - SERVICESTACK_LICENSE
1325
1426# Deploy to these servers.
1527servers :
16- # IP address of server, optionally use env variable.
28+ # IP address of server to deploy to. (e.g. 100.100.100.100)
1729 web :
18- - 192.168.0.1
19- # - <%= ENV['KAMAL_DEPLOY_IP'] %>
20- - network : techstacks-io-network
30+ hosts :
31+ - <%= ENV['KAMAL_DEPLOY_IP'] %>
2132
2233# Enable SSL auto certification via Let's Encrypt (and allow for multiple apps on one server).
2334# If using something like Cloudflare, it is recommended to set encryption mode
2435# in Cloudflare's SSL/TLS setting to "Full" to enable end-to-end encryption.
2536proxy :
2637 ssl : true
27- host : techstacks.io
38+ # Hostname to proxy. (e.g. example.org)
39+ host : <%= ENV['KAMAL_DEPLOY_HOST'] %>
2840 # kamal-proxy connects to your container over port 80, use `app_port` to specify a different port.
2941 app_port : 8080
3042
@@ -33,32 +45,35 @@ registry:
3345 # Specify the registry server, if you're not using Docker Hub
3446 server : ghcr.io
3547 username :
36- - KAMAL_REGISTRY_USERNAME
48+ - <%= ENV['GITHUB_ACTOR'] %>
3749
3850 # Always use an access token rather than real password (pulled from .kamal/secrets).
3951 password :
40- - KAMAL_REGISTRY_PASSWORD
52+ - <%= ENV['GITHUB_TOKEN'] %>
4153
4254# Configure builder setup.
4355builder :
4456 arch : amd64
4557
4658volumes :
47- - " /opt/docker/techstacks.io /App_Data:/app/App_Data"
59+ - " /opt/docker/<%= ENV['KAMAL_DEPLOY_HOST'] % > /App_Data:/app/App_Data"
4860
4961accessories :
5062 postgres :
5163 image : postgres
52- host : 192.168.0.1
53- network : techstacks-io-network
64+ # IP address of server to deploy accessory to. (e.g. 100.100.100.100)
65+ host : <%= ENV['KAMAL_DEPLOY_IP'] %>
66+ port : " 5433:5432"
5467 env :
5568 clear :
56- POSTGRES_USER : techstacks
57- POSTGRES_DB : techstacks
69+ # Database username and database name (e.g. example/example)
70+ POSTGRES_USER : <%= ENV['GITHUB_REPOSITORY'].to_s.split('/').last.tr('.', '-').split('-').first %>
71+ POSTGRES_DB : <%= ENV['GITHUB_REPOSITORY'].to_s.split('/').last.tr('.', '-').split('-').first %>
5872 # Optional: only listens inside container
5973 PGDATA : /var/lib/postgresql/data
74+ # secrets from ./kamal/secrets
6075 secret :
6176 - POSTGRES_PASSWORD
6277 directories :
63- - /opt/docker/techstacks.io /postgres:/var/lib/postgresql/data
64- - /opt/docker/techstacks.io /initdb.d:/docker-entrypoint-initdb.d
78+ - /opt/docker/<%= ENV['KAMAL_DEPLOY_HOST'] %> /postgres:/var/lib/postgresql/data
79+ - /opt/docker/<%= ENV['KAMAL_DEPLOY_HOST'] %> /initdb.d:/docker-entrypoint-initdb.d
0 commit comments