This repository has been archived by the owner on Oct 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: ♻️ developer experience #145
Open
ap0nia
wants to merge
12
commits into
main
Choose a base branch
from
docker-compose
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1c761d0
feat: ✨ minimal docker compose pg setup
ap0nia 47f8744
feat: ✨ working docker compose setup
ap0nia 73cb9a3
feat: ✨ update db initialization script
ap0nia 7344082
feat(db): ✨ environment variables and env.example
ap0nia 026f82e
fix: 🐛 dotenv-cli not installed at project root
ap0nia a4312b2
feat: ✨ quick getting-started steps on readme
ap0nia 25454ad
style: 🎨 add newlines in readme
ap0nia 8b855e7
Merge branch 'main' into docker-compose
ap0nia 58b407c
Merge branch 'main' into docker-compose
ap0nia d4a270a
feat: ✨ add .env.example and remove it from gitignore
ap0nia 8486a89
feat: ✨ add step for copying `.env.example`
ap0nia f1cf702
feat: ✨ add db:push step
ap0nia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#----------------------------------------------------------------------------------------- | ||
# Node.js | ||
#----------------------------------------------------------------------------------------- | ||
NODE_ENV=development | ||
|
||
#----------------------------------------------------------------------------------------- | ||
# PostgresSQL database. | ||
#----------------------------------------------------------------------------------------- | ||
DATABASE_DIALECT=postgres | ||
DATABASE_HOST=localhost | ||
DATABASE_USER=postgres | ||
DATABASE_PASSWORD=postgres | ||
DATABASE_DATABASE=anteaterapi | ||
DATABASE_PORT=5432 | ||
DATABASE_URL=${DATABASE_DIALECT}://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}/${DATABASE_DATABASE} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ yarn-error.log* | |
|
||
# env | ||
.env* | ||
!.env.example | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Special case. |
||
|
||
# turbo | ||
.turbo | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
version: "3.9" | ||
|
||
services: | ||
db: | ||
build: | ||
context: libs/db | ||
dockerfile: Dockerfile | ||
ports: | ||
- ${DATABASE_PORT}:${DATABASE_PORT} | ||
environment: | ||
POSTGRES_USER: ${DATABASE_USER} | ||
POSTGRES_PASSWORD: ${DATABASE_PASSWORD} | ||
POSTGRES_DB: ${DATABASE_DATABASE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
FROM postgres:latest | ||
COPY db.sql.gz /docker-entrypoint-initdb.d/db.sql.gz |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
"main": "index.ts", | ||
"types": "index.ts", | ||
"scripts": { | ||
"db:push": "prisma db push", | ||
"db:push": "dotenv -e ../../.env prisma db push", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
"generate": "prisma generate", | ||
"postinstall": "prisma generate", | ||
"migrate:dev": "dotenv -e ../../.env.development -- prisma migrate dev", | ||
|
@@ -20,6 +20,7 @@ | |
"@prisma/client": "5.10.2" | ||
}, | ||
"devDependencies": { | ||
"dotenv-cli": "7.3.0", | ||
"prisma": "5.10.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
"build": "turbo run build", | ||
"ci:tsc": "npx tsc -p . --noEmit", | ||
"commit": "cz", | ||
"db:push": "turbo run db:push", | ||
"deploy": "turbo run deploy", | ||
"destroy": "turbo run destroy", | ||
"dev": "dotenv -c development -- turbo run dev", | ||
|
@@ -45,6 +46,9 @@ | |
"typescript": "5.3.3", | ||
"unconfig": "0.3.11" | ||
}, | ||
"devDependencies": { | ||
"dotenv-cli": "7.3.0" | ||
}, | ||
"packageManager": "[email protected]", | ||
"engines": { | ||
"pnpm": "8" | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
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 thatdocker-compose.yml
will automatically parse the nearest.env
file (also with variable substitution enabled), and thus share the identical database configuration.