Skip to content

BerdyshevEugene/foodgram-project-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Foodgram project


Description

The foodgram project is designed to create and share recipes. Users can create their own recipes, subscribe to other authors, download recipes, and add recipes to favorites.

Technology stack

github github github Postgres Nginx


Installation

clone the repository and go to it on the command line:

https://github.com/BerdyshevEugene/foodgram-project-react.git

create and activate virtual enviroment:

python3 -m venv env
source env/bin/activate
python3 -m pip install --upgrade pip

create and fullfill .env file in infra/:

DB_ENGINE=django.db.backends.postgresq
DB_NAME=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
DB_HOST=db
DB_PORT=5432

on a remote server install docker:

sudo apt install docker.io 

install docker-compose:

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

copy the docker-compose files.yml and nginx.conf from the infra directory to the server:

scp docker-compose.yml <username>@<host>:/home/<username>/docker-compose.yml
scp nginx.conf <username>@<host>:/home/<username>/nginx.conf

add secrets GitHub for workflow:

DB_ENGINE=<django.db.backends.postgresql>
DB_NAME=<name of db postgres>
DB_USER=<db user>
DB_PASSWORD=<password>
DB_HOST=<db>
DB_PORT=<5432>

DOCKER_USERNAME=<username>
DOCKER_PASSWORD=<DockerHub password>

SECRET_KEY=<django secret key>

USER=<username for server connection>
HOST=<IP>
PASSPHRASE=<password for host>
SSH_KEY=<SSH key (command for check: cat ~/.ssh/id_rsa)>

if necessary, delete the old information on the server:

sudo docker stop $(docker ps -qa) && docker rm $(docker ps -qa) && docker rmi -f $(docker images -qa ) && docker volume rm $(docker volume ls -q) && docker network rm $(docker network ls -q)

on the server, build docker-compose and make migrations:

sudo docker-compose up -d --build
sudo docker-compose exec backend python manage.py makemigrations
sudo docker-compose exec backend python manage.py migrate

create superuser:

sudo docker-compose exec backend python manage.py createsuperuser

you can go to the project by following the next link: http://51.250.86.6/


Author

frontend: Yandex

backend: Eugene Berdyshev

Build Status

About

Foodgram project template

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published