Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sample-apps/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dev: check-zen-go
@PORT=$(PORT) go run -toolexec="$(ZENGO) toolexec" .

start-database:
@cd ../databases/ && docker compose up $(DB_SERVICE) -d
@cd ../databases/ && docker compose up $(DB_SERVICE) -d --wait

stop-database:
@cd ../databases/ && docker compose down
Expand Down
16 changes: 15 additions & 1 deletion sample-apps/databases/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ services:
volumes:
- postgres_db_data:/var/lib/postgresql/data
- ./postgres_init.sql:/docker-entrypoint-initdb.d/init.sql

environment:
POSTGRES_DB: "db"
POSTGRES_USER: "user"
POSTGRES_PASSWORD: "password"
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U user -d db"]
interval: 1s
timeout: 5s
retries: 30
mysql_database:
image: mysql
container_name: sample_mysql_db
Expand All @@ -28,6 +32,11 @@ services:
ports:
- "3306:3306"
command: --init-file /data/application/init.sql
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "user", "-ppassword"]
interval: 1s
timeout: 5s
retries: 30
mssql_database:
build: ./mssql_database
container_name: sample_mssql_db
Expand All @@ -39,6 +48,11 @@ services:
- "1433:1433"
volumes:
- mssql_db_data:/var/opt/mssql
healthcheck:
test: ["CMD-SHELL", "/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Strong!Passw0rd' -Q 'SELECT 1' -b -o /dev/null"]
interval: 1s
timeout: 5s
retries: 30

volumes:
postgres_db_data:
Expand Down
2 changes: 1 addition & 1 deletion sample-apps/echo-pgx-sql/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func connectToDb() *sql.DB {
var err error
var db *sql.DB
// Connect to PostgreSQL
connStr := "postgresql://localhost:5432/db?user=user&password=password"
connStr := "postgresql://localhost:5432/db?user=user&password=password&sslmode=disable"
db, err = sql.Open("pgx", connStr)
if err != nil {
log.Fatal(err)
Expand Down
Loading