test deploiement
continuous-integration/drone/push Build is failing
Details
continuous-integration/drone/push Build is failing
Details
parent
c2e5e5abb1
commit
73be507fc9
@ -1,34 +1,31 @@
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
type: docker
|
type: docker
|
||||||
name: default
|
name: deploy-postgres
|
||||||
|
|
||||||
steps:
|
services:
|
||||||
- name: deploy-container-postgres
|
- name: postgres
|
||||||
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
|
image: postgres:15
|
||||||
environment:
|
environment:
|
||||||
IMAGENAME: postgres:13
|
POSTGRES_DB:
|
||||||
CONTAINERNAME: dbWikiFantasy
|
from_secret: POSTGRES_DB
|
||||||
COMMAND: create
|
POSTGRES_USER:
|
||||||
PRIVATE: true
|
from_secret: POSTGRES_USER
|
||||||
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_PASSWORD:
|
POSTGRES_PASSWORD:
|
||||||
from_secret: db_password
|
from_secret: POSTGRES_PASSWORD
|
||||||
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_USER:
|
ports:
|
||||||
from_secret: db_user
|
- 5432
|
||||||
CODEFIRST_CLIENTDRONE_ENV_POSTGRES_DB:
|
|
||||||
from_secret: db_database
|
|
||||||
|
|
||||||
- name: init-database
|
steps:
|
||||||
image: hub.codefirst.iut.uca.fr/thomas.bellembois/codefirst-dockerproxy-clientdrone:latest
|
- name: verify-postgres
|
||||||
|
image: postgres:15
|
||||||
environment:
|
environment:
|
||||||
PGPASSWORD:
|
POSTGRES_DB:
|
||||||
from_secret: db_password
|
from_secret: POSTGRES_DB
|
||||||
PGUSER:
|
POSTGRES_USER:
|
||||||
from_secret: db_user
|
from_secret: POSTGRES_USER
|
||||||
PGDATABASE:
|
POSTGRES_PASSWORD:
|
||||||
from_secret: db_database
|
from_secret: POSTGRES_PASSWORD
|
||||||
commands:
|
commands:
|
||||||
- apt-get update && apt-get install -y postgresql-client netcat
|
- echo "Vérification de la connexion à PostgreSQL"
|
||||||
- getent hosts dbwikifantasy
|
- pg_isready -h postgres -p 5432 -U $POSTGRES_USER
|
||||||
- until nc -z dbwikifantasy 5432; do echo "Waiting for port 5432..."; sleep 5; done
|
- psql -h postgres -U $POSTGRES_USER -d $POSTGRES_DB -c '\l
|
||||||
- until pg_isready -h dbwikifantasy -U postgres; do echo "En attente de PostgreSQL..."; sleep 5; done
|
|
||||||
- psql -h dbwikifantasy -U postgres -d wikifantasy -f script/init.sql
|
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
postgres:
|
||||||
|
image: postgres:15
|
||||||
|
environment:
|
||||||
|
POSTGRES_DB: mydatabase
|
||||||
|
POSTGRES_USER: myuser
|
||||||
|
POSTGRES_PASSWORD: mypassword
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
volumes:
|
||||||
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
- ./sql/init.sql:/docker-entrypoint-initdb.d/init.sql
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
postgres_data:
|
Loading…
Reference in new issue