feat: add one liner install command (#4613)
* feat: add one liner * fix: interactive issue & add support for both linux & mac * feat: move quick start documentation * feat: catch errors * feat: check if directory exists * feat: default to yes for prompt * feat: open in browser * fix: format * feat: do not expose STORAGE_LOCAL_PATH env but handle the case where it would be set * fix: db reset command wasn't working out of the box * Update install.sh Co-authored-by: Darek Desu <4459421+darekdesu@users.noreply.github.com> * feat: harden the whole UX with one-liner * fix: small logical order adjustment * Update packages/twenty-docs/docs/start/self-hosting/docker-compose.mdx --------- Co-authored-by: Darek Desu <4459421+darekdesu@users.noreply.github.com> Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
This commit is contained in:
@ -6,7 +6,23 @@ sidebar_custom_props:
|
||||
---
|
||||
# Step by step instructions:
|
||||
|
||||
1. Copy the [.env.example](https://github.com/twentyhq/twenty/blob/main/packages/twenty-server/.env.example) into a `.env` in the same directory where your `docker-compose.yml` file will be
|
||||
## One command installation
|
||||
|
||||
Install the project with the command below. By default, it installs the latest version from the main branch.
|
||||
```bash
|
||||
bash <(curl -sL https://git.new/20)
|
||||
```
|
||||
|
||||
## Custom Installation:
|
||||
|
||||
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)
|
||||
```
|
||||
|
||||
## 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
|
||||
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.
|
||||
|
||||
@ -17,78 +33,26 @@ REFRESH_TOKEN_SECRET=replace_me_with_a_random_string_refresh
|
||||
FILE_TOKEN_SECRET=replace_me_with_a_random_string_refresh
|
||||
```
|
||||
|
||||
4. Create a `docker-compose.yml` file from the example below.
|
||||
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.
|
||||
5. Run the command `docker-compose up -d`
|
||||
6. Go to http://localhost:3001 and see your docker instance.
|
||||
6. Go to http://localhost:3000 and see your docker instance.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Not able to login
|
||||
|
||||
If you encounter errors, (not able to log into the application after inputting an email) after the inital setup, try running `docker exec -it twenty-backend-1 yarn nx database:reset` and see if that solves your issue.
|
||||
If you encounter errors, (not able to log into the application after inputting an email) after the inital setup, try running the following commands and see if that solves your issue.
|
||||
```
|
||||
docker exec -it twenty-server-1 yarn
|
||||
docker exec -it twenty-server-1 yarn nx database:reset
|
||||
```
|
||||
|
||||
### Cannot connect to server, running behind a reverse proxy
|
||||
|
||||
Complete step three and four with :
|
||||
Complete step three and four with:
|
||||
|
||||
3. Add `SERVER_URL=https://<your-api-url.com>` to your `.env`
|
||||
4. Uncomment `SERVER_URL=${SERVER_URL}` in your `docker-compose.yml`
|
||||
3. Update `SERVER_URL=https://<your-api-url.com>` in your `.env`
|
||||
|
||||
## Production docker containers
|
||||
### Persistence
|
||||
|
||||
Prebuilt images for both Postgres, frontend, and back-end can be found on [docker hub](https://hub.docker.com/r/twentycrm/). Note that the Postgres container will not persist data if your server is not configured to be stateful (for example Heroku). You probably want to configure a special stateful resource for the database.
|
||||
|
||||
## Environment Variables
|
||||
|
||||
- Copy this `.env.example` file into a `.env` in the same directory as your `docker-compose.yml` file
|
||||
- Find the `.env.example` [here](https://github.com/twentyhq/twenty/blob/main/packages/twenty-server/.env.example).
|
||||
|
||||
## Docker Compose file
|
||||
|
||||
We will soon update the documentation with an up-to-date docker compose file.
|
||||
Here is one that was proposed on Discord by a community member:
|
||||
|
||||
|
||||
```yaml
|
||||
version: "3.9"
|
||||
services:
|
||||
|
||||
twenty:
|
||||
image: twentycrm/twenty-front:${TAG}
|
||||
ports:
|
||||
- 3001:3000
|
||||
environment:
|
||||
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
|
||||
- REACT_APP_SERVER_BASE_URL=${LOCAL_SERVER_URL}
|
||||
depends_on:
|
||||
- backend
|
||||
|
||||
backend:
|
||||
image: twentycrm/twenty-server:${TAG}
|
||||
ports:
|
||||
- 3000:3000
|
||||
environment:
|
||||
- SIGN_IN_PREFILLED=${SIGN_IN_PREFILLED}
|
||||
- PG_DATABASE_URL=${PG_DATABASE_URL}
|
||||
- FRONT_BASE_URL=${FRONT_BASE_URL}
|
||||
- PORT=3000
|
||||
- STORAGE_TYPE=local
|
||||
- STORAGE_LOCAL_PATH=.local-storage
|
||||
- ACCESS_TOKEN_SECRET=${ACCESS_TOKEN_SECRET}
|
||||
- LOGIN_TOKEN_SECRET=${LOGIN_TOKEN_SECRET}
|
||||
- REFRESH_TOKEN_SECRET=${REFRESH_TOKEN_SECRET}
|
||||
- FILE_TOKEN_SECRET=${FILE_TOKEN_SECRET}
|
||||
# Uncomment if behind a reverse proxy
|
||||
# - SERVER_URL=${SERVER_URL}
|
||||
depends_on:
|
||||
- db
|
||||
|
||||
db:
|
||||
image: twentycrm/twenty-postgres:${TAG}
|
||||
volumes:
|
||||
- twenty-db-data:/bitnami/postgresql
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=${POSTGRES_ADMIN_PASSWORD}
|
||||
volumes:
|
||||
twenty-db-data:
|
||||
```
|
||||
By default the docker-compose will create volumes for the Database and local storage of the Server. Note that the containers will not persist data if your server is not configured to be stateful (for example Heroku). You probably want to configure a special stateful resource for this purpose.
|
||||
|
||||
Reference in New Issue
Block a user