This README assumes you have Docker installed. If you do not, please read this manual, based on your operating system. It will cover setting up and testing your very own Docker instance (lucky you!)
- Node:
7.0.1
- Docker:
27.3.1
- Clone the repository with
git clone https://github.com/clowder-cloud/backend.git
- Enter the cloned repository locally, typically with
cd backend
- Install all dependencies with
npm i
- Ensure your Docker instance is started by running
docker info
- Compose the Docker container with
npm run setup-db
- Copy the containers IP, which is retrieved by running
npm run get-docker-ip
Warning
If you are using Docker Desktop (primarily for Windows and MacOS), you should change HOST
to localhost
and PORT
to 54320
- Create a new
.env
file at the root of the project - Refer to the
example.env
file, replacing values where required- The
DATABASE_URL
will be constructed of values fromdocker-compose.local.yaml
and the output of previous steps.- If you have not changed any values, you can copy & paste this into your
.env
-DATABASE_URL="postgresql://root:root@HOST:5432/clowder"
and skip to step 5 POSTGRES_USER
will be ourUSERNAME
POSTGRES_PASSWORD
will be ourPASSWORD
POSTGRES_DB
will be ourDATABASE
- The IP copied from Setting up the database will be our
HOST
- If you have not changed any values, you can copy & paste this into your
- The
Warning
If at this point you get an error with connecting to the database, try changing the port in the DATABASE_URL
environment variable to 54320
- Run all of the migrations by executing
npx prisma migrate dev
- Seed the database with
npx prisma db seed
- You can check the database is migrated and seeded by running
npx prisma studio
- You can start the development server with
npm run dev
- Execute
npm run dev
. This will run thenodemon
instance, allowing for a smooth experience without having to restart the server.