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

refactor: ♻️ developer experience #145

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

refactor: ♻️ developer experience #145

wants to merge 12 commits into from

Conversation

ap0nia
Copy link
Contributor

@ap0nia ap0nia commented May 15, 2024

Features

docker compose

Simple docker-compose setup for getting started.

  1. Clone this repository and change into the correct directory.
git clone [email protected]:icssc/peterportal-api-next
cd peterportal-api-next
  1. Install dependencies.
pnpm install
  1. Start the development services locally (database).
docker compose up -d
  1. Start the local development server.
pnpm dev

Project

Closes #150

@ap0nia ap0nia added the no deploy Do not deploy this pull request to staging label May 15, 2024
@ap0nia ap0nia self-assigned this May 15, 2024
Copy link

gitguardian bot commented May 15, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
11027252 Triggered Generic Password 1c761d0 docker-compose.yml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@github-actions github-actions bot changed the title refactor: developer experience refactor: ♻️ developer experience May 15, 2024
@ap0nia
Copy link
Contributor Author

ap0nia commented May 15, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
🛠 Guidelines to remediate hardcoded secrets
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

This is a false alarm. The POSTGRES_PASSWORD variable in the docker-compose.yml file is intended only for local development. Production and staging instances will be using AWS RDS credentials.

@ap0nia ap0nia requested a review from ecxyzzy May 23, 2024 04:58
@@ -8,7 +8,7 @@
"main": "index.ts",
"types": "index.ts",
"scripts": {
"db:push": "prisma db push",
"db:push": "dotenv -e ../../.env prisma db push",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Open issue with prisma and monorepo tech: prisma/prisma#12535

TLDR: they still haven't really optimized the combination.

DATABASE_PASSWORD=postgres
DATABASE_DATABASE=anteaterapi
DATABASE_PORT=5432
DATABASE_URL=${DATABASE_DIALECT}://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DATABASE}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Depending on the program that's used to parse the .env file, it may or may not support variable substitution. TIL, prisma does in fact support it, which is convenient for integrating this with docker-compose. The logic being that docker-compose.yml will automatically parse the nearest .env file (also with variable substitution enabled), and thus share the identical database configuration.

@@ -18,6 +18,7 @@ yarn-error.log*

# env
.env*
!.env.example
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Special case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

38 MB doesn't seem too bad? 👀
It's extremely simple to setup the local db instance with this format!

@@ -1,6 +1,9 @@
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"db:push": {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the root package.json can run pnpm db:push.

@ap0nia ap0nia requested a review from y-dejong May 23, 2024 15:17
@ap0nia ap0nia marked this pull request as ready for review May 23, 2024 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no deploy Do not deploy this pull request to staging
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

Improve DX with getting started
1 participant