-
Notifications
You must be signed in to change notification settings - Fork 49
Full docker support (reorganized) #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
da2ce7
merged 12 commits into
torrust:develop
from
josecelano-test:docker-reorganized-pr
Dec 22, 2022
Merged
Full docker support (reorganized) #129
da2ce7
merged 12 commits into
torrust:develop
from
josecelano-test:docker-reorganized-pr
Dec 22, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
New config options have been added to support HTTPs conenctionto the API: ``` [http_api] ssl_enabled = false ssl_cert_path = "./storage/ssl_certificates/localhost.crt" ssl_key_path = "./storage/ssl_certificates/localhost.key" ```
Instead of using a "debug" log level.
Using "debug" for sensitive data like IP address and info for generic info we can log even on production.
Azure Container Instances do not allow you to open the same port as UDP and TCP.
Azure Container Intances do not allow you to mount a single file. I've created a storage folder where we can put all the things we want to persist.
The option "strip = true" in the Cargo.toml file prevetns docker to use the cache for the cargo dependencies. ``` [profile.release] ... strip = true ``` More info: LukeMathWalker/cargo-chef#172
You can use an env var to pass the configuration instead of using the configuration file in the root folder `config.toml` ``` TORRUST_TRACKER_CONFIG=$(cat config.toml) TORRUST_TRACKER_CONFIG=`cat config.toml` cargo run ``` This allow the applciation to be executed in dockerized environments whithout needing to mount a file or volume for the configuration.
ACK 171a37d |
Closed
Closed
The published docker image runs by deafult as non root user. Some services like ACI could require run the container as root but for those cases they can run their customs builds or change the user while launching the container.
ACK 6851ec5 |
This was referenced Dec 21, 2022
Error starting Tracker "Errors while processing config: invalid type: map, expected a sequence."
#36
Closed
da2ce7
approved these changes
Dec 22, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 6851ec5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Stacked on/Depends on: #128
This is a reorganization of PR-123
config.toml
file or from an env varTORRUST_TRACKER_CONFIG
with the same content as theconfig.toml
file. I think it's the minimum change to deploy the application using docker easily.The idea is the same as the solution implemented by @Power2All here. But I'm using only one env var. This way, we do not need to change the code if the configuration changes. On the other hand, we are discussing a new implementation for the settings, and I did not want to implement things that will need to be changed afterwards. I'm also a fan of small steps :-).
Testing
I have deployed the application to the Digital Ocean App Platform:
https://lobster-app-dc6o9.ondigitalocean.app/api/stats?token=MyAccessToken
with this PR branch docker image.
If you want to test the feature of getting the configuration from an env var locally (without docker):
With docker, you only need to follow the instructions in the README:
Notes
Digital Ocean App Platform only allows you to expose one port (0.0.0.0:8080). I've deployed it exposing only the API with this configuration:
I suppose you need to create three apps sharing the state with a MySQL service if you want to deploy all the services. You want to do the same if you want to deploy more than one UDP or HTTP tracker.