Simplify docs and remove Docker local setup (#4783)

Having 2 different dev setups caused confusion, let's remove the Docker
local setup and recommend people install yarn locally.

Also simplified some docs by merging pages together, the recommend
self-hosting option is now the docker-compose / to adapt the
docker-compose.
This commit is contained in:
Félix Malfait
2024-04-03 16:38:28 +02:00
committed by GitHub
parent 1c6f0eb577
commit 7a34dc4910
24 changed files with 41 additions and 265 deletions

View File

@ -72,13 +72,13 @@ done
echo "📁 Creating directory '$dir_name'"
mkdir -p "$dir_name" && cd "$dir_name" || { echo "❌ Failed to create/access directory '$dir_name'"; exit 1; }
# Copy the twenty/packages/twenty-docker/prod/docker-compose.yml file in it
# Copy the twenty/packages/twenty-docker/docker-compose.yml file in it
echo -e "\t• Copying docker-compose.yml"
curl -sLo docker-compose.yml https://raw.githubusercontent.com/twentyhq/twenty/$branch/packages/twenty-docker/prod/docker-compose.yml
curl -sLo docker-compose.yml https://raw.githubusercontent.com/twentyhq/twenty/$branch/packages/twenty-docker/docker-compose.yml
# Copy twenty/packages/twenty-docker/prod/.env.example to .env
# Copy twenty/packages/twenty-docker/.env.example to .env
echo -e "\t• Setting up .env file"
curl -sLo .env https://raw.githubusercontent.com/twentyhq/twenty/$branch/packages/twenty-docker/prod/.env.example
curl -sLo .env https://raw.githubusercontent.com/twentyhq/twenty/$branch/packages/twenty-docker/.env.example
# Replace TAG=latest by TAG=<latest_release or version input>
if [[ $(uname) == "Darwin" ]]; then

View File

@ -24,37 +24,37 @@ dev-postgres-build:
@docker compose -f dev/docker-compose.yml up --build postgres -d
prod-docs-build:
@cd ../.. && docker build -f ./packages/twenty-docker/prod/twenty-docs/Dockerfile --tag twenty-docs . && cd -
@cd ../.. && docker build -f ./packages/twenty-docker/twenty-docs/Dockerfile --tag twenty-docs . && cd -
prod-docs-run:
@docker run -d -p 3000:3000 --name twenty-docs twenty-docs
prod-build:
@cd ../.. && docker build -f ./packages/twenty-docker/prod/twenty/Dockerfile --tag twenty . && cd -
@cd ../.. && docker build -f ./packages/twenty-docker/twenty/Dockerfile --tag twenty . && cd -
prod-run:
@docker run -d -p 3000:3000 --name twenty twenty
prod-front-build:
@cd ../.. && docker build -f ./packages/twenty-docker/prod/twenty-front/Dockerfile --tag twenty-front . && cd -
@cd ../.. && docker build -f ./packages/twenty-docker/twenty-front/Dockerfile --tag twenty-front . && cd -
prod-front-run:
@docker run -d -p 3001:3000 --name twenty-front twenty-front
prod-server-build:
@cd ../.. && docker build -f ./packages/twenty-docker/prod/twenty-server/Dockerfile --tag twenty-server . && cd -
@cd ../.. && docker build -f ./packages/twenty-docker/twenty-server/Dockerfile --tag twenty-server . && cd -
prod-server-run:
@docker run -d -p 3000:3000 --name twenty-server twenty-server
prod-postgres-build:
@cd ../.. && docker build -f ./packages/twenty-docker/prod/twenty-postgres/Dockerfile --tag twenty-postgres . && cd -
@cd ../.. && docker build -f ./packages/twenty-docker/twenty-postgres/Dockerfile --tag twenty-postgres . && cd -
prod-postgres-run:
@docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres --name twenty-postgres twenty-postgres
prod-website-build:
@cd ../.. && docker build -f ./packages/twenty-docker/prod/twenty-website/Dockerfile --tag twenty-website . && cd -
@cd ../.. && docker build -f ./packages/twenty-docker/twenty-website/Dockerfile --tag twenty-website . && cd -
prod-website-run:
@docker run -d -p 3000:3000 --name twenty-website twenty-website
@ -64,7 +64,7 @@ release-front:
--push \
--no-cache \
--platform linux/amd64,linux/arm64 \
-f ./packages/twenty-docker/prod/twenty-front/Dockerfile -t twentycrm/twenty-front:$(version) -t twentycrm/twenty-front:latest . \
-f ./packages/twenty-docker/twenty-front/Dockerfile -t twentycrm/twenty-front:$(version) -t twentycrm/twenty-front:latest . \
&& cd -
release-server:
@ -72,7 +72,7 @@ release-server:
--push \
--no-cache \
--platform linux/amd64,linux/arm64 \
-f ./packages/twenty-docker/prod/twenty-server/Dockerfile -t twentycrm/twenty-server:$(version) -t twentycrm/twenty-server:latest . \
-f ./packages/twenty-docker/twenty-server/Dockerfile -t twentycrm/twenty-server:$(version) -t twentycrm/twenty-server:latest . \
&& cd -
release-docs:
@ -80,7 +80,7 @@ release-docs:
--push \
--no-cache \
--platform linux/amd64,linux/arm64 \
-f ./packages/twenty-docker/prod/twenty-docs/Dockerfile -t twentycrm/twenty-docs:$(version) -t twentycrm/twenty-docs:latest . \
-f ./packages/twenty-docker/twenty-docs/Dockerfile -t twentycrm/twenty-docs:$(version) -t twentycrm/twenty-docs:latest . \
&& cd -
release-postgres:
@ -88,5 +88,5 @@ release-postgres:
--push \
--no-cache \
--platform linux/amd64,linux/arm64 \
-f ./packages/twenty-docker/prod/twenty-postgres/Dockerfile -t twentycrm/twenty-postgres:$(version) -t twentycrm/twenty-postgres:latest . \
-f ./packages/twenty-docker/twenty-postgres/Dockerfile -t twentycrm/twenty-postgres:$(version) -t twentycrm/twenty-postgres:latest . \
&& cd -

View File

@ -1,39 +0,0 @@
version: "3.9"
services:
twenty-dev:
build:
context: ../../..
dockerfile: ./packages/twenty-docker/dev/twenty-dev/Dockerfile
ports:
- "3000:3000"
- "3001:3001"
- "6006:6006"
volumes:
- ../../..:/app
- twenty_dev_node_modules_root:/app/node_modules
- twenty_dev_node_modules_docs:/app/packages/twenty-docs/node_modules
- twenty_dev_node_modules_front:/app/packages/twenty-front/node_modules
- twenty_dev_node_modules_server:/app/packages/twenty-server/node_modules
- twenty_dev_node_modules_website:/app/packages/twenty-website/node_modules
depends_on:
- postgres
postgres:
container_name: twenty_postgres
image: twentycrm/twenty-postgres:latest
volumes:
- twenty_db_data:/bitnami/postgresql
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
- POSTGRES_DB=default
ports:
- "5432:5432"
volumes:
twenty_db_data:
name: twenty_db_data
twenty_dev_node_modules_root:
twenty_dev_node_modules_docs:
twenty_dev_node_modules_eslint:
twenty_dev_node_modules_front:
twenty_dev_node_modules_server:
twenty_dev_node_modules_website:

View File

@ -1,7 +0,0 @@
FROM node:18.17.1-bullseye as twenty-dev
WORKDIR /app
RUN npx playwright install-deps
CMD ["tail", "-f", "/dev/null"]

View File

@ -26,7 +26,7 @@ FROM node:18.17.1-alpine as twenty-front
WORKDIR /app/packages/twenty-front
COPY --from=twenty-front-build /app/packages/twenty-front/build ./build
COPY ./packages/twenty-docker/prod/twenty-front/serve.json ./build
COPY ./packages/twenty-docker/twenty-front/serve.json ./build
COPY ./packages/twenty-front/scripts/inject-runtime-env.sh /app/packages/twenty-front/scripts/inject-runtime-env.sh
RUN yarn global add serve

View File

@ -47,7 +47,7 @@ WORKDIR mysql_fdw
RUN make USE_PGXS=1
RUN make USE_PGXS=1 install
COPY ./packages/twenty-docker/prod/twenty-postgres/init.sql /docker-entrypoint-initdb.d/
COPY ./packages/twenty-docker/twenty-postgres/init.sql /docker-entrypoint-initdb.d/
USER 1001
ENTRYPOINT ["/opt/bitnami/scripts/postgresql/entrypoint.sh"]

View File

@ -50,7 +50,7 @@ FROM node:18.17.1-alpine as twenty
# Used to run healthcheck in docker
RUN apk add --no-cache curl jq
COPY ./packages/twenty-docker/prod/twenty/entrypoint.sh /app/entrypoint.sh
COPY ./packages/twenty-docker/twenty/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
WORKDIR /app/packages/twenty-server

View File

@ -9,13 +9,15 @@ import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
The easiest way to try the app is to sign up on [demo.twenty.com](https://demo.twenty.com).
The easiest way to try the app is to sign up on [app.twenty.com](https://app.twenty.com).
We offer a free trial but require a credit-card to signup.
If you just want to play around with a test instance you can use these credentials:
If you just want to play around with a test instance you can use these credentials on [demo.twenty.com](https://demo.twenty.com):
```
email: noah@demo.dev
password: Applecar2025
```
```
Expect the demo to occasionnaly have bugs; it's used for testing purposes and therefore is running a version of the software that's newer than the production environment.

View File

@ -1,135 +0,0 @@
---
title: Docker Setup
sidebar_position: 3
description: Set up the project with Docker
sidebar_custom_props:
icon: TbBrandDocker
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
This guide will walk you through provisioning the project with Docker. This comes with the following advantages:
- It provides the exact same environment as the core development team.
- It includes some extra dependencies (such as `playwright`) that you might need if you wish to contribute to some advanced areas of the project.
- It provisions a PostgreSQL database.
:::info
Avoid setting up the project with Docker if you are a Windows (WSL) user, unless you have experience with it, as it will make troubleshooting harder.
If you are a Windows user, it's better to use the [yarn installation](/start/local-setup/yarn-setup).
:::
## Prerequisites
Make sure you have the latest [Docker](https://docs.docker.com/get-docker/) and [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) versions installed on your computer.
You can run `docker --version` to verify the installation.
## Step 1: Git Clone
In your terminal, run the following command:
:::info Note
It's better to use SSH for this step. If you already haven't set up SSH keys, please do so first. You can learn more about it [here](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/about-ssh).
:::
<Tabs>
<TabItem value="ssh" label="SSH (Recommended)" default>
```bash
git clone git@github.com:twentyhq/twenty.git
```
</TabItem>
<TabItem value="https" label="HTTPS" >
```bash
git clone https://github.com/twentyhq/twenty.git
```
</TabItem>
</Tabs>
## Step 2: Setup environment variables
You need to set some environment variables before you can work on the project. Locally, it's better to set them through `.env` files.
```bash
cd twenty
cp ./packages/twenty-front/.env.example ./packages/twenty-front/.env
cp ./packages/twenty-server/.env.example ./packages/twenty-server/.env
echo "# ———————— Docker setup ———————— " >> ./packages/twenty-server/.env
echo "TAG=latest" >> ./packages/twenty-server/.env
echo "POSTGRES_ADMIN_PASSWORD=twenty" >> ./packages/twenty-server/.env
echo "LOCAL_SERVER_URL=http://localhost:3001" >> ./packages/twenty-server/.env
```
The default values should work out of the box, except for the postgres URL, which requires a small modification.
Open `./packages/twenty-server/.env` and change to the following:
```bash
PG_DATABASE_URL=postgres://twenty:twenty@postgres:5432/default
```
## Step 3: Build
The project includes an environment containerized with Docker and orchestrated with `docker-compose`.
This installation method will also provision a PostgreSQL container.
```bash
make docker-dev-build
```
## Step 4: Migrate & seed
Before running the project, you need to initialize the database by running the migrations and seed.
Start the containers:
```bash
make docker-dev-up
```
Setup database, run migrations, and seed:
```bash
make docker-dev-sh
yarn
yarn nx database:reset twenty-server
```
## Step 5: Start Twenty
Run the project with the following commands from the `root` folder:
```bash
make docker-dev-sh
yarn nx start twenty-server
```
and in a separate terminal:
```bash
make docker-dev-sh
yarn nx start twenty-front
```
You should now have:
- **Frontend** available on: [http://localhost:3001](http://localhost:3001)
- **Server** available on: [http://localhost:3000/graphql](http://localhost:3000/graphql)
- **Postgres** available on [http://localhost:5432](http://localhost:5432) and containing database named `default`
Sign in using a seeded demo account `tim@apple.dev` (password: `Applecar2025`) to start using Twenty.
## Step 6: Configure your IDE
As you are executing the project inside a Docker container, you need to configure your IDE to use the same environment.
You can find the instructions for your IDE in our [IDE setup](/start/local-setup/ide-setup) guide.
### Troubleshooting
#### Docker throws errors while setting up local environment
If by any chance you run into problems with Docker, you should change the `docker-compose` to `docker compose` in `./infra/dev/Makefile` as `docker-compose` is an old version
that's becoming obsolete. (You can find more info [here](https://docs.docker.com/compose/migrate/))

View File

@ -34,21 +34,6 @@ You can use the recommended extensions for the project. You will find them in `.
<img src="/img/contributor/ide-extensions.png" alt="Visual Studio Code: Install recommended extensions" width="90%" />
</div>
### Step 4: (Docker only) Run VSCode in container
If you are using a [Docker setup](/start/local-setup/docker-setup), you will need to run VSCode in the container. You can do that by opening the project, clicking on the `Remote Explorer` icon on the left sidebar and then clicking on `Attach in New window` on `dev-twenty-dev` container.
<div style={{textAlign: 'center'}}>
<img src="/img/contributor/ide-start-dev-container.png" alt="Visual Studio Code: Open in container" width="90%" />
</div>
<br />
VSCode will open a new window and you will be able to use it as you would typically do. The only difference is that you will be running VSCode inside the container and you will have access to all the tools and dependencies installed in the container.
<br /><br />
If you stop your containers, you will need to restart them before opening the project in VSCode again.
## You are all set
You are all set to start contributing to the project. If you have any questions, feel free to reach out to the team on [Discord](https://discord.gg/cx5n4Jzs57).

View File

@ -16,14 +16,6 @@ Twenty aims for developer-friendliness, and your local installation should be up
If you have any questions or need help, you can join Twenty's [Discord](https://discord.gg/cx5n4Jzs57) server.
## MacOS and Linux users
It's better to use [yarn installation](/start/local-setup/yarn-setup) as this is the easiest way to get started.
But there's also an easy way to run the project with [Docker](/start/local-setup/docker-setup) that you can use if you are familiar with containerized environments.
## Windows users
Windows users can install the project through WSL2. [This guide](/start/local-setup/yarn-setup) can help you get started.
## Project structure
@ -31,10 +23,10 @@ The repository has the following structure:
```
twenty
└───packages // contains this documentation
└───twenty-front // contains the frontend code for the application
└───twenty-server // contains the backend code for the application
└───twenty-docker // contains docker configurations for development and production build
└───many other packages you are invited to discover such as twenty-docs, twenty-ui, eslint-rules, twenty-zapier...
└──────twenty-front // contains the frontend code for the application
└──────twenty-server // contains the backend code for the application
└──────twenty-docker // contains docker configurations for production build
└──────other packages that are less relevant as a first step such (docs, zapier app...)
```
## IDE Setup

View File

@ -19,8 +19,6 @@ Then delete the repository and clone it again.
## Missing metadata schema
During Twenty installation, you need to provision your postgres database with the right schemas, extensions, and users.
This documentation includes [different ways](/start/local-setup/yarn-setup#step-2-set-up-postgresql-database) to set up your postgres instance.
If you're successful in running this provisioning, you should have `default` and `metadata` schemas in your database.
If you don't, make sure you don't have more than one postgres instance running on your computer.

View File

@ -9,7 +9,6 @@ sidebar_custom_props:
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
In this document, you'll learn how to install the project using yarn. You should use this method since it's the easiest way to get started but you can also run the project with [Docker](/start/local-setup/docker-setup).
:::info
`npm` does not support local packages well, opt for `yarn` instead.

View File

@ -1,24 +0,0 @@
---
title: 1-Click Deploy
sidebar_position: 1
sidebar_custom_props:
icon: TbBolt
---
## Render
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/twentyhq/twenty)
## RepoCloud
[![Deploy on RepoCloud](https://d16t0pc4846x52.cloudfront.net/deploy.png)](https://repocloud.io/details/?app_id=259)
## Digital Ocean
Community contribution are welcome!
## Other
Please feel free to Open a PR to add more 1-Click Deploy options.

View File

@ -1,6 +1,6 @@
---
title: Cloud providers
sidebar_position: 2
title: Vendor-specific instructions
sidebar_position: 3
sidebar_custom_props:
icon: TbCloud
---
@ -10,10 +10,15 @@ This document is maintained by the community. It might contain issues.
Feel free to join our discord if you need assistance.
:::
## Available cloud providers
- [Azure Container Apps](#azure-container-apps)
- [Others](#others)
## Render
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/twentyhq/twenty)
## RepoCloud
[![Deploy on RepoCloud](https://d16t0pc4846x52.cloudfront.net/deploy.png)](https://repocloud.io/details/?app_id=259)
## Azure Container Apps

View File

@ -1,6 +1,6 @@
---
title: Docker Compose
sidebar_position: 3
title: Docker Compose (easy)
sidebar_position: 2
sidebar_custom_props:
icon: TbBrandDocker
---
@ -17,12 +17,12 @@ bash <(curl -sL https://git.new/20)
Set VERSION for a specific docker image version, BRANCH for a specific clone branch:
```bash
VERSION=x.y.z BRANCH=branch-name bash <(curl -sL https://raw.githubusercontent.com/twentyhq/twenty/main/install.sh)
VERSION=x.y.z BRANCH=branch-name bash <(curl -sL https://git.new/20)
```
## Manual installation
1. Copy the [.env.example](https://github.com/twentyhq/twenty/blob/main/packages/twenty-docker/prod/.env.example) into a `.env` in the same directory where your `docker-compose.yml` file will be
1. Copy the [.env.example](https://github.com/twentyhq/twenty/blob/main/packages/twenty-docker/.env.example) into a `.env` in the same directory where your `docker-compose.yml` file will be
2. Run the command `openssl rand -base64 32` three times, make note of the string for each
3. In your .env file, replace the three "replace_me_with_a_random_string_access" with the three random strings you just generated.
@ -33,7 +33,7 @@ REFRESH_TOKEN_SECRET=replace_me_with_a_random_string_refresh
FILE_TOKEN_SECRET=replace_me_with_a_random_string_refresh
```
4. Copy the [docker-compose.yml](https://github.com/twentyhq/twenty/blob/main/packages/twenty-docker/prod/docker-compose.yml) in the same directory as your `.env` file.
4. Copy the [docker-compose.yml](https://github.com/twentyhq/twenty/blob/main/packages/twenty-docker/docker-compose.yml) in the same directory as your `.env` file.
5. Run the command `docker-compose up -d`
6. Go to http://localhost:3000 and see your docker instance.