Skip to content
/ docker Public

Docker - Nginx, PHP, Postgres, Elastic, Supevisor and Nodejs

License

Notifications You must be signed in to change notification settings

alexfer/docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stand With Ukraine

Creating and deploying postgres database

Important

In the docker directory go over:

Deploy source code

$ cd dev/project/
$ git clone git@github.com:alexfer/rgfly.git
$ cd rgfly
$ cp .env.dist .env # symfony configuration
$ composer install
$ npm install
$ npm run dev --watch

Deploy Websocket server

$ cd dev/project/
$ git clone git@github.com:alexfer/nodejs.git
$ cd nodejs
$ cp .env.dist .env # node configuration
$ npm install

Build docker

Run following commands and fill .env file:

$ cd docker

Fill out .env file:

$ cp .env.dist .env
$ docker-compose up -d --build

Clear logs

./clear-logs.sh

Create database & grant privileges to database

Login to postgres container:

$ docker exec -it postgres sh
psql -U postgres

Next step:

DROP ROLE IF EXISTS rgfly; -- optional
CREATE USER rgfly WITH password 'rgfly';
ALTER USER rgfly WITH SUPERUSER;
ALTER USER rgfly CREATEDB;
CREATE DATABASE rgfly OWNER rgfly;
GRANT ALL PRIVILEGES ON DATABASE rgfly TO rgfly;

Deploy database:

$ docker exec -it php bash
$ cd rgfly
$ rm -rfv src/Migrations/* # optional
$ php bin/console doctrine:database:drop --if-exists --force # optional
$ php bin/console doctrine:database:create # optional
$ php bin/console make:migration --no-interaction # optional
$ php bin/console doctrine:migrations:migrate --no-interaction
$ php bin/console doctrine:fixtures:load --no-interaction
$ php bin/console app:functions:import --no-interaction

Clear database Redis:

docker exec -it redis redis-cli FLUSHALL