-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from hack4impact-mcgill/backend/feature/dockerize
feat: dockerize the backend
- Loading branch information
Showing
14 changed files
with
113 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Environment variables declared in this file are automatically made available to Prisma. | ||
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema | ||
|
||
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB. | ||
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings | ||
|
||
DATABASE_URL="postgresql://johndoe:randompassword@localhost:5432/mydb?schema=public" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
node_modules | ||
build/ | ||
*.db | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Greenpeace Backend | ||
|
||
## Overview | ||
The frontend of the application will serve the maps UI by accessing the Google Maps API and rendering the result using React, with additional components from Material UI. Our complete (frontend) tech stack is: | ||
- Express.js | ||
- Prisma | ||
|
||
|
||
## Setup | ||
|
||
To create the `.env` file, copy the `.env.example` file, make sure you are in the `backend` folder and run the following: | ||
``` | ||
cp .env.example .env | ||
``` | ||
|
||
Next, start the Docker Compose services, use the command: | ||
|
||
``` | ||
docker-compose up | ||
``` | ||
|
||
|
||
--- | ||
|
||
|
||
Feel free to add any issue in this file, or let the leads know! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM node:lts | ||
|
||
RUN mkdir -p /app/ | ||
|
||
COPY . /app/ | ||
|
||
WORKDIR /app/ | ||
|
||
EXPOSE 3000 | ||
|
||
RUN npm install | ||
|
||
CMD ["npm", "run", "debug:watch"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
10 changes: 0 additions & 10 deletions
10
api/src/prisma/migrations/20231018232930_added_pin/migration.sql
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
api/src/prisma/migrations/20231116001224_fix_misspelling_of_is_valid/migration.sql
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
api/src/prisma/migrations/20240131234713_initial_pin/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
-- CreateEnum | ||
CREATE TYPE "Reaction" AS ENUM ('LIKE', 'DISLIKE', 'GOOD_VALUE', 'BAD_VALUE'); | ||
|
||
-- CreateTable | ||
CREATE TABLE "Pin" ( | ||
"id" SERIAL NOT NULL, | ||
"name" TEXT NOT NULL, | ||
"description" TEXT NOT NULL, | ||
"coordinateX" DOUBLE PRECISION NOT NULL, | ||
"coordinateY" DOUBLE PRECISION NOT NULL, | ||
"isValid" BOOLEAN NOT NULL DEFAULT true, | ||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP, | ||
"category" TEXT NOT NULL DEFAULT '', | ||
"reactions" "Reaction"[], | ||
|
||
CONSTRAINT "Pin_pkey" PRIMARY KEY ("id") | ||
); |
12 changes: 12 additions & 0 deletions
12
api/src/prisma/migrations/20240131235715_convert_reactions_to_string/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
Warnings: | ||
- The `reactions` column on the `Pin` table would be dropped and recreated. This will lead to data loss if there is data in the column. | ||
*/ | ||
-- AlterTable | ||
ALTER TABLE "Pin" DROP COLUMN "reactions", | ||
ADD COLUMN "reactions" TEXT[]; | ||
|
||
-- DropEnum | ||
DROP TYPE "Reaction"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Please do not edit this file manually | ||
# It should be added in your version-control system (i.e. Git) | ||
provider = "sqlite" | ||
provider = "postgresql" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,8 +6,8 @@ generator client { | |
} | ||
|
||
datasource db { | ||
provider = "sqlite" | ||
url = "file:app.db" | ||
provider = "postgresql" | ||
url = "postgresql://[email protected]:5432/greenpeace" | ||
} | ||
|
||
model Pin { | ||
|
@@ -16,6 +16,8 @@ model Pin { | |
description String | ||
coordinateX Float | ||
coordinateY Float | ||
isValid Boolean @default(true) | ||
isValid Boolean @default(true) | ||
createdAt DateTime @default(now()) | ||
category String @default("") | ||
reactions String[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
version: "3.8" | ||
|
||
services: | ||
database: | ||
image: postgres | ||
container_name: greenpeace-postgres | ||
ports: | ||
- 5432:5432 | ||
volumes: | ||
- greenpeace-postgres-data:/var/lib/postgresql/data/ | ||
environment: | ||
- POSTGRES_USER=greenpeace | ||
- POSTGRES_PASSWORD=greenpeace | ||
- POSTGRES_DATABASE=greenpeace | ||
restart: unless-stopped | ||
api: | ||
build: api/ | ||
container_name: greenpeace-api | ||
ports: | ||
- 3000:3000 | ||
volumes: | ||
- ./api/:/app/ | ||
environment: | ||
- DATABASE_URL=postgresql://greenpeace:[email protected]:5432/greenpeace | ||
restart: unless-stopped | ||
|
||
volumes: | ||
greenpeace-postgres-data: |