Skip to content

The open alternative to Salesforce, designed for AI.

I can open the project in GitHub (#92)

Anders Borchf28edd405fd8
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 00000000000..b0b6f692b4d
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -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"
+}
diff --git a/.devcontainer/init.sh b/.devcontainer/init.sh
new file mode 100755
index 00000000000..b92b5fe20a4
--- /dev/null
+++ b/.devcontainer/init.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+DEBIAN_FRONTEND=noninteractive
+
+sudo apt-get update
+sudo apt-get install -y postgresql-client
diff --git a/.gitignore b/.gitignore
index 9c724217810..d6acfd147fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,3 @@
-.vscode/*
**/**/.env
**/**/.npmrc
.DS_Store
diff --git a/.vscode/clean.sh b/.vscode/clean.sh
new file mode 100755
index 00000000000..48dc8c121bb
--- /dev/null
+++ b/.vscode/clean.sh
@@ -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
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 00000000000..be44b8bfb07
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,6 @@
+{
+ "recommendations": [
+ "ms-vscode-remote.remote-containers",
+ "ms-vscode.makefile-tools"
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/logs.sh b/.vscode/logs.sh
new file mode 100755
index 00000000000..99350e2faa4
--- /dev/null
+++ b/.vscode/logs.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+cd "$(dirname "$0")/../infra/dev"
+
+docker-compose logs -f
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 00000000000..3f8df02b099
--- /dev/null
+++ b/.vscode/tasks.json
@@ -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
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/.vscode/up.sh b/.vscode/up.sh
new file mode 100755
index 00000000000..1de7c5af344
--- /dev/null
+++ b/.vscode/up.sh
@@ -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
diff --git a/front/.vscode/extensions.json b/front/.vscode/extensions.json
new file mode 100644
index 00000000000..3433c01b095
--- /dev/null
+++ b/front/.vscode/extensions.json
@@ -0,0 +1,5 @@
+{
+ "recommendations": [
+ "esbenp.prettier-vscode"
+ ]
+}
\ No newline at end of file
diff --git a/infra/dev/.env.example b/infra/dev/.env.example
index e6e3087b9d6..46473ef4cd3 100644
--- a/infra/dev/.env.example
+++ b/infra/dev/.env.example
@@ -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
\ No newline at end of file
diff --git a/infra/dev/docker-compose.yml b/infra/dev/docker-compose.yml
index 8275acb6401..583689b0d33 100644
--- a/infra/dev/docker-compose.yml
+++ b/infra/dev/docker-compose.yml
@@ -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
diff --git a/twenty.code-workspace b/twenty.code-workspace
new file mode 100644
index 00000000000..394d67054fb
--- /dev/null
+++ b/twenty.code-workspace
@@ -0,0 +1,21 @@
+{
+ "folders": [
+ {
+ "path": "front"
+ },
+ {
+ "path": "hasura"
+ },
+ {
+ "path": "server"
+ },
+ {
+ "path": "docs"
+ },
+ {
+ "path": ".",
+ "name": "root"
+
+ }
+ ]
+}
\ No newline at end of file