I can open the project in GitHub (#92)

* Ignore node_modules

* Use bash-compatible dotenv format

While still being compatible with dotenv, this
also allows sourcing the file to export all
variables in bash.

* Add prettier extension to recommendations

* Move to port 5001 to avoid conflict with macOS services

* Add workspace

* Add devcontainer

This automatically starts with all environment
variables available locally.

It brings up services which are dependent on each
other individually and verifies health before
moving on to the next service.

* Split init into clean, up, and logs tasks.

This allows the developer to set up .env and .npmrc
files before running services, and does not require
starting from a clean db every time the devcontainer
is restarted.

* Copy .env when creating codespace

* Automatically run UP command upon devcontainer creation

* Fix log message

---------

Co-authored-by: Felix Malfait <felix.malfait@gmail.com>
This commit is contained in:
Anders Borch
2023-05-03 11:34:10 +02:00
committed by GitHub
parent 27070b374e
commit f28edd405f
12 changed files with 162 additions and 14 deletions

8
.vscode/clean.sh vendored Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
cd "$(dirname "$0")/../infra/dev"
docker-compose down
docker volume rm dev_twenty_node_modules_front
docker volume rm dev_twenty_node_modules_server
docker volume rm dev_twenty_node_modules_docs

6
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"recommendations": [
"ms-vscode-remote.remote-containers",
"ms-vscode.makefile-tools"
]
}

5
.vscode/logs.sh vendored Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
cd "$(dirname "$0")/../infra/dev"
docker-compose logs -f

48
.vscode/tasks.json vendored Normal file
View File

@ -0,0 +1,48 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "up",
"command": "${workspaceFolder}/.vscode/up.sh",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}/infra/dev/"
},
"presentation": {
"reveal": "always",
"panel": "new",
"focus": true
}
},
{
"label": "clean",
"command": "${workspaceFolder}/.vscode/clean.sh",
"type": "shell",
"options": {
"cwd": "${workspaceFolder}/infra/dev/"
},
"presentation": {
"reveal": "always",
"panel": "new",
"focus": true
}
},
{
"label": "logs",
"command": "docker-compose",
"args": [
"logs",
"-f"
],
"type": "shell",
"options": {
"cwd": "${workspaceFolder}/infra/dev/"
},
"presentation": {
"reveal": "always",
"panel": "new",
"focus": true
}
}
]
}

34
.vscode/up.sh vendored Executable file
View File

@ -0,0 +1,34 @@
#!/bin/bash
cd "$(dirname "$0")/../infra/dev"
cp .env.example .env
set -o allexport; source .env; set +o allexport
docker-compose up -d postgres
while ! pg_isready -h localhost > /dev/null ; do
echo "Waiting for Postgres to be ready..."
sleep 1
done
echo "Postgres is accepting connections!"
docker-compose up -d twenty-hasura
while ! curl -s http://localhost:8080/healthz > /dev/null ; do
sleep 1
echo "Waiting for Hasura to be ready..."
done
docker-compose up -d hasura-auth
while ! curl -s http://localhost:4000/healthz > /dev/null ; do
sleep 1
echo "Waiting for Hasura Auth to be ready..."
done
docker-compose exec twenty-hasura hasura deploy
docker-compose up -d