mirror of
https://github.com/lingble/twenty.git
synced 2025-11-01 21:27:58 +00:00
Merge pull request #40 from twentyhq/fix-dev-env
bugfix: sync server files in server container
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.vscode/*
|
||||
**/**/.env
|
||||
**/**/.npmrc
|
||||
.DS_Store
|
||||
|
||||
12
README.md
12
README.md
@@ -5,26 +5,31 @@ Welcome to Twenty documentation!
|
||||
## High Level Overview
|
||||
|
||||
Twenty development stack is composed of 3 different layers
|
||||
|
||||
- front: our frontend React app
|
||||
- hasura: our graphql engine exposing our database and server
|
||||
- server: our backend that contain endpoint, crm logic, scripts, jobs...
|
||||
- storages: postgres
|
||||
|
||||
## Setup env variables
|
||||
## Setup env variables and npmrc variables
|
||||
|
||||
1. `cp ./infra/dev/.front.env.example ./front/.env` and fill with values
|
||||
1. `cp ./front/.env.example ./front/.env` and fill with values
|
||||
2. `cp ./front/.npmrc.example ./front/.npmrc` and fill with values
|
||||
|
||||
## 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. 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.
|
||||
|
||||
The whole setup experience is happening in `infra/dev` folder. Make sure to be in this folder:
|
||||
|
||||
```
|
||||
cd infra/dev
|
||||
```
|
||||
@@ -34,6 +39,7 @@ make build
|
||||
```
|
||||
|
||||
Once this is completed you should have:
|
||||
|
||||
- front available on: http://localhost:3001
|
||||
- hasura available on: http://localhost:8080
|
||||
- server available on: http://localhost:3000/health
|
||||
@@ -41,7 +47,7 @@ Once this is completed you should have:
|
||||
|
||||
### Step 3: IDE setup
|
||||
|
||||
If you are using VSCode, please use the `Dev Containers` extension to open the project in a container. This will allow you to run Visual Studio on top of the docker container. This will allow you to run the project without having to install node on your machine.
|
||||
If you are using VSCode, please use the `Dev Containers` extension to open the project in a container. This will allow you to run Visual Studio on top of the docker container. This will allow you to run the project without having to install node on your machine.
|
||||
|
||||
### Note
|
||||
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
REACT_APP_API_URL=http://localhost:3000
|
||||
FONTAWESOME_NPM_AUTH_TOKEN=REPLACE_ME
|
||||
REACT_APP_API_URL=http://localhost:3000
|
||||
@@ -1,2 +0,0 @@
|
||||
@fortawesome:registry=https://npm.fontawesome.com/
|
||||
//npm.fontawesome.com/:_authToken=${FONTAWESOME_NPM_AUTH_TOKEN}
|
||||
2
front/.npmrc.example
Normal file
2
front/.npmrc.example
Normal file
@@ -0,0 +1,2 @@
|
||||
@fortawesome:registry=https://npm.fontawesome.com/
|
||||
//npm.fontawesome.com/:_authToken=REPLACE_ME
|
||||
@@ -1,5 +1,8 @@
|
||||
build: ##
|
||||
@docker-compose up --build --force-recreate
|
||||
@docker-compose down
|
||||
docker volume rm dev_twenty_node_modules_front || true
|
||||
docker volume rm dev_twenty_node_modules_server || true
|
||||
docker-compose build
|
||||
|
||||
up: ##
|
||||
@docker-compose up -d
|
||||
|
||||
@@ -36,7 +36,7 @@ services:
|
||||
ports:
|
||||
- "3000:3000"
|
||||
volumes:
|
||||
- ../../front:/app/front
|
||||
- ../../server:/app/server
|
||||
- twenty_node_modules_server:/app/server/node_modules
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
FROM node:18-alpine as front
|
||||
FROM node:18.16.0-alpine as front
|
||||
|
||||
RUN apk update && apk upgrade && \
|
||||
apk add --no-cache bash git openssh && \
|
||||
apk add libc6-compat
|
||||
|
||||
WORKDIR /app/front
|
||||
COPY ../../front .
|
||||
|
||||
RUN export $(xargs <.env)
|
||||
COPY ../../front/package.json .
|
||||
COPY ../../front/package-lock.json .
|
||||
COPY ../../front/.npmrc .
|
||||
RUN npm install
|
||||
|
||||
COPY ../../front .
|
||||
|
||||
CMD ["npm", "run", "start"]
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
FROM node:18-alpine as server
|
||||
FROM node:18.16.0-alpine as server
|
||||
|
||||
RUN apk update && apk upgrade && \
|
||||
apk add --no-cache bash git openssh && \
|
||||
apk add libc6-compat
|
||||
|
||||
WORKDIR /app/server
|
||||
COPY ../../server .
|
||||
|
||||
COPY ../../server/package.json .
|
||||
COPY ../../server/package-lock.json .
|
||||
RUN npm install
|
||||
|
||||
CMD ["npm", "run", "start"]
|
||||
COPY ../../server .
|
||||
|
||||
|
||||
CMD ["npm", "run", "start"]
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM node:18-alpine as front
|
||||
FROM node:18.16.0-alpine as front
|
||||
|
||||
ARG FONTAWESOME_NPM_AUTH_TOKEN
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM node:18-alpine as server
|
||||
FROM node:18.16.0-alpine as server
|
||||
|
||||
COPY ./server/package.json ./
|
||||
COPY ./server/package-lock.json ./
|
||||
|
||||
Reference in New Issue
Block a user