From 3645906953e00e9d7c90a074dce2e2cbb2230518 Mon Sep 17 00:00:00 2001 From: petra kohler <41048546+smuefsmuef@users.noreply.github.com> Date: Thu, 25 Jul 2024 21:25:28 +0200 Subject: [PATCH] DEAR-71: add docker compose setup on the db (#33) --- .github/docker-compose.yml | 42 +++++++++++++++++++++++++------------- README.md | 37 ++++++++++++++++++++++++--------- 2 files changed, 55 insertions(+), 24 deletions(-) diff --git a/.github/docker-compose.yml b/.github/docker-compose.yml index 546034a..12aa895 100644 --- a/.github/docker-compose.yml +++ b/.github/docker-compose.yml @@ -1,23 +1,34 @@ -#docker-compose for server - -#version: '3.5' +##docker-compose for server +#version: '3.9' #services: +# # frontend: # container_name: frontend # image: ghcr.io/24fsiit16/dear-dev-frontend:latest -# restart: always -# # environment: -# # - AUTH_TRUST_HOST=true -# # - NEXTAUTH_URL=00000001 +# environment: +# - NEXT_TRUST_HOST=true # ports: # - "3000:3000" - -#backend: -# container_name: backend -# image: ghcr.io/24fsiit16/dear-dev-backend:latest -# ports: -# - "8080:8080" - +# +# db: +# image: postgres:13 +# container_name: postgres_db +# environment: +# POSTGRES_USER: ${POSTGRES_USER} +# POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} +# ports: +# - "5432:5432" +# volumes: +# - postgres_data:/var/lib/postgresql/data +# +# backend: +# container_name: backend +# image: ghcr.io/24fsiit16/dear-dev-backend:latest +# ports: +# - "8080:8080" +# depends_on: +# - db +# # nginx: # container_name: nginx # image: nginx:latest @@ -27,4 +38,7 @@ # - ./nginx.conf:/etc/nginx/nginx.conf # depends_on: # - frontend +# - backend # +#volumes: +# postgres_data: diff --git a/README.md b/README.md index c403366..a8ae01d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). +This is a [Next.js](https://nextjs.org/) project bootstrapped +with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). ## Getting Started @@ -18,19 +19,35 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. -This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. +This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and +load Inter, a custom Google Font. -## Learn More +## Deploy to Server -To learn more about Next.js, take a look at the following resources: +### Make sure to replace your_password_here with your actual password (for db). -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. +echo "POSTGRES_USER=user_name_here" >> .env +echo "POSTGRES_PASSWORD=your_password_here" >> .env -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! +### Set File Permissions: Set the file permissions to restrict access: -## Deploy on Vercel +chmod 600 .env -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. +### create file & copy the docker-compose.yml from .github/workflows/docker-compose.yml into home/yappi -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. +### run container.. + +docker-compose up -d + +### stop & remove all containers + +docker stop $(docker ps -a -q) +docker rm $(docker ps -a -q) + +### remove all images + +docker rmi $(docker images -q) + +### remove all volumes + +docker volume rm $(docker volume ls -q)