-
Notifications
You must be signed in to change notification settings - Fork 674
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
MF-1342 - Use environment variables in docker-compose to use tagged version of image #1343
Conversation
provision/README.md
Outdated
| MF_PROVISION_CERTS_CA_KEY | Mainflux CA cert private key | "" | | ||
| MF_PROVISION_CERTS_RSA_BITS | Certificate RSA bits parameter | 4096 | | ||
| MF_PROVISION_CERTS_HOURS_VALID | Number of days that certificate is valid | "2400h" | | ||
| MF_RELEASE_TAG | Docker image version to be deployed | latest | |
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.
The last one :)
users/README.md
Outdated
@@ -99,7 +100,12 @@ make users | |||
make install | |||
|
|||
# set the environment variables and run the service | |||
MF_USERS_LOG_LEVEL=[Users log level] MF_USERS_DB_HOST=[Database host address] MF_USERS_DB_PORT=[Database host port] MF_USERS_DB_USER=[Database user] MF_USERS_DB_PASS=[Database password] MF_USERS_DB=[Name of the database used by the service] MF_USERS_DB_SSL_MODE=[SSL mode to connect to the database with] MF_USERS_DB_SSL_CERT=[Path to the PEM encoded certificate file] MF_USERS_DB_SSL_KEY=[Path to the PEM encoded key file] MF_USERS_DB_SSL_ROOT_CERT=[Path to the PEM encoded root certificate file] MF_USERS_HTTP_PORT=[Service HTTP port] MF_USERS_SERVER_CERT=[Path to server certificate] MF_USERS_SERVER_KEY=[Path to server key] MF_JAEGER_URL=[Jaeger server URL] MF_EMAIL_DRIVER=[Mail server driver smtp] MF_EMAIL_HOST=[Mail server host] MF_EMAIL_PORT=[Mail server port] MF_EMAIL_USERNAME=[Mail server username] MF_EMAIL_PASSWORD=[Mail server password] MF_EMAIL_FROM_ADDRESS=[Email from address] MF_EMAIL_FROM_NAME=[Email from name] MF_EMAIL_TEMPLATE=[Email template file] MF_TOKEN_RESET_ENDPOINT=[Password reset token endpoint] $GOBIN/mainflux-users | |||
MF_USERS_LOG_LEVEL=[Users log level] MF_USERS_DB_HOST=[Database host address] MF_USERS_DB_PORT=[Database host port] MF_USERS_DB_USER=[Database user] MF_USERS_DB_PASS=[Database password] \ |
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.
Add a new line for each envar:
MF_USERS_LOG_LEVEL=[Users log level] \
MF_USERS_DB_HOST=[Database host address] \
MF_USERS_DB_PORT=[Database host port] \
MF_USERS_DB_USER=[Database user] \
MF_USERS_DB_PASS=[Database password]
auth/README.md
Outdated
@@ -56,6 +56,7 @@ default values. | |||
| MF_AUTH_SERVER_KEY | Path to server key in pem format | | | |||
| MF_AUTH_SECRET | String used for signing tokens | auth | | |||
| MF_JAEGER_URL | Jaeger server URL | localhost:6831| | |||
| MF_RELEASE_TAG | Docker image version to be deployed | latest | |
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.
space in last column
auth/README.md
Outdated
@@ -34,7 +34,7 @@ The following actions are supported: | |||
|
|||
## Configuration | |||
|
|||
The service is configured using the environment variables presented in the | |||
The service is configured using the envir onment variables presented in the |
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.
envir onment
users/README.md
Outdated
@@ -55,34 +55,34 @@ locally: | |||
version: "3.7" | |||
services: | |||
users: | |||
image: mainflux/users:[MF_RELEASE_TAG] | |||
image: mainflux/users:[\MF_RELEASE_TAG] |
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.
\MF_RELEASE_TAG
users/README.md
Outdated
\MF_USERS_LOG_LEVEL: [Users log level] | ||
\MF_USERS_DB_HOST: [Database host address] | ||
\MF_USERS_DB_PORT: [Database host port] | ||
\MF_USERS_DB_USER: [Database user] | ||
\MF_USERS_DB_PASS: [Database password] | ||
\MF_USERS_DB: [Name of the database used by the service] | ||
\MF_USERS_DB_SSL_MODE: [SSL mode to connect to the database with] | ||
\MF_USERS_DB_SSL_CERT: [Path to the PEM encoded certificate file] | ||
\MF_USERS_DB_SSL_KEY: [Path to the PEM encoded key file] | ||
\MF_USERS_DB_SSL_ROOT_CERT: [Path to the PEM encoded root certificate file] | ||
\MF_USERS_HTTP_PORT: [Service HTTP port] | ||
\MF_USERS_SERVER_CERT: [String path to server certificate in pem format] | ||
\MF_USERS_SERVER_KEY: [String path to server key in pem format] | ||
\MF_JAEGER_URL: [Jaeger server URL] | ||
\MF_EMAIL_DRIVER: [Mail server driver smtp] | ||
\MF_EMAIL_HOST: [\MF_EMAIL_HOST] | ||
\MF_EMAIL_PORT: [\MF_EMAIL_PORT] | ||
\MF_EMAIL_USERNAME: [\MF_EMAIL_USERNAME] | ||
\MF_EMAIL_PASSWORD: [\MF_EMAIL_PASSWORD] | ||
\MF_EMAIL_FROM_ADDRESS: [\MF_EMAIL_FROM_ADDRESS] | ||
\MF_EMAIL_FROM_NAME: [\MF_EMAIL_FROM_NAME] | ||
\MF_EMAIL_TEMPLATE: [\MF_EMAIL_TEMPLATE] | ||
\MF_TOKEN_RESET_ENDPOINT: [\MF_TOKEN_RESET_ENDPOINT] |
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.
Looka like a wrong find a replace. Remove these \
users/README.md
Outdated
``` | ||
|
||
If `MF_EMAIL_TEMPLATE` doesn't point to any file service will function but password reset functionality will not work. | ||
If `\MF_EMAIL_TEMPLATE` doesn't point to any file service will function but password reset functionality will not work. |
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.
same here
Codecov Report
@@ Coverage Diff @@
## master #1343 +/- ##
=======================================
Coverage 60.05% 60.05%
=======================================
Files 113 113
Lines 8904 8904
=======================================
Hits 5347 5347
Misses 3088 3088
Partials 469 469 Continue to review full report at Codecov.
|
docker/README.md
Outdated
@@ -21,3 +21,4 @@ docker-compose -f docker/docker-compose.yml up | |||
docker-compose -f docker/addons/<path>/docker-compose.yml up | |||
``` | |||
|
|||
To start specific release you need to change the value of `MF_RELEASE_TAG` in `.env` before running these commands. |
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.
I'd use To pull docker images from a specific release...
auth/README.md
Outdated
@@ -67,7 +68,7 @@ locally: | |||
version: "3.7" | |||
services: | |||
auth: | |||
image: mainflux/auth:[version] | |||
image: mainflux/auth:[MF_RELEASE_TAG] |
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.
I don't get this, why it's wrapped with those brackets [MF_RELEASE_TAG]
? I was expecting the same syntax as in Yaml ${MF_RELEASE_TAG}
or at least <MF_RELEASE_TAG>
a syntax used for variables in doc.
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.
or maybe [Docker image version tag specified by MF_RELEASE_TAG]
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.
I would go with ${MF_RELEASE_TAG}
because its env var and exact syntax. But yea, it's probably better because those brackets are everywhere.
a45de2e
to
5b5798c
Compare
MF_AUTH_SERVER_KEY: [String path to server key in pem format] | ||
MF_JAEGER_URL: [Jaeger server URL] | ||
``` | ||
The service itself is distributed as Docker container. Check the [`auth`](https://github.com/mainflux/mainflux/blob/master/docker/docker-compose.yml#L71-L94) service section in |
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.
I'm not sure about using section here. If we change the something in thee docker-compose this will be wrong.
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.
LGTM
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.
I am generally not convinced by this PR.
I do not like removing documentation about ENV vars from README files and adding just links to docker-compose. I know this would be easier to maintain, but on the other hand hinders readability and quick understanding of deployment.
I also do not support adding docker-compose tag as an ENV var, which can be misleading that it is a part of a service, somebody might even think of using it in the Kubernetes. It is not, it is used only in docker-compose, and docker-compose is used ONLY in development.
I do not really want to support people giving them the wrong idea that docker-compose can be used for running stable releases. If they want to do it, I would rather let them change version by hand. We keep latest
for a reason - to demotivate people using docker-compose for production, where Kubernetes should be used.
I don't agree with this.
I do agree with this. |
I dont think there is a place for confusion it just requires a basic knowledge of docker and kubernetes, it is clear that environment variables used for services are in the People with such unclear knowledge of docker deployment will more likely checkout release, start it and be surprised that something isn't working as expected (since the services being deployed are latest rather than tagged release version ) and then ask for support, open an issue... |
Latest stays on master, this is just for the people that are experimenting with releases, when they checkout the release tag |
I also disagree, as its already really well-argued by @dusanb94 and @mteodor here and here I don't have much to add, except that both root README and documentation should be updated with note or section which will say that docker-compose is meant and designed to be used in development environments, even if Docker is aiming that can be used in production and clustered with Swarm, We highly recommend Kubernetes for production. IMHO this PR is a nice improvement and it elimitantes development pain. |
OK, I see that majority is for this PR, and makes sense. I would just need one more thought to consider: do we leave This was we could remove ambiguity that this ENV var is related to what service really accepts (in the table) and what is used for deployment via docker-compose. @nmarcetic @dusanb94 @mteodor please give your thoughts on this. |
Service actually does accept |
@drasko @nmarcetic I think that we should remove this env var from the service README because it's explained elsewhere and has nothing to do with the service configuration. Root README sounds like a good candidate. |
Agree. Let's put it in the root, make a note label for compose and K8s. |
OK, this makes sense - we can put it in the root README, under the Install section. I am not sure if we need as an additional note in microservice READMEs (not in the table, but in a separate sentece). I think not, it is redundant - people will usually deploy looking at the Install section of central README (or by looking in the docker-compose and figuring out). I let @mteodor decide on this. |
On a second though - better just put it in the root README, because this is Mainflux-wide setting, not per-service setting. |
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
474d292
to
9077825
Compare
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.
LGTM
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.
LGTM
…ersion of image (absmach#1343) * add MF_RELEASE_TAG Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * update readme file for MF_RELEASE_TAG Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * update readme file for MF_RELEASE_TAG Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix explanation, space Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix bad search/replace Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix bad search/replace Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * minor changes Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * fix readme Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * improve explanation for tag Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * replace snippet with link to code section Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * improve explanation for tag Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * replace snippet with link to code section Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com> * remove MF_RELEASE_TAG from service readme Signed-off-by: Mirko Teodorovic <mirko.teodorovic@gmail.com>
Resolves #1342