db1000n icon indicating copy to clipboard operation
db1000n copied to clipboard

Terraform Docker Container Update

Open slavarazum opened this issue 2 years ago • 9 comments

Is there any instructions how to update and manipulate db1000n installed by terraform to VPS server like DigitalOcean?

slavarazum avatar Apr 13 '22 09:04 slavarazum

that depends on your usage but the most common way would depend on whether terraform definitions use latest image or pin it to some specific version

if it uses latest image you can just call terraform destroy and then terraform apply to tear down the cluster and redeploy it with the latest version. that is highly ineffective but will work for any terraform configuration

if it has pinned images you can just modify terraform files to use latest version and call terraform apply so that it would update just the parts that are required

that being said, it would be a lot more effective to use something native to the VPS to force it to always pull new images on container restart (kubernetes definitely has a way to do that, not sure about other systems) but I'd need more details on your configuration to be able to provide more info

arriven avatar Apr 14 '22 12:04 arriven

@Arriven No specific configurations, just deployed 2 VPS in DigitalOcean and Vultr by terraform with these instructions:

https://arriven.github.io/db1000n/advanced-docs/terraform/digital-ocean/

https://arriven.github.io/db1000n/advanced-docs/terraform/vultr/

I want to keep it always up to date. How can we do that?

slavarazum avatar Apr 14 '22 13:04 slavarazum

so Vultr deployment script already does restart the container regularly and pulls latest image. digital ocean example uses their app platform and I can't seem to find any autoupdate features there (except the one that requires access to the code repo) but the app platform should be relatively quick to tear down and bring back up so you can just do that terraform destroy; terraform apply cycle once in a while if you see that a new release is available

arriven avatar Apr 14 '22 14:04 arriven

@Amet13 if I recall correctly you are the author of DO terraform, are you aware of any better way to update the app there?

arriven avatar Apr 14 '22 14:04 arriven

@Arriven So, Vultr containers has autoupdate, great!

How can I check current db1000n version on VPS?

slavarazum avatar Apr 14 '22 15:04 slavarazum

for vultr something like ssh root@ip docker container ls should give you info about the container which should include image version. If it doesn't have that info you can also grep docker logs for something like DB1000n [Version

I haven't used digital ocean myself so not sure what would be the easiest way to check it there but it should be possible to access cloud console from their personal cabinet and find some logs there

arriven avatar Apr 14 '22 15:04 arriven

@Amet13 if I recall correctly you are the author of DO terraform, are you aware of any better way to update the app there?

For Digital Ocean it takes the latest code from master branch and deploys it. If you wan to deploy new version, just redeploy it:

terraform destroy
terraform apply

Amet13 avatar Apr 14 '22 16:04 Amet13

@Amet13 Just made redeploy on DO, result:

2022/04/14 17:19:06.816548 main.go:51: DB1000n [Version: v0.0.1][PID=42]

On Vultr autoupdates works fine 👍

slavarazum avatar Apr 14 '22 17:04 slavarazum

It's still the latest version, as DO automatically builds a binary and not getting it from github, that's why it shows you v0.0.1

Amet13 avatar Apr 14 '22 17:04 Amet13