Skip to content

eastflower/eastflower.ru

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Eastflower.ru

Personal Culinary Blog of Elena Tsoy.

Cold Dev Start

PLATFORM=amd docker compose -f dev.docker-compose.yml pull

1. Remove .gitkeep file

rm db/PGSQL/.gitkeep

You need it to avoid a problem with Cold Run and Initialization of a new database (PSQL message: If you want to create a new database system, either remove or empty the directory)

2. Run PSQL container

cd docker

docker compose -f dev.docker-compose.yml up psql

New initial PSQL database will be created in db/PGSQL.

3. Restore .gitkeep file

Restore the .gitkeep that was removed recently.

From the root of the project.

touch db/PGSQL/.gitkeep

4. Put database backup file in shared

PSQL container has an access to the shared folder in the root folder of the application.

We sould like to use this folder to share files across containers.

cd shared

scp [email protected]:/home/rails/DUMPS/eastflower.ru.2022_10_09_15_22.pq.sql .

5. Create Database inside PSQL container

Be sure that PSQL container is running, or restart it.

docker ps

!> eastflower-psql-1
eastflower-redis-1
eastflower-sphinx-1
eastflower-rails-1
docker exec eastflower-psql-1 bash /shared/create_eastflower_db.sh

5. Load the Database

!> eastflower-psql-1
eastflower-redis-1
eastflower-sphinx-1
eastflower-rails-1
docker exec eastflower-psql-1 bash -c "pg_restore -h localhost -d eastflower -U rails /shared/eastflower.ru.2022_10_09_15_22.pq.sql"

5:1. Add App.yml config

touch config/ENV/production/settings/app.yml

Add production settings.

6. Create Search Index Config

PLATFORM=amd docker compose -f dev.docker-compose.yml up
!> eastflower-psql-1
!> eastflower-redis-1
!> eastflower-sphinx-1
!> eastflower-rails-1
docker exec -ti eastflower-rails-1 /bin/bash
$ cd home
$ RAILS_ENV=production rake ts:configure

7. Make the Search Index

docker compose -f dev.docker-compose.yml up
!> eastflower-psql-1
!> eastflower-redis-1
!> eastflower-sphinx-1
!> eastflower-rails-1
docker exec eastflower-sphinx-1 indexer --config /opt/sphinx/conf/sphinx.conf --all

8. Run the Project

docker compose -f dev.docker-compose.yml up
!> eastflower-psql-1
!> eastflower-redis-1
!> eastflower-sphinx-1
!> eastflower-rails-1
$ docker exec -ti eastflower-rails-1 /bin/bash
rails s -b 0.0.0.0 -p 3000

9. Download uploads

rsync -chavzPr [email protected]:/home/rails/eastflower.ru/public/uploads .

rsync -chavzPr [email protected]:/home/rails/eastflower.ru/public/uploads .
-c     skip based on checksum, not mod-time & size
-h     output numbers in a human-readable format
-a     archive mode is -rlptgoD (no -A,-X,-U,-N,-H)
-v     increase verbosity
-z     compress file data during the transfer
-P     keep partially transferred files
-r     recurse into directories

10. Run web server

$ docker exec -ti eastflower-rails-1 /bin/bash
bundle exec puma -C config/_PUMA.production.rb