Skip to content
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

Improves Docker Installation Files #988

Conversation

aryanpingle
Copy link
Contributor

@aryanpingle aryanpingle commented Oct 15, 2024

Improve Docker Installation Files

Aims to address issue #748. Specifically:

  • Renaming CLIENT_xyz to OAUTH_CLIENT_xyz
  • Renaming lib.docker to lib.env
  • Refactor docker-compose files and remove version tags from them
  • Adding level: DEBUG to traefik and traefik-forward-auth containers
  • Hardcoding CLIENT_CONFIG into installation files

Type of Change

✅ Documentation update
✅ Refactoring

Impact

Will improve the docker installation guide and make code more readable.

Checklist

✅ My code adheres to the coding and style guidelines of the project.
✅ I have added tests for all the new code and any changes made to
existing code.
✅ I have made corresponding changes to the documentation.

@aryanpingle
Copy link
Contributor Author

I had to rename the variable names in AUTHMS.drawio as well, which made one line overflow horizontally. In this commit I edited it using drawio.com, and here's how it looks now:

Before After
image image

It seems to have also changed some drawio metadata variables, I'm not sure if those matter:

image

@prasadtalasila
Copy link
Contributor

I had to rename the variable names in AUTHMS.drawio as well, which made one line overflow horizontally. In this commit I edited it using drawio.com, and here's how it looks now:

Before After
image image
It seems to have also changed some drawio metadata variables, I'm not sure if those matter:

image

The revised figure has CLIENT_ID at the top. It should be OAUTH_CLIENT_ID.

The diff on drawio file can be ignored

@prasadtalasila
Copy link
Contributor

@aryanpingle Please search for old variables in docs/ and replace them with the new names.

@aryanpingle
Copy link
Contributor Author

@prasadtalasila Yep I've updated all instances of the CLIENT_ID and CLIENT_SECRET environment variables in the docs as well.

I haven't modified any of the client side code like this:

export interface OidcConfig {
  // ...
  client_id: string;
  // ...
}

Should I change these? On one hand they aren't gonna be confused with traefik variables, but on the other hand using the OAUTH_ prefix would make things consistent.

@prasadtalasila
Copy link
Contributor

@prasadtalasila Yep I've updated all instances of the CLIENT_ID and CLIENT_SECRET environment variables in the docs as well.

I haven't modified any of the client side code like this:

export interface OidcConfig {
  // ...
  client_id: string;
  // ...
}

Should I change these? On one hand they aren't gonna be confused with traefik variables, but on the other hand using the OAUTH_ prefix would make things consistent.

This code is in client. Please do not change it. The scope of change proposed here must be restricted to: docker, docs and deploy.

@@ -42,7 +42,7 @@ services:
image: intocps/libms:latest
restart: unless-stopped
volumes:
- ${DTAAS_DIR}/deploy/config/lib.docker:/dtaas/libms/.env
- ${DTAAS_DIR}/deploy/config/lib.env:/dtaas/libms/.env
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be removed. Please check the same with a sample installation.

@@ -20,7 +20,7 @@ services:
image: intocps/libms:latest
restart: unless-stopped
volumes:
- ${DTAAS_DIR}/deploy/config/lib.docker:/dtaas/libms/.env
- ${DTAAS_DIR}/deploy/config/lib.env:/dtaas/libms/.env
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. It could be removed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please build it once to make sure that the change works as expected. BTW, does docker/libms.dockerfile change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope I couldn't find any references to lib.docker in libms.dockerfile, so it hasn't changed. Only lib.npm.dockerfile.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please run the poetry commands, especially tests suggested in DEVELOPER to make sure that the change is a non-breaking type.

@prasadtalasila
Copy link
Contributor

TODO: issue #954 needs to be addressed in this PR

@prasadtalasila
Copy link
Contributor

@aryanpingle The following changes are required in the PR as well.

  1. Line-12 of lib.npm.dockerfile (please check docker buildx after the change)
  2. Remove the lib.env volume (file) mapping from server installatiin files and check
  3. Documentation
        * docs/admin/host.md
        * deploy/docker/SERVER.md
  4. Remove version from docker/compose.dev.yml.

@aryanpingle
Copy link
Contributor Author

aryanpingle commented Oct 22, 2024

  • Running docker buildx build -t intocps/libms:latest -f ./docker/libms.npm.dockerfile . builds successfully
  • Checked if lib.env mapping can be removed
  • Documentation has been modified
  • Removed version from docker/compose.dev.yml

@prasadtalasila prasadtalasila added this to the Release v0.6.0 milestone Oct 22, 2024
* Inlines the path to the client configuration file for compose and env files
!!! tip
Important points to note:

1. The path examples given here are for Linux OS.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code block style

!!! tip
Important points to note:

1. The path examples given here are for Linux OS.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code block style

These paths can be Windows OS compatible paths as well.
Important points to note:

1. The path examples given here are for Linux OS.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code block style

@aryanpingle
Copy link
Contributor Author

PR Summary

  • Renames lib.docker to lib.env
  • Removes lib.env mapping from the libms container
  • Adds OAUTH_ prefix to authorization variables
  • Enables debugging for traefik & forward-auth
  • Inlines the CLIENT_CONFIG variable directly into compose files
  • Refactors docker-compose files (by removing the version tag)
  • Updated the relevant markdown files

@prasadtalasila I'm not too sure, but I think the codeclimate issues are due it not understanding the mkdocs call-outs like !!! tip.

Tested this branch on a clean install: localhost and server (http and https) all run correctly. I used the integrated gitlab instance while testing in case it matters, which it likely shouldn't.

Copy link
Contributor

@prasadtalasila prasadtalasila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aryanpingle Thanks for the updates. Please see the comments.

deploy/docker/DOCKER-ENV.md Outdated Show resolved Hide resolved
deploy/docker/LOCALHOST.SECURE.md Outdated Show resolved Hide resolved
deploy/docker/LOCALHOST.md Outdated Show resolved Hide resolved
deploy/docker/SERVER.md Outdated Show resolved Hide resolved
docker/compose.dev.yml Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition, the libms is using servers/lib/config/.env.default. The developers do not have a choice of specifying config file. A new variable named LIB_CONFIG needs to be added to docker/.env file and needs to be volume mapped to libms service.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain this a bit further? If I understand correctly:

  1. Add a variable to .env.default: LIB_CONFIG='/dev/null' (can't map an empty string to a docker container)
  2. Add this line to compose.lib.dev.yml:
    volumes:
      ...
      - ${LIB_CONFIG}:/dtaas/libms/.env

1. The path examples given here are for Linux OS.
These paths can be Windows OS compatible paths as well.
1. The client configuration file is located at `deploy/config/client/env.local.js`.
Edit the URLs in this file by replacing `http` with `https`. Beyond this, it is not necessary to modify this file.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line length

These paths can be Windows OS compatible paths as well.
1. The client configuration file is located at `deploy/config/client/env.js`.
1. The Server DNS can also be an IP address.
However, for proper working it is neccessary to use the same convention (IP/DNS) in the client configuration file as well.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line length

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prasadtalasila minor issue, but it's not possible to put a line break here without it creating a new line in the bullet point list. I could instead use HTML markup like so:

<ol>
   <li>
      The path examples given here are for Linux OS.<br>
      These paths can be Windows OS compatible paths as well.
   </li>
   <li>
      The client configuration file is located at
      <code>deploy/config/client/env.local.js</code>.<br>
      Edit the URLs in this file by replacing <code>http</code> with
      <code>https</code>. Beyond this, it is not necessary to modify
      this file.
   </li>
</ol>

Preview:

  1. The path examples given here are for Linux OS.
    These paths can be Windows OS compatible paths as well.
  2. The client configuration file is located at deploy/config/client/env.local.js.
    Edit the URLs in this file by replacing http with https. Beyond this, it is not necessary to modify this file.

It looks cleaner in the markdown, and makes it more customizable - but it's up to you whether it fits the conventions

1. The path examples given here are for Linux OS.
These paths can be Windows OS compatible paths as well.
1. The client configuration file is located at `deploy/config/client/env.local.js`.
If you are following the guide to use HTTPS on localhost, edit the URLs in this file by replacing `http` with `https`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line length

Copy link

codeclimate bot commented Oct 29, 2024

Code Climate has analyzed commit 3c1b821 and detected 1 issue on this pull request.

Here's the issue category breakdown:

Category Count
Style 1

View more on Code Climate.

prasadtalasila added a commit that referenced this pull request Oct 30, 2024
  - Cleans up docker compose files by renaming variables,
     removing unnecessary variables and tags.
  - Updates the installation documents

---------
Co-authored-by: aryanpingle <[email protected]>
@prasadtalasila
Copy link
Contributor

merged via PR #1019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants