Properties | ||
.gitignore | ||
appsettings.Development.json | ||
appsettings.json | ||
DnsRecords.cs | ||
docker-compose.yml | ||
IpRenewal.csproj | ||
Program.cs | ||
README.md | ||
Worker.cs |
ENV vars
Development
Preparation
During Development make sure to use the DotNet Secret Manager for sensitive data like your api key and secret.
For this Project dotnet user-secrets init
is not necessary anymore. It is worth noting though that Secrets are only loaded into IConfiguration
when the DOTNET_ENVIRONMENT
environment variable is set to Development
.
So make sure you have export DOTNET_ENVIRONMENT="Development"
somewhere in your system configuration.
If your system is not Development
and you don't have RAMBOE_IP_RENEWAL_...
explicitely set in your ENV, then IConfiguration can't read them and will return null
for those values.
Setting your secrets
You can adjust the secretsExample.json
:
{
"RAMBOE_IP_RENEWAL_SUBDOMAINS": "backend,frontend,@",
"RAMBOE_IP_RENEWAL_GODADDY_SECRET": "<your-godaddy-api-secret>",
"RAMBOE_IP_RENEWAL_GODADDY_KEY": "<your-godaddy-key>",
"RAMBOE_IP_RENEWAL_DOMAIN": "my.domain"
}
and then add it to your local secret store via
cat ./secretsExample.json | dotnet user-secrets set
Make sure to not commit
secretsExample.json
publish to docker hub
After logging in with docker login -u <your-user-name>
, one can publish the latest version of the container via
dotnet publish --os linux --arch x64 /t:PublishContainer -c Release
given permissions are set accordinglingly.
Production
When in Production, make sure to have a .env
file next to your docker-compose.yml
:
RAMBOE_IP_RENEWAL_GODADDY_KEY=<your-godaddy-key>
RAMBOE_IP_RENEWAL_GODADDY_SECRET=<your-godaddy-secret>
RAMBOE_IP_RENEWAL_DOMAIN=my.domain
RAMBOE_IP_RENEWAL_SUBDOMAINS=backend,frontend,@
RAMBOE_IP_RENEWAL_INTERVAL_MINUTES=15
RAMBOE_IP_RENEWAL_IP_PROVIDER_URL=https://api.ipify.org
Your docker-compose
then should look like this:
worker-iprenewal:
image: ramboe/ip-renewal-godaddy:latest
container_name: iprenewal
restart: always
env_file: .env
environment:
- RAMBOE_IP_RENEWAL_GODADDY_KEY=${RAMBOE_IP_RENEWAL_GODADDY_KEY}
- RAMBOE_IP_RENEWAL_GODADDY_SECRET=${RAMBOE_IP_RENEWAL_GODADDY_SECRET}
- RAMBOE_IP_RENEWAL_IP_PROVIDER_URL=https://api.ipify.org
- RAMBOE_IP_RENEWAL_DOMAIN=${RAMBOE_IP_RENEWAL_DOMAIN}
- RAMBOE_IP_RENEWAL_SUBDOMAINS=${RAMBOE_IP_RENEWAL_SUBDOMAINS}
- RAMBOE_IP_RENEWAL_INTERVAL_MINUTES=20