-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 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,4 @@ | ||
# Dockerfile for docker compose | ||
FROM node:18 | ||
|
||
RUN npm i -g nx |
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,31 @@ | ||
# DoCSoc Collection System | ||
|
||
This is a Next.js Application that allows us to manage merchandise collections securely. Designed to be ran as a docker container with a Postgres DB. | ||
|
||
Once deployed, it allows us to control committee member access, import items from eActivities CSV exports, and mark item as collected. | ||
|
||
# Why no `package.json`? | ||
|
||
This folder has no package.json as it means we can share the same `package.json` as the rest of the monorepo. This means we can share dependencies like React and scripts across all app, rather than having to maintain multiple `package.json` files and React versions, etc. | ||
|
||
Other tools have their own package.jsons as that was how they were originally set up. | ||
|
||
# Quick Start | ||
|
||
## Local | ||
|
||
1. From the root of the repo run `npm install` | ||
2. Copy `.env.local.template` to `.env.local` and fill in the details | ||
3. Run from this dir `npx nx prisma-push` to create the database | ||
4. Run from this dir `npx nx dev` to start the dev server | ||
|
||
## Docker | ||
|
||
1. Copy `.env.local.template` to `.env.local` and fill in the details | ||
2. From the current dir (`collection`) run `docker compose -f dev.docker-compose.yml up`. This start a dev docker compose instance that has the source code _mounted_ into it: meaning you need not rebuild the docker image every time you make a change! | ||
3. Visit `http://localhost:3000` in your browser and login with the root user you setu in the `.env.local` file | ||
4. To run future DB migrations in docker compose run `docker exec -i $(docker ps -qf "name=docsoc-collection" | head -n1) npx nx prisma-migrate collection --name migration-name` | ||
|
||
# Docker | ||
|
||
To build the docker image, run `npx nx container collection` from the _root_ of the repo. |
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,36 @@ | ||
services: | ||
docsoc-collection: | ||
image: docsoc/collection-dev | ||
pull_policy: never | ||
build: | ||
context: . | ||
dockerfile: Dockerfile.dev | ||
depends_on: | ||
- docsoc-database | ||
environment: | ||
- NODE_ENV=development | ||
- COLLECTION_DATABASE_URL=postgres://user:pass@docsoc-database:5432/docsoc | ||
env_file: .env.local | ||
ports: | ||
- "3000:3000" | ||
volumes: | ||
- ..:/app | ||
working_dir: /app | ||
command: | ||
- bash | ||
- -c | ||
- ./collection/scripts/compose-entry.sh | ||
|
||
docsoc-database: | ||
image: postgres:16 | ||
environment: | ||
- POSTGRES_USER=user | ||
- POSTGRES_PASSWORD=pass | ||
- POSTGRES_DB=docsoc | ||
ports: | ||
- "5432:5432" | ||
volumes: | ||
- database-data:/var/lib/postgresql/data | ||
|
||
volumes: | ||
database-data: |
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,2 @@ | ||
npx nx prisma-deploy collection --dev | ||
npx nx run collection:dev |