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

Combined docker files #1623

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Combined docker files #1623

wants to merge 1 commit into from

Conversation

jherrflexion
Copy link
Contributor

Description

Describe what changed in this PR at a high level.

Issue

Add a link to the issue here. Consider using
closing keywords
if the this PR isn't for a story (stories will be closed through different means).

Checklist

  • I have added tests to cover my changes
  • I have added logging where useful (with appropriate log level)
  • I have added JavaDocs where required
  • I have updated the documentation accordingly

Note: You may remove items that are not applicable

Copy link

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 Security concerns

Hardcoded Credentials:
The PR introduces hardcoded credentials in the docker-compose.yml file, which could lead to security vulnerabilities. It is recommended to use environment variables or other secure methods to manage credentials.

⚡ Recommended focus areas for review

Hardcoded Credentials
The PR includes hardcoded credentials for database access which could lead to security vulnerabilities if not managed properly.

restart: unless-stopped
environment:
POSTGRES_DB: "intermediary"
POSTGRES_PASSWORD: "changeIT!" # pragma: allowlist secret

Choose a reason for hiding this comment

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

Consider using environment variables for database credentials to enhance security. This can be done by setting up environment variables in your CI/CD pipeline or local environment, and referencing them in the docker-compose file. [important]


postgresql:
image: postgres:16
restart: unless-stopped

Choose a reason for hiding this comment

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

It's recommended to avoid using 'unless-stopped' for the restart policy of containers in production environments. Consider using 'always' or a specific restart policy that aligns with your deployment strategy. [medium]

@@ -56,7 +56,7 @@ creates a `.env` file in the resource folder with the required configuration

### Using a local database

Use [docker-compose.postgres.yml](docker-compose.postgres.yml) to run your local DB. In IntelliJ, you can click the play arrow to start it
Use [docker-compose.yml](docker-compose.yml) to run your local DB. In IntelliJ, you can click the play arrow to start it

Choose a reason for hiding this comment

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

Update the documentation to reflect the removal of 'docker-compose.postgres.yml' and ensure all references are correctly pointing to 'docker-compose.yml'. This helps in maintaining accurate and useful documentation. [important]

Copy link

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Score
Security
Replace hardcoded sensitive information with environment variables

Avoid hardcoding sensitive information such as database passwords directly in the
docker-compose file. Use environment variables or secrets management tools instead.

docker-compose.yml [21]

-POSTGRES_PASSWORD: "changeIT!"
+POSTGRES_PASSWORD: "${DB_PASSWORD}"
Suggestion importance[1-10]: 8

Why: Hardcoding sensitive information such as passwords poses a security risk. Using environment variables enhances security by keeping sensitive data out of source control.

8
Use environment variables for JDBC connection settings to improve security and maintainability

Replace the plaintext JDBC connection string in the liquibase commands with
environment variables to enhance security and flexibility.

docker-compose.yml [2-5]

---url jdbc:postgresql://localhost:5433/intermediary --username intermediary --password 'changeIT!'
+--url ${JDBC_URL} --username ${DB_USER} --password ${DB_PASSWORD}
Suggestion importance[1-10]: 8

Why: Replacing hard-coded credentials in JDBC connection strings with environment variables increases security and flexibility, allowing for easier configuration changes without modifying the source code.

8
General
Correct the database port mapping to use the standard PostgreSQL port

Ensure that the database port in the 'ports' section of the 'postgresql' service
maps correctly to the default PostgreSQL port, which is 5432, to avoid potential
conflicts or confusion.

docker-compose.yml [24]

-- 5433:5432
+- 5432:5432
Suggestion importance[1-10]: 6

Why: Using the standard PostgreSQL port (5432) can help avoid confusion and potential conflicts with other services. However, the PR might have intentionally mapped it differently for specific reasons.

6
Update the PostgreSQL image to the latest version for enhanced security and features

Consider using a more secure and recent version of PostgreSQL, if available, to
benefit from the latest security patches and features.

docker-compose.yml [17]

-image: postgres:16
+image: postgres:latest
Suggestion importance[1-10]: 5

Why: Using the latest version of PostgreSQL can provide security patches and new features. However, it's crucial to ensure compatibility with the application, hence a moderate score.

5

Copy link

sonarcloud bot commented Nov 27, 2024

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

Successfully merging this pull request may close these issues.

1 participant