Production Dump Setup

Production Dump Setup

Make sure all the servers running are stopped and run

docker-compose --profile dev up

Step 1:

rails db:drop

Step 2:

**rails db:create**

Step 3:

**docker exec -it saut-backend-db-1 bash**

Step 4:

psql -U postgres -h localhost

Step 5:

  • type \dtand \du to check the profiles in postgres.

Step 6:

CREATE ROLE dbadmin WITH LOGIN SUPERUSER;
  • type exit to exit from psql and agin exit from docker terminal

Step 7:

pg_restore -h localhost -U postgres -d saut_developmentĀ /Users/able/Downloads/prod_dump.sql
  • Password: postgres

Step 8

enter rails console

rails c

Step 9

ExternalService.unscoped.destroy_all

Step 10

Run the below command in rails console to point our website to local db instead of remote aws.

ActiveStorage::Blob.update_all(service_name: "saut_aws_local")
  • exit rails console

Step 11:

rails db:migrate
  • Run the server