Skip to content

papinashvilisergi/stayconnected

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

54 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“ก StayConnected: Full-Stack Application

๐Ÿš€ Frontend: React (Vite)
โš™๏ธ Backend: Django (Gunicorn)
๐Ÿ“Š Monitoring: Prometheus
๐Ÿ”„ CI/CD: GitHub Actions

StayConnected is a full-stack web application powered by React and Django. It supports containerized deployment using Docker and features a robust monitoring system with Prometheus. This guide covers how to run the application both with and without Docker.


โš™๏ธ Technologies Used

Component Technology
Frontend React (Vite) - API-based
Backend Django (Gunicorn) - API-based
Database PostgreSQL
Proxy Nginx
Containerization Docker & Docker Compose
Monitoring Prometheus
CI/CD GitHub Actions

๐Ÿš€ Project Setup Instructions

1๏ธโƒฃ Without Docker

If you prefer to run the project without Docker, follow these instructions:

๐Ÿ–ฅ๏ธ Backend Setup

  1. Create a virtual environment
    python3 -m venv venv
    
    

1๏ธโƒฃ แƒ•แƒ˜แƒ แƒขแƒฃแƒแƒšแƒฃแƒ แƒ˜ แƒ’แƒแƒ แƒ”แƒ›แƒแƒก แƒจแƒ”แƒฅแƒ›แƒœแƒ

python3 -m venv venv

2๏ธโƒฃ แƒ•แƒ˜แƒ แƒขแƒฃแƒแƒšแƒฃแƒ แƒ˜ แƒ’แƒแƒ แƒ”แƒ›แƒแƒก แƒแƒฅแƒขแƒ˜แƒ•แƒแƒชแƒ˜แƒ

source venv/bin/activate

3๏ธโƒฃ Upgrade pip (optional, but recommended)

pip install --upgrade pip

4๏ธโƒฃ Install dependencies

pip install -r requirements.txt

5๏ธโƒฃ แƒ›แƒ˜แƒ’แƒ แƒแƒชแƒ˜แƒ”แƒ‘แƒ˜แƒก แƒจแƒ”แƒฅแƒ›แƒœแƒ แƒ“แƒ แƒ“แƒแƒ“แƒแƒกแƒขแƒฃแƒ แƒ”แƒ‘แƒ

python manage.py makemigrations python manage.py migrate

6๏ธโƒฃ Run the Django development server

python manage.py runserver ๐Ÿ–ฅ๏ธ Frontend Setup bash Copy code

1๏ธโƒฃ Navigate to the frontend directory

cd frontend

2๏ธโƒฃ Install Node.js dependencies

npm install

3๏ธโƒฃ Run the Vite development server

npm run dev Once running, visit:

แƒคแƒ แƒแƒœแƒขแƒ˜แƒก แƒ‘แƒ›แƒฃแƒšแƒ˜: http://localhost:8080 แƒ‘แƒ”แƒฅแƒ˜แƒก แƒ‘แƒ›แƒฃแƒšแƒ˜: http://localhost:8000 2๏ธโƒฃ แƒ“แƒแƒ™แƒ”แƒ แƒ˜แƒ— แƒ’แƒแƒจแƒ•แƒ”แƒ‘แƒ˜แƒก แƒ˜แƒœแƒกแƒขแƒ แƒฃแƒฅแƒชแƒ˜แƒ Run frontend, backend, Nginx, and PostgreSQL services using Docker Compose.

๐Ÿš€ แƒกแƒ แƒฃแƒšแƒ˜ แƒ“แƒแƒ™แƒ”แƒ แƒ˜แƒ— แƒ’แƒแƒจแƒ•แƒ”แƒ‘แƒ˜แƒก แƒ˜แƒœแƒกแƒขแƒ แƒฃแƒฅแƒชแƒ˜แƒ Run the following commands from the root project directory (stayconnected/).

1๏ธโƒฃ Stop and clean up any previous containers, volumes, and networks แƒ’แƒแƒ›แƒแƒ แƒ—แƒ”แƒ— แƒ“แƒ แƒฌแƒแƒจแƒแƒšแƒ”แƒ— แƒฌแƒ˜แƒœแƒ แƒ™แƒแƒœแƒขแƒ”แƒ˜แƒœแƒ”แƒ แƒ”แƒ‘แƒ˜, แƒ•แƒแƒšแƒฃแƒ›แƒ”แƒ‘แƒ˜ แƒ“แƒ แƒฅแƒกแƒ”แƒšแƒ”แƒ‘แƒ˜

docker compose down --volumes --remove-orphans

2๏ธโƒฃ Build Docker images for backend, frontend, and other services แƒ“แƒแƒ™แƒ”แƒ  แƒ˜แƒ›แƒ˜แƒฏแƒ˜แƒก แƒ“แƒแƒ‘แƒ˜แƒšแƒ“แƒ•แƒ แƒ‘แƒ”แƒฅแƒ˜แƒกแƒ—แƒ•แƒ˜แƒก, แƒคแƒ แƒแƒœแƒขแƒ˜แƒกแƒ—แƒ•แƒ˜แƒก แƒ“แƒ แƒกแƒฎแƒ•แƒ แƒกแƒ”แƒ แƒ•แƒ˜แƒกแƒ”แƒ‘แƒ˜แƒกแƒ—แƒ•แƒ˜แƒก

docker compose build

3๏ธโƒฃ Start the Docker containers in detached mode แƒ“แƒแƒ™แƒ”แƒ แƒ˜แƒก แƒ™แƒแƒœแƒขแƒ”แƒ˜แƒœแƒ”แƒ แƒ˜แƒก แƒ’แƒแƒจแƒ•แƒ”แƒ‘แƒ แƒ“แƒ”แƒขแƒแƒฉแƒ“ แƒ›แƒแƒฃแƒ“แƒจแƒ˜.

docker compose up -d ๐Ÿ” แƒšแƒแƒ’แƒ˜แƒ แƒ”แƒ‘แƒ แƒ™แƒแƒœแƒขแƒ”แƒ˜แƒœแƒ”แƒ แƒ”แƒ‘แƒ˜แƒก แƒšแƒแƒ’แƒ”แƒ‘แƒ˜แƒก แƒกแƒแƒœแƒแƒฎแƒแƒ•แƒแƒ“:

docker logs backend_container docker logs frontend_container docker logs nginx_container docker logs postgres_db ๐Ÿ“œ แƒ›แƒแƒœแƒแƒชแƒ”แƒ›แƒ—แƒ แƒ‘แƒแƒ˜แƒก แƒ›แƒ˜แƒ’แƒ แƒแƒชแƒ˜แƒ”แƒ‘แƒ˜แƒก แƒ’แƒแƒจแƒ•แƒ”แƒ‘แƒ docker exec backend_container python manage.py makemigrations docker exec backend_container python manage.py migrate ๐Ÿ—๏ธ Create Superuser (Optional)

docker exec -it backend_container python manage.py createsuperuser ๐Ÿ’ก Note: These commands should be run in the root folder (stayconnected/) where the docker-compose.yml file is located.

๐Ÿงช แƒขแƒ”แƒกแƒขแƒ˜แƒ แƒ”แƒ‘แƒ Run the following commands to check that everything is running smoothly.

docker logs backend_container docker logs frontend_container docker logs nginx_container docker logs postgres_db If the backend is working, you should see:

แƒ‘แƒ”แƒฅแƒ˜: http://localhost:8000/admin/ แƒคแƒ แƒแƒœแƒขแƒ˜: http://localhost:8080 Full App (via Nginx): http://localhost/ ๐ŸŒ CI/CD with GitHub Actions This project includes a GitHub Actions CI/CD pipeline.
Whenever you push to the main branch, the following tasks are triggered:

โœ… แƒ‘แƒ˜แƒšแƒ“แƒ˜ แƒ“แƒ แƒขแƒ”แƒกแƒขแƒ˜แƒ แƒ”แƒ‘แƒ: แƒ•แƒ แƒฌแƒ›แƒฃแƒœแƒ“แƒ”แƒ‘แƒ˜แƒ— แƒ แƒแƒ› แƒžแƒ แƒแƒ”แƒฅแƒขแƒ˜ แƒ”แƒจแƒ•แƒ”แƒ‘แƒ แƒฎแƒแƒ แƒ•แƒ”แƒ–แƒ”แƒ‘แƒ˜แƒก แƒ’แƒแƒ แƒ”แƒจแƒ” โœ… Lint แƒขแƒ”แƒกแƒขแƒ”แƒ‘แƒ˜: แƒ™แƒแƒ“แƒ˜ แƒ˜แƒšแƒ˜แƒœแƒขแƒ”แƒ‘แƒ แƒ“แƒ”แƒคแƒšแƒแƒ˜แƒ›แƒ”แƒœแƒขแƒแƒ›แƒ“แƒ” โœ… Run แƒขแƒ”แƒกแƒขแƒ”แƒ‘แƒ˜: แƒ•แƒ แƒฌแƒ›แƒฃแƒœแƒ“แƒ”แƒ‘แƒ˜แƒ— แƒ แƒแƒ› แƒแƒ แƒชแƒ”แƒ แƒ—แƒ˜ แƒฎแƒแƒ แƒ•แƒ”แƒ–แƒ˜ แƒแƒ แƒแƒ แƒžแƒ แƒแƒ“แƒแƒฅแƒจแƒ”แƒœแƒ–แƒ” แƒ’แƒแƒจแƒ•แƒ”แƒ‘แƒแƒ›แƒ“แƒ”

แƒกแƒแƒญแƒ˜แƒ แƒ แƒ™แƒแƒ›แƒแƒœแƒ“แƒ”แƒ‘แƒ˜: git pull git add . git commit -m "Deploy new changes" git push origin main You can find the GitHub Actions workflow in .github/workflows/ci.yml. docker ps See all running containers docker logs backend_container View backend container logs docker exec -it backend_container bash Shell access into backend container docker compose down Stop all Docker containers docker compose up -d Start all services in detached mode python manage.py createsuperuser Create an admin superuser ๐Ÿ“„ License This project is licensed under the MIT License. See the LICENSE file for details.

๐Ÿ™ แƒ™แƒแƒœแƒขแƒ แƒ˜แƒ‘แƒฃแƒขแƒแƒ แƒ”แƒ‘แƒ˜ D DevOps - แƒกแƒ”แƒ แƒ’แƒ˜ แƒžแƒแƒžแƒ˜แƒœแƒแƒจแƒ•แƒ˜แƒšแƒ˜, แƒ’แƒ˜แƒ•แƒ˜ แƒจแƒแƒคแƒแƒฅแƒ˜แƒซแƒ” Team Developers >>> React แƒกแƒแƒคแƒ˜แƒ™แƒ แƒ˜แƒ›แƒœแƒแƒ˜แƒจแƒ•แƒ˜แƒšแƒ˜ (TEAM LEAD) React แƒแƒœแƒ แƒŸแƒฃแƒŸแƒฃแƒœแƒแƒจแƒ•แƒ˜แƒšแƒ˜ React แƒ—แƒแƒ แƒœแƒ˜แƒ™แƒ” แƒกแƒแƒ›แƒฎแƒแƒ แƒแƒซแƒ” React แƒ“แƒแƒ•แƒ˜แƒ— แƒœแƒแƒœแƒแƒ•แƒ Python advance แƒ’แƒ”แƒ’แƒ แƒ—แƒ•แƒแƒ แƒแƒซแƒ” Python advance แƒ’แƒ˜แƒแƒ แƒ’แƒ˜ แƒ›แƒแƒ˜แƒกแƒฃแƒ แƒแƒซแƒ” iOS แƒกแƒแƒœแƒ“แƒ แƒ แƒ›แƒแƒ แƒแƒœแƒ”แƒšแƒ˜ iOS แƒ˜แƒšแƒ˜แƒ™แƒ แƒ™แƒฃแƒ™แƒแƒ•แƒ

โญ แƒคแƒ˜แƒ“แƒ‘แƒ”แƒฅแƒ”แƒ‘แƒ˜ If you have any issues or questions, feel free to create a GitHub issue or submit a pull request.

This README.md is a comprehensive guide to help you set up, run, and troubleshoot the StayConnected project. Let me know if you'd like any edits, improvements, or additional details! ๐Ÿš€

แƒขแƒ”แƒฅแƒกแƒขแƒฃแƒ แƒ˜ แƒ˜แƒœแƒกแƒขแƒ แƒฃแƒฅแƒชแƒ˜แƒ”แƒ‘แƒ˜:

stayconnected

แƒคแƒ แƒแƒœแƒขแƒ”แƒœแƒ“แƒ˜ - React แƒ‘แƒ”แƒฅแƒ”แƒœแƒ“แƒ˜ - Django แƒ›แƒแƒœแƒ˜แƒขแƒแƒ แƒ˜แƒœแƒ’แƒ˜ - Prometheus CI/CD - Github Actions

แƒžแƒ แƒแƒ”แƒฅแƒขแƒ˜แƒก แƒ’แƒแƒกแƒแƒจแƒ•แƒ”แƒ‘แƒแƒ— แƒกแƒแƒญแƒ˜แƒ แƒแƒ แƒคแƒ แƒแƒœแƒขแƒ–แƒ” แƒ“แƒ แƒ‘แƒ”แƒฅแƒ–แƒ” แƒ’แƒแƒ•แƒฃแƒจแƒ•แƒแƒ— แƒจแƒ”แƒกแƒแƒ‘แƒแƒ›แƒ˜แƒกแƒ˜ แƒ‘แƒ แƒซแƒแƒœแƒ”แƒ‘แƒ”แƒ‘แƒ˜>>>

แƒฏแƒ”แƒ  แƒ•แƒฃแƒจแƒ•แƒ”แƒ‘แƒ— แƒ‘แƒ”แƒฅแƒ”แƒœแƒ“แƒก:

1. แƒ•แƒฅแƒ›แƒœแƒ˜แƒ— แƒ•แƒ˜แƒ แƒขแƒฃแƒแƒšแƒฃแƒ  แƒ’แƒแƒ แƒ”แƒ›แƒแƒก (venv)

python3 -m venv venv

2. แƒ•แƒแƒแƒฅแƒขแƒ˜แƒฃแƒ แƒ”แƒ‘แƒ— แƒ•แƒ˜แƒ แƒขแƒฃแƒแƒšแƒฃแƒ  แƒ’แƒแƒ แƒ”แƒ›แƒแƒก

source venv/bin/activate

3. แƒ•แƒแƒœแƒแƒฎแƒšแƒ”แƒ‘แƒ— pip-แƒก (แƒกแƒฃแƒ แƒ•แƒ˜แƒšแƒ˜แƒกแƒแƒ›แƒ”แƒ‘แƒ , แƒ—แƒฃแƒ›แƒชแƒ แƒกแƒแƒกแƒฃแƒ แƒ•แƒ”แƒšแƒ˜แƒ)

pip install --upgrade pip

4. แƒ•แƒแƒงแƒ”แƒœแƒ”แƒ‘แƒ— แƒ“แƒ”แƒคแƒ”แƒœแƒ“แƒ”แƒœแƒกแƒ”แƒ‘แƒก

pip install -r requirements.txt

5. แƒ•แƒแƒ™แƒ”แƒ—แƒ”แƒ‘แƒ— แƒ›แƒ˜แƒ’แƒ แƒแƒชแƒ˜แƒ”แƒ‘แƒก

python manage.py makemigrations

6. แƒ•แƒแƒ“แƒแƒกแƒขแƒฃแƒ แƒ”แƒ‘แƒ— แƒ›แƒ˜แƒ’แƒ แƒแƒชแƒ˜แƒ”แƒ‘แƒก

python manage.py migrate

7. แƒ•แƒฃแƒจแƒ•แƒ”แƒ‘แƒ— แƒฏแƒแƒœแƒ’แƒแƒก แƒ“แƒ”แƒ•แƒ”แƒšแƒแƒžแƒ›แƒ”แƒœแƒข แƒกแƒ”แƒ แƒ•แƒ”แƒ แƒก

python manage.py runserver

แƒจแƒ”แƒ›แƒ“แƒ’แƒแƒ› แƒคแƒ แƒแƒœแƒขแƒ“แƒ”แƒœแƒก: npm install npm run dev

for dockerized version (backend)

Stop everything

docker compose down --volumes --remove-orphans

Rebuild everything

docker compose build

Start all services

docker compose up -d

Check container logs

docker logs backend_container

Apply migrations

docker exec backend_container python manage.py makemigrations docker exec backend_container python manage.py migrate

Create superuser (optional)

docker exec -it backend_container python manage.py createsuperuser

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors