mirror of
https://github.com/lingble/twenty.git
synced 2025-10-29 20:02:29 +00:00
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:
16
.devcontainer/devcontainer.json
Normal file
16
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,16 @@
|
||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-in-docker
|
||||
{
|
||||
"name": "Twenty",
|
||||
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
|
||||
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/docker-in-docker:2": {
|
||||
"version": "20.10",
|
||||
"enableNonRootDocker": "true",
|
||||
"moby": "true"
|
||||
}
|
||||
},
|
||||
"postCreateCommand": ".devcontainer/init.sh",
|
||||
"postStartCommand": ".vscode/up.sh"
|
||||
}
|
||||
6
.devcontainer/init.sh
Executable file
6
.devcontainer/init.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y postgresql-client
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,3 @@
|
||||
.vscode/*
|
||||
**/**/.env
|
||||
**/**/.npmrc
|
||||
.DS_Store
|
||||
|
||||
8
.vscode/clean.sh
vendored
Executable file
8
.vscode/clean.sh
vendored
Executable 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
6
.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"ms-vscode-remote.remote-containers",
|
||||
"ms-vscode.makefile-tools"
|
||||
]
|
||||
}
|
||||
5
.vscode/logs.sh
vendored
Executable file
5
.vscode/logs.sh
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd "$(dirname "$0")/../infra/dev"
|
||||
|
||||
docker-compose logs -f
|
||||
48
.vscode/tasks.json
vendored
Normal file
48
.vscode/tasks.json
vendored
Normal 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
34
.vscode/up.sh
vendored
Executable 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
|
||||
5
front/.vscode/extensions.json
vendored
Normal file
5
front/.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"esbenp.prettier-vscode"
|
||||
]
|
||||
}
|
||||
@@ -1,20 +1,20 @@
|
||||
HASURA_GRAPHQL_METADATA_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/hasura
|
||||
HASURA_GRAPHQL_PG_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/default
|
||||
HASURA_GRAPHQL_ADMIN_SECRET: secret
|
||||
HASURA_GRAPHQL_JWT_SECRET: '{"type":"HS256", "key": "jwt-very-long-hard-to-guess-secret"}'
|
||||
HASURA_EVENT_HANDLER_URL: http://twenty-server:3000/hasura/events
|
||||
HASURA_GRAPHQL_METADATA_DATABASE_URL=postgres://postgres:postgrespassword@postgres:5432/hasura
|
||||
HASURA_GRAPHQL_PG_DATABASE_URL=postgres://postgres:postgrespassword@postgres:5432/default
|
||||
HASURA_GRAPHQL_ADMIN_SECRET=secret
|
||||
HASURA_GRAPHQL_JWT_SECRET='{"type":"HS256", "key": "jwt-very-long-hard-to-guess-secret"}'
|
||||
HASURA_EVENT_HANDLER_URL=http://twenty-server:3000/hasura/events
|
||||
|
||||
HASURA_AUTH_SERVER_URL: http://localhost:4000
|
||||
HASURA_AUTH_CLIENT_URL: http://localhost:3001/auth/callback
|
||||
HASURA_AUTH_PROVIDER_GOOGLE_CLIENT_ID: REPLACE_ME
|
||||
HASURA_AUTH_PROVIDER_GOOGLE_CLIENT_SECRET: REPLACE_ME
|
||||
HASURA_AUTH_GRAPHQL_URL: http://twenty-hasura:8080/v1/graphql
|
||||
HASURA_AUTH_SERVER_URL=http://localhost:4000
|
||||
HASURA_AUTH_CLIENT_URL=http://localhost:3001/auth/callback
|
||||
HASURA_AUTH_PROVIDER_GOOGLE_CLIENT_ID=REPLACE_ME
|
||||
HASURA_AUTH_PROVIDER_GOOGLE_CLIENT_SECRET=REPLACE_ME
|
||||
HASURA_AUTH_GRAPHQL_URL=http://twenty-hasura:8080/v1/graphql
|
||||
|
||||
FRONT_REACT_APP_API_URL=http://localhost:8080
|
||||
FRONT_REACT_APP_AUTH_URL=http://localhost:4000
|
||||
FRONT_HASURA_GRAPHQL_ENDPOINT=http://twenty-hasura:8080/v1/graphql
|
||||
|
||||
SERVER_HASURA_EVENT_HANDLER_SECRET_HEADER: secret
|
||||
SERVER_DATABASE_URL: postgres://postgres:postgrespassword@postgres:5432/default
|
||||
SERVER_HASURA_EVENT_HANDLER_SECRET_HEADER=secret
|
||||
SERVER_DATABASE_URL=postgres://postgres:postgrespassword@postgres:5432/default
|
||||
|
||||
POSTGRES_PASSWORD=postgrespassword
|
||||
@@ -92,7 +92,7 @@ services:
|
||||
context: ../..
|
||||
dockerfile: ./infra/dev/docs/Dockerfile
|
||||
ports:
|
||||
- "5000:3000"
|
||||
- "5001:3000"
|
||||
volumes:
|
||||
- ../../docs:/app/docs
|
||||
- twenty_node_modules_docs:/app/docs/node_modules
|
||||
|
||||
21
twenty.code-workspace
Normal file
21
twenty.code-workspace
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "front"
|
||||
},
|
||||
{
|
||||
"path": "hasura"
|
||||
},
|
||||
{
|
||||
"path": "server"
|
||||
},
|
||||
{
|
||||
"path": "docs"
|
||||
},
|
||||
{
|
||||
"path": ".",
|
||||
"name": "root"
|
||||
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user