diff --git a/compose.yaml b/compose.yaml index ef655ad..e9adf9d 100644 --- a/compose.yaml +++ b/compose.yaml @@ -11,7 +11,7 @@ services: - ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d:Z - ./data:/tmp:z ports: - - 5432:5432 + - "5432:5432" healthcheck: test: ["CMD", "pg_isready", "--username", "${COMPOSE_PROJECT_NAME}", "--dbname", "${COMPOSE_PROJECT_NAME}"] interval: 10s @@ -19,6 +19,35 @@ services: retries: 5 start_period: 20s +# pgAdmin +# Rich administration and development platform for PostgreSQL. +# https://www.pgadmin.org/ + + pgadmin: + image: dpage/pgadmin4:${PGADMIN_VERSION:-8.11} + depends_on: + postgresql: + condition: service_healthy + restart: "no" + configs: + - source: pgadmin_config + target: /pgadmin4/servers.json + volumes: + - pgadmin:/var/lib/pgadmin/ + ports: + - "3009:80" + environment: + PGADMIN_DEFAULT_EMAIL: ${ADMIN_EMAIL} + PGADMIN_DEFAULT_PASSWORD: ${ADMIN_PASSWORD} + PGADMIN_DISABLE_POSTFIX: true + profiles: + - admin + +# ---------------------------------------------------------------------- +# Business Intelligence +# +# ---------------------------------------------------------------------- + superset: image: apache/superset:3.1.3 depends_on: @@ -40,6 +69,8 @@ services: superset init && superset run -h 0.0.0.0 -p 8088 --with-threads --reload --debugger " + profiles: + - bi metabase: image: metabase/metabase:v0.56.5.5 @@ -67,12 +98,16 @@ services: MB_EMAIL_SMTP_HOST: mailpit MB_EMAIL_SMTP_PORT: 1025 MB_EMAIL_FROM_ADDRESS: metabase@univ-lorraine.fr + profiles: + - bi metabase-init: build: context: ./metabase depends_on: - metabase + profiles: + - bi # CouchDB # Single-node document database @@ -139,6 +174,109 @@ services: environment: NEO4J_AUTH: neo4j/${DB_ROOT_PASSWORD:-!ChangeMe!} +# Caddy +# Web server, load balancer, and reverse proxy +# https://caddyserver.com/ + caddy: + image: caddy:2.10.2 + restart: "no" + ports: + - "8080:80" + - "2019:2019" + volumes: + - ./data:/usr/share/caddy + +# ---------------------------------------------------------------------- +# Web API +# +# ---------------------------------------------------------------------- + +# PostgREST +# Serve a fully RESTful API from any existing PostgreSQL database. +# It provides a cleaner, more standards-compliant, faster API than you are likely to write from scratch. +# https://docs.postgrest.org/en/v12/ + + postgrest: + image: postgrest/postgrest:${POSTGREST_VERSION:-v13.0.7} + restart: "no" + depends_on: + database: + condition: service_healthy + command: postgrest + ports: + - 3005:3005 + environment: + PGRST_DB_URI: postgres://${POSTGREST_USER:-postgrest}:${DB_PASSWORD}@${POSTGREST_HOST:-postgresql}:${POSTGREST_DB_PORT:-5432}/${DB_NAME:-postgrest} + PGRST_DB_SCHEMAS: ${POSTGREST_DB_SCHEMAS:-public} + PGRST_DB_ANON_ROLE: ${POSTGREST_DB_ANON_ROLE:-role_web} + PGRST_JWT_SECRET: ${POSTGREST_JWT_SECRET:-ABCDEFGHIJKLMNOPQRSTUVWXYZ} + PGRST_DB_USE_LEGACY_GUCS: ${POSTGREST_DB_USE_LEGACY_GUCS:-false} + PGRST_APP_SETTINGS_JWT_SECRET: ${POSTGREST_APP_SETTINGS_JWT_SECRET} + PGRST_APP_SETTINGS_JWT_EXP: ${POSTGREST_APP_SETTINGS_JWT_EXP} + PGRST_ADMIN_SERVER_PORT: 3055 + PGRST_SERVER_PORT: 3005 + profiles: + - api + +# ---------------------------------------------------------------------- +# Observabilité - Télémétrie +# +# ---------------------------------------------------------------------- + +# Grafana +# Open source analytics & monitoring solution for every database. +# https://grafana.com/ + + grafana: + image: grafana/grafana-oss:${GRAFANA_VERSION:-12.2} + restart: no + depends_on: + - loki + deploy: + resources: + limits: + memory: 100M + configs: + - source: grafana_datasources + target: /etc/grafana/provisioning/datasources + - source: grafana_dashboards + target: /etc/grafana/dashboards + volumes: + - grafana:/var/lib/grafana + ports: + - 3000:3000 + #environment: + #GF_SECURITY_ADMIN_EMAIL: ${ADMIN_EMAIL} + #GF_SECURITY_ADMIN_PASSWORD: ${ADMIN_PASSWORD} + #GF_AUTH_ANONYMOUS_ENABLED: true # Enabled the Anonymous user no user/pass needed + #GF_AUTH_ANONYMOUS_ORG_ROLE: Admin + #GF_AUTH_DISABLE_LOGIN_FORM: true + #GF_USERS_DEFAULT_THEME: light + #GF_USERS_ALLOW_SIGN_UP: false + #GF_FEATURE_TOGGLES_ENABLE: traceQLStreaming metricsSummary lokiFormatQuery alertmanagerRemoteOnly + #GF_INSTALL_PLUGINS: yesoreyeram-infinity-datasource + profiles: + - telemetry + +# Prometheus +# Prometheus is an open-source systems monitoring and alerting toolkit +# https://prometheus.io/ + + prometheus: + image: prom/prometheus:${PROMETHEUS_VERSION:-v3.6.0} + configs: + - source: prometheus_config + target: /etc/prometheus/prometheus.yml + volumes: + - prometheus:/prometheus + - /var/run/docker.sock:/var/run/docker.sock:ro + ports: + - 9090:9090 + #extra_hosts: + # - host.docker.internal=host-gateway + profiles: + - telemetry + volumes: database_data: superset_home: @@ -148,3 +286,9 @@ volumes: redis_data: neo4j_data: neo4j_logs: + prometheus: + grafana: + +configs: + pgadmin_config: + file: ./pgadmin-servers.json diff --git a/data/commandes/adherent.csv b/data/commandes/adherent.csv new file mode 100755 index 0000000..e0e2fab --- /dev/null +++ b/data/commandes/adherent.csv @@ -0,0 +1,117 @@ +id,prenom,nom,mobile,ville +1,Albane,Trottier,06 56 08 20 35,Saint-Dié des Vosges +2,Josef,Jakubowski,06 89 80 47 42,Raon L'Étape +3,Ali,Sahim,06 71 04 50 25,Baccarat +4,Émilie,Jolie,07 45 49 58 87,Saint-Dié des Vosges +5,Soufiane,Mamoun,07 56 90 66 57,Chavelot +6,Élodie,Bérengier,06 04 76 72 63,Épinal +7,Eugène,Makiadi,07 35 95 01 59,Saint-Dié des Vosges +8,Julie,Thomis,06 65 20 31 07,Hurbache +9,Marc,Aurèle,07 46 09 47 48,Anould +10,Albert,Unepierre,06 92 22 88 42,Saint-Dié des Vosges +11,Lucas,George,06 92 34 53 95,Rambervillers +12,Lyna,Khoudri,06 17 92 26 71,Saint Michel +13,Nour,Zermani,07 73 44 12 85,Thaon les Vosges +14,Théophile,M'Beko,06 66 35 74 44,Jeuxey +15,Sébastien,Voltier,06 43 73 50 18,Thaon les Vosges +16,Matteo,Giordano,07 47 08 31 03,Saint-Dié des Vosges +17,Diego,Delavega,07 72 81 97 88,Saint-Dié des Vosges +18,Geoffrey,Lebowski,06 69 52 06 97,Senones +19,Ælita,Dornburg,06 98 35 16 64,Moyenmoutier +20,João,Costa,06 26 92 48 29,Épinal +21,Maëla,Le Roux,06 19 20 78 91,Senones +22,Rose-Lynn,Noël,07 62 30 72 69,Épinal +23,Jean-Christophe,Prigent,07 71 19 52 63,Baccarat +24,Apolline,de Bazelaire de Lesseux,07 46 31 52 20,Épinal +25,Aylin,Özkan,07 87 02 67 50,Thaon les Vosges +26,Davyd,Chmyhal,07 56 90 86 99,Épinal +27,Nayiri,Zakarian,06 53 92 47 93,Thaon les Vosges +28,François,du Bessey de Contenson,07 40 31 73 96,Moyenmoutier +29,Martial,Mondésir,06 75 97 29 86,Étival Clairefontaine +30,Tom,Kishida,06 70 32 13 19,Saint Michel +31,Zainap,Bisliev,07 55 05 82 02,Anould +32,Maï Ly,Pham Le,07 47 04 37 01,Épinal +33,Laurent,Ramasawmy,06 72 09 29 62,Baccarat +34,Atika,Mroudjaé,06 20 71 30 52,Étival Clairefontaine +35,Alice,Inechains,07 90 19 64 55,Raon L'Étape +36,Laureline,Mézières,06 40 12 88 98,Étival Clairefontaine +37,Valerian,Christin,06 63 07 67 44,Épinal +38,Alice,Kingsleigh,06 75 70 48 01,Saint Michel +39,Amélie,Pond,07 41 60 49 22,Baccarat +40,Eyota,Olmsted,07 27 55 66 87,Épinal +41,Hapsatou,Sall,06 53 97 30 11,Saint-Dié des Vosges +42,Pauline,Landry,06 52 95 09 94,Senones +43,Ariane,Adamopoulos,06 51 54 24 11,Saint-Dié des Vosges +44,Frédérique,Hoschedé,06 59 17 89 26,Raon L'Étape +45,Adolphe,Dassler,07 23 47 64 63,Épinal +46,Ousmane,Sy,06 79 17 01 33,Saint-Dié des Vosges +47,Anton,Kamenberg,07 54 82 66 19,Raon L'Étape +48,Hannah,von Schlotterstein,07 84 81 31 49,Thaon les Vosges +49,Jonas,van Quickenborne,07 69 59 25 47,Thaon les Vosges +50,Tristan,Gwerz de Bran,06 25 19 17 08,Rambervillers +51,Shauni,Bax,07 70 57 82 23,Anould +52,Becky,Meyer,06 14 05 58 81,Saulcy sur Meurthe +53,Lucien,Maes,06 48 35 64 52,Jeuxey +54,Charlotte,van Houtte,07 03 36 21 87,Thaon les Vosges +55,Elisabeth,Seimetz,07 41 42 77 81,Saint-Dié des Vosges +56,Mariette,Wengler,06 05 78 98 74,Thaon les Vosges +57,Bernard,Beicht,07 68 05 81 30,Anould +58,Stéphane,Kesseler,06 55 69 10 66,Saint Michel +59,Jackson,Lundy,06 95 83 26 80,Jeuxey +60,Amir,Hamidou,06 96 32 06 46,Rambervillers +61,Chaka,Ammar,07 22 62 22 54,Saint-Dié des Vosges, +62,Odette,Philippe,06 18 55 02 02,Épinal, +63,Gérard,Lambert,06 59 50 76 30,Senones, +64,Farrokh,Bulsara,07 34 88 97 69,Épinal, +65,Bruce,Nadjar,06 10 96 96 90,Étival Clairefontaine, +66,Steve,Bouchard,06 75 53 67 40,Anould, +67,Stéphanie,Tanner,07 78 56 66 82,Hurbache, +68,Ali,Taef,06 15 19 22 54,Hurbache, +69,Jade,Perrin,06 49 95 10 50,Épinal, +70,Louise,Mercier,07 87 53 37 04,Saulcy sur Meurthe, +71,Emma,Lefèvre,06 93 27 24 06,Senones, +72,Ambre,Mougeot,07 97 76 54 93,Étival Clairefontaine, +73,Romane,Bourgeois,06 23 39 34 24,Épinal, +74,Rosemarie,Bernard,06 15 19 22 54,Anould, +75,Anna,Le Roux,06 03 00 71 36,Senones, +76,Romy,Lacroix,06 92 45 20 73,Senones, +77,Lina,Poirot,06 28 70 08 32,Baccarat, +78,Chloé,Masson,07 53 30 15 86,Saulcy sur Meurthe, +79,Arnaud,Moulin,06 60 84 88 92,Étival Clairefontaine, +80,Agathe,Collet,06 96 25 37 54,Épinal, +81,Léna,Martin,07 33 82 80 21,Saulcy sur Meurthe, +82,Angela,Sommer-Bodenburg,06 15 19 11 54,Saint-Dié des Vosges, +83,Moojan,Asghari,07 04 11 18 53,Anould, +84,Claudia,Orléans,06 84 05 05 56,Épinal, +85,Louis,de Pointe du Lac,07 46 10 42 49,Saint-Dié des Vosges, +86,Armand,Andreï,07 59 46 86 63,Saint-Dié des Vosges, +87,Pierre,Aronax,07 93 58 85 95,Anould, +88,Christine,Daaé,06 67 93 52 20,Épinal, +89,Garance,Dupuis,06 22 98 79 39,Moyenmoutier, +90,Raoul,de Chagny,07 06 82 08 09,Épinal, +91,Érik,Leroux,07 98 61 15 29,Remomeix, +92,Meg,Giry,06 13 85 41 72,Rambervillers, +93,Tom,Major,06 30 88 47 34,Chavelot, +94,Ziggy,Stardust,06 68 54 43 86,Saint-Dié des Vosges, +95,Plautine,Lucazeau,07 15 17 32 29,Jeuxey, +96,Tiphaine,Jacob,06 44 13 16 93,Raon L'Étape, +97,Dorothée,Humbert,06 65 06 97 64,Fraispertuis, +98,Morgane,Perez,06 60 75 73 49,Épinal +99,Solenn,Courcoux,06 50 06 37 46,Épinal +100,Fleur,Lemaitre,07 77 87 04 95,Remomeix +101,Esteban,Hiro del Sol,07 31 93 31 05,Fraispertuis +102,Théophraste,Longuet,07 07 99 86 75,Remomeix +103,Esther,Allary,07 34 00 44 32,Saint-Dié des Vosges +104,Zia,Esperanza,07 76 56 90 76,Moyenmoutier +105,Tao,Mu,07 13 52 94 62,Étival Clairefontaine +106,Meryem,Guclu,07 25 03 23 77,Rambervillers +107,Kewan,Meyer,06 65 43 71 24,Saint-Dié des Vosges +108,Süleyman,Keski̇n,06 66 89 70 11,Raon L'Étape +109,Aziz,Nazari,07 04 11 18 55,Étival Clairefontaine +110,Juliette,Mwangachuchu,06 84 05 05 64,Étival Clairefontaine +111,Laïla,Mansour,07 46 10 42 00,Saint-Dié des Vosges +112,Maximilien,Laforêt,07 59 46 86 36,Senones +113,Cœllyn,Caradowq,07 93 58 85 59,Épinal +114,Hugo,Brabazon,06 67 93 52 02,Épinal +115,Henrietta,Dombrovskaya,06 22 98 79 93,Saint-Dié des Vosges +116,Wilbur,Whateley,07 06 82 08 90,Thaon les Vosges diff --git a/data/graphe/clients.csv b/data/graphe/clients.csv index 2fefb9e..022453b 100644 --- a/data/graphe/clients.csv +++ b/data/graphe/clients.csv @@ -1,41 +1,41 @@ client_id,nom,ville -C1,Client1,Nantes -C2,Client2,Paris -C3,Client3,Paris -C4,Client4,Nantes -C5,Client5,Marseille -C6,Client6,Lyon -C7,Client7,Lyon -C8,Client8,Lyon -C9,Client9,Nantes -C10,Client10,Paris -C11,Client11,Nantes -C12,Client12,Nantes -C13,Client13,Toulouse -C14,Client14,Paris -C15,Client15,Toulouse -C16,Client16,Lille -C17,Client17,Paris -C18,Client18,Paris -C19,Client19,Paris -C20,Client20,Lyon -C21,Client21,Lyon -C22,Client22,Toulouse -C23,Client23,Toulouse -C24,Client24,Paris -C25,Client25,Toulouse -C26,Client26,Lyon -C27,Client27,Nantes -C28,Client28,Nantes -C29,Client29,Nantes -C30,Client30,Toulouse -C31,Client31,Lille -C32,Client32,Lyon -C33,Client33,Lille -C34,Client34,Toulouse -C35,Client35,Marseille -C36,Client36,Bordeaux -C37,Client37,Bordeaux -C38,Client38,Paris -C39,Client39,Bordeaux -C40,Client40,Bordeaux +C1,Médora Leigh,Nantes +C2,Ali Sahim,Paris +C3,Rocco Marciano,Paris +C4,Rose-Lynn Noël,Nantes +C5,Aylin Özkan,Marseille +C6,Geoffrey Lebowski,Lyon +C7,Hapsatou Sall,Lyon +C8,Théophile M'Beko,Lyon +C9,Amara Juliana Aquilla,Nantes +C10,Nour Zermani,Paris +C11,Matteo Giordano,Nantes +C12,Amélia Pond,Nantes +C13,Jonas van Quickenborne,Toulouse +C14,Frédérique Hoschedé,Paris +C15,Syphax Benoukaci,Toulouse +C16,Diego Delavega,Lille +C17,Tristan Gwerz de Bran,Paris +C18,Lyna Khoudri,Paris +C19,Maximilian Rockatansky,Paris +C20,Nayiri Zakarian,Lyon +C21,Reiko Ikehata,Lyon +C22,Anton Kamenberg,Toulouse +C23,Alice Inechains,Toulouse +C24,Eyota Olmsted,Paris +C25,Laurent Ramasawmy,Toulouse +C26,Adolphe Dassler,Lyon +C27,Maï Ly Pham Le,Nantes +C28,Zainap Gashaeva,Nantes +C29,James Howlett,Nantes +C30,Józef Jakubowski,Toulouse +C31,Hannah von Schlotterstein,Lille +C32,Martial Kéclard-Mondésir,Lyon +C33,Atika Mroudjaé,Lille +C34,Lucas Georges,Toulouse +C35,Samia Benahouda,Marseille +C36,Sofiane Mamoun,Bordeaux +C37,Ælita Dornburg,Bordeaux +C38,João Costa,Paris +C39,Athéna Adamopoulos,Bordeaux +C40,Davyd Chmyhal,Bordeaux diff --git a/json/export.sql b/json/export.sql index 25dc7eb..1a3aba8 100644 --- a/json/export.sql +++ b/json/export.sql @@ -3,14 +3,14 @@ DECLARE r RECORD; file_path TEXT; BEGIN - FOR r IN SELECT id, caracteristiques FROM item + FOR r IN SELECT id, data FROM item LOOP file_path := format('/tmp/json/%s.json', r.id); -- Écrit le fichier (nécessite superutilisateur) - PERFORM pg_catalog.pg_write_file( + PERFORM pg_write_file( file_path, - r.caracteristiques::text, + r.data::text, false -- false = écrasement (pas d'append) ); diff --git a/pgadmin-servers.json b/pgadmin-servers.json new file mode 100644 index 0000000..70790ef --- /dev/null +++ b/pgadmin-servers.json @@ -0,0 +1,20 @@ +{ + "Servers": { + "1": { + "Name": "docker", + "Group": "Servers", + "Host": "database", + "Port": 5432, + "MaintenanceDB": "postgres", + "Username": "postgres", + "UseSSHTunnel": 0, + "TunnelPort": "22", + "TunnelAuthentication": 0, + "KerberosAuthentication": false, + "ConnectionParameters": { + "sslmode": "disable", + "connect_timeout": 10 + } + } + } +}