Skip to content

Commit f394c9d

Browse files
FEATURE (installation): Update installation script with creds and wait until DB initialized
1 parent 9387ac3 commit f394c9d

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@ You have 2 ways how to run Postgresus:
22

33
# Installation
44

5-
1) Install Postgresus via script.
5+
**1) Install Postgresus via script.**
6+
67
It will:
78
- install Docker with Docker Compose
89
- write docker-compose.yml config
910
- install cron job to start Postgresus on system reboot
1011

12+
To install, run:
13+
```
14+
apt-get install -y curl && \
15+
curl -sSL https://raw.githubusercontent.com/RostislavDugin/postgresus/refs/heads/main/install-postgresus.sh | bash
16+
```
1117

12-
> apt-get install -y curl
13-
> curl -sSL https://raw.githubusercontent.com/rostislavdugin/postgresus/main/install-postgresus.sh | bash
14-
> docker-compose up
15-
16-
2) Write docker-compose.yml config manually:
18+
**2) Write docker-compose.yml config manually:**
1719

1820
```
1921
version: "3"
@@ -30,8 +32,8 @@ services:
3032
# PostgreSQL ports so it is safe
3133
environment:
3234
- POSTGRES_DB=postgresus
33-
- POSTGRES_USER=postgresus
34-
- POSTGRES_PASSWORD=postgresus
35+
- POSTGRES_USER=postgres
36+
- POSTGRES_PASSWORD=Q1234567
3537
volumes:
3638
- ./pgdata:/var/lib/postgresql/data
3739
container_name: postgresus-db

docker-compose.yml.example

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ services:
1414
ports:
1515
- "4005:4005"
1616
depends_on:
17-
- postgresus-db
17+
postgresus-db:
18+
condition: service_healthy
19+
restart: unless-stopped
1820

1921
postgresus-db:
2022
image: postgres:17
@@ -29,3 +31,9 @@ services:
2931
container_name: postgresus-db
3032
command: -p 5437
3133
shm_size: 10gb
34+
healthcheck:
35+
test: ["CMD-SHELL", "pg_isready -U postgresus -d postgresus -p 5437"]
36+
interval: 5s
37+
timeout: 5s
38+
retries: 5
39+
restart: unless-stopped

install-postgresus.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ services:
5959
image: rostislavdugin/postgresus:latest
6060
ports:
6161
- "4005:4005"
62+
depends_on:
63+
postgresus-db:
64+
condition: service_healthy
65+
restart: unless-stopped
6266
6367
postgresus-db:
6468
image: postgres:17
@@ -73,6 +77,12 @@ services:
7377
container_name: postgresus-db
7478
command: -p 5437
7579
shm_size: 10gb
80+
healthcheck:
81+
test: ["CMD-SHELL", "pg_isready -U postgresus -d postgresus -p 5437"]
82+
interval: 5s
83+
timeout: 5s
84+
retries: 5
85+
restart: unless-stopped
7686
EOF
7787
log "docker-compose.yml created successfully"
7888

0 commit comments

Comments
 (0)