chore: switch deployment to Docker Compose#164
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request streamlines the deployment process by introducing Docker Compose and centralizing configuration management. By moving sensitive and environment-specific settings into environment variables, the application becomes more flexible and easier to deploy across various stages without requiring hardcoded configuration files. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request restructures the application configuration by removing the private profile and parameterizing environment-specific configurations (dev, prod, local) using environment variables. It also introduces a docker-compose.yml file, updates the .gitignore to ignore environment files, and simplifies the Dockerfile entrypoint. Feedback on these changes includes: removing spaces after commas and wrapping values in double quotes for allowed-origins and server-url in YAML configurations to prevent parsing and CORS verification issues; making the .env file optional in docker-compose.yml to avoid startup failures when the file is absent; and providing default values for JWT_SECRET_EXPIRE_LENGTH in the dev and prod profiles to prevent Spring Boot startup failures when binding empty values to numeric types.
| allowed-origins: ${CORS_ALLOWED_ORIGINS:http://localhost:3000, https://dev.crew-wiki.site, https://dev.api.crew-wiki.site} | ||
|
|
||
| swagger: | ||
| server-url: https://dev.api.crew-wiki.site | ||
| server-url: ${SWAGGER_SERVER_URL:https://dev.api.crew-wiki.site} |
There was a problem hiding this comment.
Having spaces after commas in the default value of allowed-origins (e.g., , https://...) can result in leading whitespaces in the parsed list of origins, which may cause CORS verification to fail. Additionally, wrapping values containing colons and commas in double quotes prevents potential YAML parsing issues.
Let's remove the spaces after the commas and wrap the values in double quotes.
allowed-origins: "${CORS_ALLOWED_ORIGINS:http://localhost:3000,https://dev.crew-wiki.site,https://dev.api.crew-wiki.site}"
swagger:
server-url: "${SWAGGER_SERVER_URL:https://dev.api.crew-wiki.site}"| allowed-origins: ${CORS_ALLOWED_ORIGINS:https://crew-wiki.site, https://api.crew-wiki.site} | ||
|
|
||
| swagger: | ||
| server-url: https://api.crew-wiki.site | ||
| server-url: ${SWAGGER_SERVER_URL:https://api.crew-wiki.site} |
There was a problem hiding this comment.
Having spaces after commas in the default value of allowed-origins (e.g., , https://...) can result in leading whitespaces in the parsed list of origins, which may cause CORS verification to fail. Additionally, wrapping values containing colons and commas in double quotes prevents potential YAML parsing issues.
Let's remove the spaces after the commas and wrap the values in double quotes.
allowed-origins: "${CORS_ALLOWED_ORIGINS:https://crew-wiki.site,https://api.crew-wiki.site}"
swagger:
server-url: "${SWAGGER_SERVER_URL:https://api.crew-wiki.site}"| env_file: | ||
| - .env |
There was a problem hiding this comment.
Since .env is ignored in .gitignore, running docker compose up will fail if the .env file is not present. In modern Docker Compose (v2.24.0+), you can make the environment file optional by using the path and required: false syntax. This prevents startup failures when environment variables are supplied directly via the shell or CI/CD environment.
env_file:
- path: .env
required: false| jwt: | ||
| token: | ||
| secret-key: ${JWT_SECRET_KEY} | ||
| expire-length: ${JWT_SECRET_EXPIRE_LENGTH} |
There was a problem hiding this comment.
| jwt: | ||
| token: | ||
| secret-key: ${JWT_SECRET_KEY} | ||
| expire-length: ${JWT_SECRET_EXPIRE_LENGTH} |
There was a problem hiding this comment.
No description provided.