- Create file
.envin Controllers directory - Add the following parameters to the file:
POSTGRES_HOST- address of Postgres database (set tolocalhostwhen deploying db on your device)POSTGRES_PORT- port of Postgres databasePOSTGRES_DB- name of Postgres databasePOSTGRES_USER- user name for connecting to Postgres databasePOSTGRES_PASSWORD- password for connection to Postgres databaseREDIS_HOST- address of Redis databaseREDIS_PORT- port of Redis databaseSECRET_KEY- encryption key for passwords hashing- Use following command to generate key:
openssl rand -hex 32
Example of .env file:
POSTGRES_HOST=localhost
POSTGRES_PORT=5431
POSTGRES_DB=templatedb
POSTGRES_USER=aragami
POSTGRES_PASSWORD=password
REDIS_HOST=redis
REDIS_PORT=6379
SECRET_KEY=166eaa88fe76de61d37d56b3032b671f0150630f40f7c86d04918968246c9e01
dotnet build Controllers/Controllers.csproj
dotnet run --project Controllers/Controllers.csprojsudo docker-compose -f DataBase/Docker/docker-compose.yml --env-file Controllers/.env up --no-start
sudo docker start pgadmin4Template postgresTemplate docker-redis-1sudo docker stop pgadmin4Template postgresTemplate docker-redis-1- Create file
.envin the root project's directory - Add all the parameters mentioned above in the “Development” point to the file, but for some, set the following values:
POSTGRES_HOST=postgresTemplatePOSTGRES_PORT=5432REDIS_HOST=redisREDIS_PORT=6379
sudo docker-compose up --buildsudo docker-compose downsudo docker exec postgresTemplate pg_dump -U $POSTGRES_USER -d $POSTGRES_DB > backup.sqlsudo docker exec -i postgresTemplate psql -U $POSTGRES_USER -d $POSTGRES_DB < backup.sql