Merge pull request #5 from useplunk/dev-driaug-local-environment
Added instructions and better setup for local development
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
You can greatly support Plunk by contributing to this repository.
|
||||||
|
|
||||||
|
Support can be asked in the `#contributions` channel of the [Plunk Discord server](https://useplunk.com/discord)
|
||||||
|
|
||||||
|
### 1. Requirements
|
||||||
|
|
||||||
|
- Docker needs to be [installed](https://docs.docker.com/engine/install/) on your system.
|
||||||
|
|
||||||
|
### 2. Set your environment variables
|
||||||
|
|
||||||
|
- Copy the `.env.example` files in the `api`, `dashboard` and `prisma` folder to `.env` in their respective folders.
|
||||||
|
|
||||||
|
### 3. Start resources
|
||||||
|
- Run `yarn services:up` to start a local database and a local redis server.
|
||||||
|
- Run `yarn migrate` to apply the migrations to the database.
|
||||||
|
- Run `yarn build:shared` to build the shared package.
|
||||||
|
|
||||||
|
|
||||||
|
- Run `yarn dev:api` to start the API server.
|
||||||
|
- Run `yarn dev:dashboard` to start the dashboard server.
|
||||||
|
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
version: '3'
|
||||||
|
services:
|
||||||
|
db:
|
||||||
|
image: postgres
|
||||||
|
ports:
|
||||||
|
- 55432:5432
|
||||||
|
environment:
|
||||||
|
POSTGRES_PASSWORD: postgres
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_DB: postgres
|
||||||
|
|
||||||
|
redis:
|
||||||
|
image: redis
|
||||||
|
ports:
|
||||||
|
- 56379:6379
|
||||||
+4
-4
@@ -4,9 +4,7 @@
|
|||||||
"private": true,
|
"private": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"workspaces": {
|
"workspaces": {
|
||||||
"packages": [
|
"packages": ["packages/*"]
|
||||||
"packages/*"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"npm": ">=6.14.x",
|
"npm": ">=6.14.x",
|
||||||
@@ -33,6 +31,8 @@
|
|||||||
"preinstall": "node tools/preinstall.js",
|
"preinstall": "node tools/preinstall.js",
|
||||||
"migrate": "prisma migrate dev",
|
"migrate": "prisma migrate dev",
|
||||||
"migrate:deploy": "prisma migrate deploy",
|
"migrate:deploy": "prisma migrate deploy",
|
||||||
"generate": "prisma generate"
|
"generate": "prisma generate",
|
||||||
|
"services:up": "docker compose -f docker-compose.dev.yml up -d",
|
||||||
|
"services:down": "docker compose -f docker-compose.dev.yml down"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { type NextFunction, type Request, type Response, json } from "express";
|
|||||||
import helmet from "helmet";
|
import helmet from "helmet";
|
||||||
import morgan from "morgan";
|
import morgan from "morgan";
|
||||||
import signale from "signale";
|
import signale from "signale";
|
||||||
import { API_URI, NODE_ENV } from "./app/constants";
|
import { APP_URI, NODE_ENV } from "./app/constants";
|
||||||
import { task } from "./app/cron";
|
import { task } from "./app/cron";
|
||||||
import { Auth } from "./controllers/Auth";
|
import { Auth } from "./controllers/Auth";
|
||||||
import { Identities } from "./controllers/Identities";
|
import { Identities } from "./controllers/Identities";
|
||||||
@@ -53,7 +53,7 @@ const server = new (class extends Server {
|
|||||||
|
|
||||||
this.app.use(
|
this.app.use(
|
||||||
cors({
|
cors({
|
||||||
origin: [API_URI],
|
origin: [APP_URI],
|
||||||
credentials: true,
|
credentials: true,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const NODE_ENV = validateEnv<"development" | "production">(
|
|||||||
export const REDIS_URL = validateEnv("REDIS_URL");
|
export const REDIS_URL = validateEnv("REDIS_URL");
|
||||||
|
|
||||||
// URLs
|
// URLs
|
||||||
export const API_URI = validateEnv("API_URI", "http://localhost:8080");
|
export const API_URI = validateEnv("API_URI", "http://localhost:4000");
|
||||||
export const APP_URI = validateEnv("APP_URI", "http://localhost:3000");
|
export const APP_URI = validateEnv("APP_URI", "http://localhost:3000");
|
||||||
|
|
||||||
// AWS
|
// AWS
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
|
DATABASE_URL=postgresql://postgres:postgres@localhost:55432/postgres
|
||||||
Reference in New Issue
Block a user