-
Copy the
.env.examplefile to the.envfile:Run using the terminal:
cp .env.example .envIf you use
PowerShell, run:copy .env.example .env -
Edit the
.envfile as necessary.
Open it and add to root direstory
-
Stop containers:
Run using the terminal:
docker compose stop -
Remove containers:
Run using the terminal:
docker compose rm
-
Run
PostgresandpgAdmincontainers:Run using the terminal:
docker compose up -
Wait 2-3 minutes until
pgAdminstarts. -
If you need to run other commands use any of these options:
- Option 1: press
din the terminal where you run the containers. - Option 2:
- Open a new terminal.
- Navigate there to the
s26-databases/lab-4directory.
- Option 1: press
-
File
demo-medium-en-20170815.sqlis mounted into Postgres init directory and is applied automatically as an initial migration. -
It runs only when database volume is empty (first initialization), because this is how
postgresentrypoint works. -
To re-apply this SQL from scratch:
docker compose down -v docker compose up -d
- Open
pgAdminin a browser: go to http://localhost:45050. - Log in:
- Login: the value of
PGADMIN_DEFAULT_EMAILdefined in.env - Password: the value of
PGADMIN_DEFAULT_PASSWORDdefined in.env.
- Login: the value of
- Click
Add New Server. - In
General, set:Name:postgres
- In
Connection, set:Host name/address:postgres(service name created byDocker)Port:5432(the value ofPOSTGRES_PORTdefined in.env)Maintenance database:postgres(the value ofPOSTGRES_DBdefined in.env)Username:postgres(the value ofPOSTGRES_USERdefined in.env)Password:postgres(the value ofPOSTGRES_PASSWORDdefined in.env)
- Click
Save.