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
.envfile at the root of the project - Refer to the
example.envfile, replacing values where required- The
DATABASE_URLwill be constructed of values fromdocker-compose.local.yamland 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_USERwill be ourUSERNAMEPOSTGRES_PASSWORDwill be ourPASSWORDPOSTGRES_DBwill 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 thenodemoninstance, allowing for a smooth experience without having to restart the server.