diff --git a/.gitignore b/.gitignore index 507df565a49695788333c3b90d5543ad5244beb7..3d331fcdf6a86b61144bcdf0f682cc0174fcca90 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -./log/access.log -./log/error.log +log/access.log +log/error.log diff --git a/docker-compose.yml b/docker-compose.yml index 0fb22a34d569bc8e90bd861fac86836371faefc0..937ceab28beefefbaf46291bd8b4f66489c04bc8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,8 @@ services: - databases php: - build: . + build: + dockerfile: dockerfile_php container_name: php-memo volumes: - "./www:/script" @@ -23,19 +24,23 @@ services: - databases postgresql-memo: - image: postgres:latest + build: + dockerfile: dockerfile_postgres restart: unless-stopped container_name: postgresql-memo environment: - POSTGRES_USER: user + POSTGRES_USER: admin POSTGRES_PASSWORD: password ports: - published: 5432 target: 5432 volumes: - - postgres_data:/var/lib/postgresdata/data:rw + - "./pgsql-scripts:/docker-entrypoint-initdb.d" + - "postgres_data:/var/lib/postgresql/data" networks: - databases + # command: echo "fuck" & + # command: psql -U user -d postgres -f postgresqldata/data/datapostgres.sql redis-memo: image: redis:latest @@ -45,7 +50,7 @@ services: - published: 6379 target: 6379 volumes: - - redis_data:/var/lib/redisdata/data:rw + - ./www/data/redis_data:/redisdata/data:rw networks: - databases diff --git a/Dockerfile b/dockerfile_php similarity index 100% rename from Dockerfile rename to dockerfile_php diff --git a/dockerfile_postgres b/dockerfile_postgres new file mode 100644 index 0000000000000000000000000000000000000000..68cd1059e6e5e19a82114a80f9ab963745dcf8f2 --- /dev/null +++ b/dockerfile_postgres @@ -0,0 +1,2 @@ +FROM postgres:latest +USER postgres \ No newline at end of file diff --git a/pgsql-scripts/datapostgres.sql b/pgsql-scripts/datapostgres.sql new file mode 100644 index 0000000000000000000000000000000000000000..16d2be4e54ec81df06d7357ca518c21b33568e95 --- /dev/null +++ b/pgsql-scripts/datapostgres.sql @@ -0,0 +1,14 @@ +\c postgres; + +DROP TABLE IF EXISTS "taches"; +CREATE TABLE "public"."taches" ( + "id" text NOT NULL, + "texte" text NOT NULL, + "accomplie" boolean NOT NULL, + "date_ajout" text NOT NULL +) WITH (oids = false); + +INSERT INTO "taches" ("id", "texte", "accomplie", "date_ajout") VALUES +('6376542bcaa53', 'finir le projet de nosql', '0', '2022-11-17 15:32:59'), +('6376543154534', 'apprécier la puissance de docker', '0', '2022-11-17 15:33:05'), +('6376543653b77', 'finir la présentation en anglais', '0', '2022-11-17 15:33:10'); diff --git a/www/data/memo.json b/www/data/memo.json index 8471fbd89001ed6ce098b64fc1f59d0fa4a409e4..7667064c0f4a52708233084e851bfb34ba6c029f 100644 --- a/www/data/memo.json +++ b/www/data/memo.json @@ -1 +1 @@ -{"5defb94651ea3":{"texte":"finir le tp de prog web","accomplie":true,"dateAjout":"2019-12-10T15:27:02.000Z"},"5defb9a88e9a3":{"texte":"finir le tp d'animation ","accomplie":false,"dateAjout":"2019-12-10T15:28:40.000Z"},"5defbc36499e1":{"texte":"finir le tp de design","accomplie":true,"dateAjout":"2019-12-10T15:39:34.000Z"},"5defbc4b20c23":{"texte":"finir le tp de bdd","accomplie":false,"dateAjout":"2019-12-10T15:39:55.000Z"},"5defbc7418ff8":{"texte":"finir le tp de vid\u00e9o ","accomplie":true,"dateAjout":"2019-12-10T15:40:36.000Z"},"63763c41d6d4f":{"texte":"pr\u00e9parer la pr\u00e9sentation d'anglais","accomplie":true,"dateAjout":"2022-11-17 13:50:57"},"63764775e6206":{"texte":"finir projet nosql","accomplie":false,"dateAjout":"2022-11-17 14:38:45"},"637648750c469":{"texte":"finir projet web services","accomplie":false,"dateAjout":"2022-11-17 14:43:01"},"637648842e03f":{"texte":"appr\u00e9cier la puissance de docker","accomplie":false,"dateAjout":"2022-11-17 14:43:16"}} \ No newline at end of file +{"5defb94651ea3":{"texte":"finir le tp de prog web","accomplie":true,"dateAjout":"2019-12-10T15:27:02.000Z"},"5defb9a88e9a3":{"texte":"finir le tp d'animation ","accomplie":false,"dateAjout":"2019-12-10T15:28:40.000Z"},"5defbc36499e1":{"texte":"finir le tp de design","accomplie":true,"dateAjout":"2019-12-10T15:39:34.000Z"},"5defbc4b20c23":{"texte":"finir le tp de bdd","accomplie":false,"dateAjout":"2019-12-10T15:39:55.000Z"},"5defbc7418ff8":{"texte":"finir le tp de vid\u00e9o ","accomplie":true,"dateAjout":"2019-12-10T15:40:36.000Z"},"63763c41d6d4f":{"texte":"pr\u00e9parer la pr\u00e9sentation d'anglais","accomplie":true,"dateAjout":"2022-11-17 13:50:57"},"63764775e6206":{"texte":"finir projet nosql","accomplie":false,"dateAjout":"2022-11-17 14:38:45"},"637648750c469":{"texte":"finir projet web services","accomplie":false,"dateAjout":"2022-11-17 14:43:01"},"637648842e03f":{"texte":"appr\u00e9cier la puissance de docker","accomplie":false,"dateAjout":"2022-11-17 14:43:16"},"637652f339886":{"texte":"finir le projet nosql","accomplie":false,"dateAjout":"2022-11-17 15:27:47"},"6376543653b77":{"texte":"finir la pr\u00e9sentation en anglais","accomplie":false,"dateAjout":"2022-11-17 15:33:10"},"6376587328a8d":{"texte":"test","accomplie":false,"dateAjout":"2022-11-17 15:51:15"},"6376543154534":{"accomplie":true}} \ No newline at end of file diff --git a/www/index.php b/www/index.php index 645962534f49ffca4aa120731a9d8a5f526287b6..48c81d6aeda3a06fddeda6d51a299c722ef902fe 100644 --- a/www/index.php +++ b/www/index.php @@ -25,7 +25,7 @@ // Connexion à la base de données PostgreSQL $config = "pgsql:host=postgresql-memo;port=5432;dbname=postgres"; -$username = "user"; +$username = "admin"; $password = "password"; $db_connection = new PDO($config, $username, $password);