arriven / db1000n

MIT License
1.17k stars 201 forks source link

Terraform Docker Container Update #504

Closed slavarazum closed 1 month ago

slavarazum commented 2 years ago

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

arriven commented 2 years ago

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

slavarazum commented 2 years ago

@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?

arriven commented 2 years ago

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 commented 2 years ago

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

slavarazum commented 2 years ago

@Arriven So, Vultr containers has autoupdate, great!

How can I check current db1000n version on VPS?

arriven commented 2 years ago

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

Amet13 commented 2 years ago

@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
slavarazum commented 2 years ago

@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 👍

Amet13 commented 2 years ago

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