Logic on properly deploying things

So I've been getting into a more professional workflow (id say) with better github practices, working with containers and orchestrators and such But now that I don't "manually" deploy my programs onto a server anymore, I got a question about my config files For example if I make a discord bot I wouldn't hardcode the details but rather make the bot create a folder for itself for things like the database it needs to run or the config for me to put the bot token into How would I go on about giving the token to the bot for example, do I just ship the config file and folder with the image or is there some other workflow
13 Replies
Angius
Angius13mo ago
You would use a secret store Like Azure Key Vault, for example
The Fog from Human Resources
But wouldn't that need some authentication too which would mean I'd need to somehow supply my program with the keystore?
Angius
Angius13mo ago
You can store that in the secrets in the GH repo, and use that to set the env variable or something inside of your GH action I guess you could directly just do that with the Discord token or whatever, but using something like KeyVault lets you change the secrets without the need for a redeploy
The Fog from Human Resources
I mean I don't really mind the redeploy tbh
Angius
Angius13mo ago
Skip KV, then
The Fog from Human Resources
Can you go more into detail about storing them inside of the repo?
Angius
Angius13mo ago
No description
The Fog from Human Resources
Perfect I'll have a look, thanks!
Angius
Angius13mo ago
Here's how I deploy one of my Nuget packages, for example
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: dotnet build --configuration Release
- name: Pack
run: dotnet pack --configuration Release --no-build --output ./artifacts NpgSqlSourceGenerator/NpgSqlSourceGenerator.csproj
- name: Push
run: dotnet nuget push ./artifacts/Atulin.NpgSqlSourceGenerator.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }}
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build
run: dotnet build --configuration Release
- name: Pack
run: dotnet pack --configuration Release --no-build --output ./artifacts NpgSqlSourceGenerator/NpgSqlSourceGenerator.csproj
- name: Push
run: dotnet nuget push ./artifacts/Atulin.NpgSqlSourceGenerator.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_KEY }}
No description
Angius
Angius13mo ago
${{ secrets.NUGET_KEY }} references that secret
The Fog from Human Resources
How would I be able to access those secrets using my program once deployed?
Angius
Angius13mo ago
You would set them on the server during deployment Either by creating a file with env variables, editing the project settings, or just setting an env variable on the server

Did you find this page helpful?