Skip to content

Commit

Permalink
Refresh install scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesBochet committed Apr 5, 2023
1 parent eac43d1 commit dc28c97
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 47 deletions.
22 changes: 9 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ Twenty development stack is composed of 3 different layers
- server: our backend that contain endpoint, crm logic, scripts, jobs...
- storages: postgres

## Development environment setup with npm (Alternative 1)
## Setup env variables

1. `cp ./infra/dev/.front.env.example ./front/.env` and fill with values

## Development environment setup with npm (Not recommended)

This is the easiest way to get started contributing to twenty
Make sure you have `node@18` installed on your machine. You can use `nvm` to manage your nvm versions in case you have projects that require different node versions.

`npm install`
`npm start`
`npm run install-dev`
`npm run front`

You'll need to provide your own postgres storage.

Expand All @@ -24,12 +28,12 @@ Once this is completed you should have:
- server available on: http://localhost:3000/health


## Development environment setup with docker-compose (Alternative 2)
## Development environment setup with docker-compose (Recommended)

We also provide a containerized environment with Docker and orchestrated with docker-compose in case it is easier for you. This install will also provision a postgres container out of the box.

### Step 1: pre-requesites
Make sure to have the latest Docker and Docker-compose versions installed on your computer.
Make sure to have the latest Docker and Docker-compose versions installed on your computer. You can run `docker-compose --version` to check if you have docker-compose installed and `docker --version` to check if you have docker installed.

### Step 2: docker build
Build docker containers.
Expand All @@ -48,14 +52,6 @@ Once this is completed you should have:
- server available on: http://localhost:3000/health
- postgres: available on http://localhost:5432 that should contain `twenty` database

### Step 3: environment file
Configure your environment by copying the `.env.example` file located in `infra/dev` folder into `.env`.
```
cp infra/dev/.env.example infra/dev/.env
```

Then, you'll need to replace all REPLACE_ME variable by their development value. Please reach out to another engineer to get these values (as most of them are third party credentials, sensitive data)

### Note

If you are using Docker install, make sure to ssh in the docker container during development to execute commands. You can also use `Makefile` to help you
Expand Down
2 changes: 1 addition & 1 deletion front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "cp ../infra/dev/.env ./.env && PORT=3001 react-scripts start",
"start": "PORT=3001 react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
Expand Down
File renamed without changes.
12 changes: 8 additions & 4 deletions infra/dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ services:
- "3001:3001"
- "6006:6006"
volumes:
- ../../front:/app/front
- ../../server:/app/server
- ../../infra:/app/infra
- ../..:/app
- twenty_node_modules_root:/app/node_modules
- twenty_node_modules_front:/app/front/node_modules
- twenty_node_modules_server:/app/server/node_modules
depends_on:
- postgres
postgres:
Expand All @@ -23,4 +24,7 @@ services:
ports:
- "5432:5432"
volumes:
db_data:
db_data:
twenty_node_modules_root:
twenty_node_modules_front:
twenty_node_modules_server:
8 changes: 1 addition & 7 deletions infra/dev/twenty/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ FROM node:18-alpine as app
WORKDIR /app
COPY ../.. .

WORKDIR /app/front
RUN npm install

WORKDIR /app/server
RUN npm install

WORKDIR /app
RUN npm run install-dev

CMD ["npm", "run", "start"]
Loading

0 comments on commit dc28c97

Please sign in to comment.