Skip to content

Latest commit

 

History

History
150 lines (103 loc) · 2.46 KB

docker.md

File metadata and controls

150 lines (103 loc) · 2.46 KB

Development with Docker

Placemark was originally developed without using Docker, so the Docker configuration is a little new. Note that this docker configuration is optimized for development - we don't yet have a configuration for production.

Prepare

cp .env.example .env.local

Add your Mapbox access token in

.env.local

NEXT_PUBLIC_MAPBOX_TOKEN=YOUR_MAPBOX_ACCESS_TOKEN

Build

docker-compose build

Run

docker-compose up

Run in detached(background) mode

docker-compose up -d

Checking the logs

docker-compose logs -f

Checking logs for a web service

docker-compose logs -f web 

or

docker logs placemark-web

Checking logs for a db service

docker-compose logs -f db 

or

docker logs placemark-db

Checking logs for a prisma studio service

docker-compose logs -f prisma 

or

docker logs placemark-studio

Stopping all the services

docker-compose down

Stopping a specific service

docker-compose stop prisma

checking the database

docker-compose exec db psql -U postgres -d placemark

Running prisma studio

docker-compose exec prisma npx prisma studio

Running prisma migrate

docker-compose exec prisma npx prisma migrate dev --name init

Running prisma generate

docker-compose exec prisma npx prisma generate

Running prisma introspect

docker-compose exec prisma npx prisma db pull

Terminal access to the web service

docker-compose exec web bash

Terminal access to the db service

docker-compose exec db bash

Rebuilding and recreate the web service

docker-compose up -d --build --force-recreate web

Resarting the web service

docker-compose restart web

Note: We are not exposing the database to the host machine, so you can't connect to the database using a database client like pgAdmin or DBeaver. If you want to connect to the database, you can use the terminal access to the db service. If you want to expose the database to the host machine, you can add the following line to the db service in the docker-compose.yml file.

ports:
  - "5432:5432"