Cade-Zamora is a simple CRUD app built with:
- nextjs
- prisma
It has integrations with:
- postgreSQL: database
- minio: s3 storage for images upload
The figma file that had the design of this app can be viewed here: https://www.figma.com/file/rR1x0r8RwQARn2dR3abj1A/Untitled?node-id=0%3A1&t=s7VSJbrc12zI4WEA-1
In order to deploy the app in your docker environment, you will need the following installed:
- docker
- docker compose
You can then create a docker-compose.yaml
similar to the one found at the root of the repository here.
finally, run the following command in the terminal at where you created the docker-compose.yaml
file:
docker compose up -d
if docker compose
is an unrecognized command in your system, then you are probably using the older version of docker compose. You can use this command instead:
docker-compose up -d
Build the image
docker build -t eriexn/cade-zamora:latest .
The development environment expects that you have the following installed:
- NodeJs
- yarn
- docker
- git
start with cloning the repository. You can use your desired git tool, or run the following command:
git clone https://github.com/riexn/cade-zamora.git
yarn
The .env
has values for the database connection and the node environment we're running. Initialize your file with the following:
DATABASE_URL="postgresql://postgres:postgres@localhost:5444/mydb?schema=public"
MINIO_ENDPOINT="localhost"
MINIO_PORT="9000"
MINIO_ROOT_PASSWORD="minio-root-password"
MINIO_ROOT_USER="minio-root-user"
NODE_ENV="development"
NEXT_PUBLIC_MINIO_URL="http://localhost:9000"
yarn s3:up
This will a container with Minio in it, it will use the ports 9000 and 9001.
if your system already has the ports
9000
or9001
in use, then you will need to follow this guide.
yarn db:up
This will start a container with postgres 13.6 in it. It will use port 5444
.
if your system already has the port
5444
in use, then you will need to follow this guide.
yarn dx
This command will:
- reset the database
- initialize prisma
- seed the database with random data
- reset minio storage
Use this command whenever you want the app to go back to the "initial state".
yarn dev
It will start the app on http://localhost:3000
Our development database, which can be brought with the command yarn db:up
will run at the port 5444
. If your system already has that port in use, or if you want to change it, then you will need to change two files.
version: '3'
services:
db:
image: postgres:13.6
restart: always
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: mydb
ports:
- 5444:5432
#👆 change this value
volumes:
- db-data:/var/lib/postgresql/data
volumes:
db-data:
Note that the .env file is something you would have created by following the development guide.
DATABASE_URL="postgresql://postgres:postgres@localhost:5444/mydb?schema=public"
#👆 change this value
Our development s3 storage, which can be brought with the command yarn s3:up
will run at the ports 9000
for the api and 9001
for the WebUI. If your system already has those port in use, or if you want to change them, then you will need to change two files.
version: '3'
services:
s3:
image: bitnami/minio:latest
ports:
- '9000:9000'
#👆 change this value for the api
- '9001:9001'
#👆 change this value for the webui
environment:
- MINIO_ROOT_USER=minio-root-user
- MINIO_ROOT_PASSWORD=minio-root-password
- MINIO_SERVER_ACCESS_KEY=minio-access-key
- MINIO_SERVER_SECRET_KEY=minio-secret-key
- MINIO_DEFAULT_BUCKETS=images
MINIO_PORT="9000"
#👆 change this value to match the one you have set for the api port