From 7e66ebc108c5ac7b6ec2c99796b6e7b2c35a52a7 Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Mon, 3 Dec 2018 11:38:14 +0100 Subject: [PATCH 01/14] nom et prenom nom et prenom --- answers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/answers.md b/answers.md index b7025b97..3efcfdda 100644 --- a/answers.md +++ b/answers.md @@ -1,7 +1,7 @@ # Answers -Lastname: -Firstname: +Lastname:BERTHET BONDET +Firstname: Aldric ## 2.2 command: From 4e2e7862af5b866984159ebf1f16241fa9806636 Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Mon, 3 Dec 2018 12:09:51 +0100 Subject: [PATCH 02/14] new file index3.js --- index3.js | 699 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 699 insertions(+) create mode 100644 index3.js diff --git a/index3.js b/index3.js new file mode 100644 index 00000000..a205a3ff --- /dev/null +++ b/index3.js @@ -0,0 +1,699 @@ +const express = require('express'); +const mysql = require('mysql'); +const bodyParser = require('body-parser'); +const app = express(); + +app.use(bodyParser.urlencoded({ extended: true })); + +var db = mysql.createConnection({ + host: "localhost", + user: "root", + password: "root", + database: "zoo", + port: "3307" +}); + + + +/*********************************** +FIRWALL +************************************/ + +app.use(function(req, res, next) { + + if ("key" in req.query) + { + + var key = req.query["key"]; + var query = "SELECT * FROM users WHERE apikey='" + key + "'"; + + db.query(query, function(err, result, fields) { + + if (err) throw err; + if (result.length > 0) + { + next(); + } + + else + { + //res.send("Access denied, could not verify token value",403); + res.status(403).send("Access denied, could not verify token value"); + } + + }); + } + + else + { + //res.send("Access denied could not verify token value",403); + res.status(403).send("Access denied, could not verify token value"); + } + +}); + + + +/*********************************** +Fonction Filtres +************************************/ + + +function mesFiltres(req,res,query,conditions) +{ + for (var index in conditions) { + + if (conditions[index] in req.query) { + + if (query.indexOf("WHERE") < 0) { + query += " WHERE"; + + } else { + query += " AND"; + } + + query += " " + conditions[index] + "='" + req.query[conditions[index]] + "'"; + } + } + + + if ("sort" in req.query) { + + var sort = req.query["sort"].split(","); + query += " ORDER BY"; + + for (var index in sort) { + + var direction = sort[index].substr(0, 1); + var field = sort[index].substr(1); + + query += " " + field; + + if (direction == "-") + query += " DESC,"; + + else + query += " ASC,"; + } + + + query = query.slice(0, -1); + } + + + + if ("fields" in req.query) { + + query = query.replace("*", req.query["fields"]); + } + + + + if ("limit" in req.query) { + + query += " LIMIT " + req.query["limit"]; + + if ("offset" in req.query) { + + query += " OFFSET " + req.query["offset"]; + } + } + + + + db.query(query, function(err, result, fields) { + + if (err) throw err; + res.send(JSON.stringify(result)); + }); + +} + +function partialUpdate(req,res,query,conditions,id) +{ + + for (var index in conditions) + { + if (conditions[index] in req.body) + { + if (query.indexOf( "SET" ) < 0 ) + { + query+=" SET"; + } + + else + { + query+=","; + } + + query+= " " + conditions[index] + "='" + req.body[conditions[index]] +"'"; + } + } + + query+= " WHERE id="+id; + + console.log(query); + db.query(query, function (err, result, fields) { + if (err) throw err; + res.send( JSON .stringify("Success")); + }); +} + +/********************************************************** +ANIMALS +**********************************************************/ +app.post('/animals', function(req, res) { + + //on définit les variables + var nom = req.body.name; + var race = req.body.breed; + var nourriture = req.body.food_per_day; + var dateN = req.body.birthday; + var dateEZ = req.body.entry_date; + var cage = req.body.id_cage; + + var query = "INSERT INTO animals (name, breed, food_per_day, birthday, entry_date, id_cage) VALUES ('"+nom+"', '" +race + "', '"+nourriture+"', '"+dateN+"', '"+dateEZ+"','"+cage+"')"; + + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify("Success")); + }); + +}); + + +//get all animals with and without filters +app.get('/animals', function(req, res) { + + var query = "SELECT * FROM animals"; + var conditions = ["id","name","breed","food_per_day","birthday","entry_date","id_cage"]; + + mesFiltres(req,res,query,conditions); + +}); + + +//get an animal using its id +app.get('/animals/:id(\\d+)', function(req, res) { + + var id = req.params.id; + var query = "SELECT * FROM animals WHERE id=" + id; + + //filters + if ("fields" in req.query) + { + // le paramètre * sera remplcé par les colonnes à afficher + query = query.replace("*", req.query["fields"]); + } + + query += ";"; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify(result)); + }); + +}); + + +//update an animal (full update) +app.put('/animals/:id(\\d+)', function(req, res) { + + var id = req.params.id; + + //var query = "UPDATE animals SET (nom, race, nourriture, date_naissance, date_entree_zoo, cage) = '"+nom+"', '" +race + "', '"+nourriture+"', '"+dateN+"', '"+dateEZ+"','"+cage+"' WHERE id=" + id; + var query = "UPDATE animals"; + var conditions = ["id","name","breed","food_per_day","birthday","entry_date","id_cage"]; + partialUpdate(req,res,query,conditions,id); + +}); + + +app.delete('/animals', function(req, res) { + + var query = "DELETE FROM animals"; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify("Success")); + }); + +}); + + +app.delete('/animals/:id(\\d+)', function(req, res) { + + var id = req.params.id; + var query = "DELETE FROM animals WHERE id=" + id; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify("Success")); + }); + +}); + + + +/********************************************************** +CAGE +**********************************************************/ + +//create some cages +app.post('/cages', function(req, res) { + + //on définit les variables + var nom = req.body.name; + var description= req.body.description; + var taille= req.body.area; + + var query = "INSERT INTO cages (name, description, area) VALUES ('"+nom+"', '" +description+ "', '"+taille+"')"; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify("Success")); + }); + +}); + + +//get all cages (with and without filters) +app.get('/cages', function(req, res) { + + var query = "SELECT * FROM cages"; + var conditions = ["id","name","description","area"]; + + mesFiltres(req,res,query,conditions); + +}); + +//get an cage using its id +app.get('/cages/:id(\\d+)', function(req, res) { + + var id = req.params.id; + var query = "SELECT * FROM cages WHERE id=" + id; + + //filters + if ("fields" in req.query) + { + // le paramètre * sera remplcé par les colonnes à afficher + query = query.replace("*", req.query["fields"]); + } + + query += ";"; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify(result)); + }); + +}); + + +//update a cages (full and partial update) +app.put('/cages/:id(\\d+)', function(req, res) { + + var id = req.params.id; + + //var query = "UPDATE animals SET (nom, race, nourriture, date_naissance, date_entree_zoo, cage) = '"+nom+"', '" +race + "', '"+nourriture+"', '"+dateN+"', '"+dateEZ+"','"+cage+"' WHERE id=" + id; + var query = "UPDATE cages"; + var conditions = ["id","name","description","area"]; + partialUpdate(req,res,query,conditions,id); + +}); + + +app.delete('/cages', function(req, res) { + + var query = "DELETE FROM cages"; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify("Success")); + }); + +}); + + +app.delete('/cages/:id(\\d+)', function(req, res) { + + var id = req.params.id; + var query = "DELETE FROM cages WHERE id=" + id; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify("Success")); + }); + +}); + + + +/********************************************************** +NOURRITURE +**********************************************************/ + +//create some food +app.post('/food', function(req, res) { + + //on définit les variables + var nom = req.body.name; + var animal = req.body.id_animal; + var quantite = req.body.quantity; + + var query = "INSERT INTO food (name, quantity, id_animal) VALUES ('"+nom+"', '" +quantite+ "', '"+animal+"')"; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify("Success")); + }); + +}); + + +//get all food (with and without filters) +app.get('/food', function(req, res) { + + var query = "SELECT * FROM food"; + var conditions = ["id","name","quantity","id_animal"]; + + mesFiltres(req,res,query,conditions); + +}); + + + +//get food using its id +app.get('/food/:id(\\d+)', function(req, res) { + + var id = req.params.id; + var query = "SELECT * FROM food WHERE id=" + id; + + //filters + if ("fields" in req.query) + { + // le paramètre * sera remplcé par les colonnes à afficher + query = query.replace("*", req.query["fields"]); + } + + query += ";"; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify(result)); + }); + +}); + + + +//update food (full and partial update) +app.put('/food/:id(\\d+)', function(req, res) { + + var id = req.params.id; + + //var query = "UPDATE animals SET (nom, race, nourriture, date_naissance, date_entree_zoo, cage) = '"+nom+"', '" +race + "', '"+nourriture+"', '"+dateN+"', '"+dateEZ+"','"+cage+"' WHERE id=" + id; + var query = "UPDATE food"; + var conditions = ["id","name","quantity","id_animal"]; + partialUpdate(req,res,query,conditions,id); + +}); + + + +app.delete('/food', function(req, res) { + + var query = "DELETE FROM food"; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify("Success")); + }); + +}); + + +app.delete('/food/:id(\\d+)', function(req, res) { + + var id = req.params.id; + var query = "DELETE FROM food WHERE id=" + id; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify("Success")); + }); + +}); + + +/********************************************************** +PERSONNEL +**********************************************************/ + +//create staff +app.post('/staff', function(req, res) { + + //on définit les variables + var prenom = req.body.firstname; + var nom = req.body.lastname; + var salaire = req.body.wage; + + var query = "INSERT INTO staff (firstname, lastname, wage) VALUES ('"+prenom+"', '" +nom+ "', '"+salaire+"')"; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify("Success")); + }); + +}); + + +//get all staff (with and without filters) +app.get('/staff', function(req, res) { + + var query = "SELECT * FROM staff"; + var conditions = ["id","firstname","lastname","wage"]; + + mesFiltres(req,res,query,conditions); + +}); + +//get staff using its id +app.get('/staff/:id(\\d+)', function(req, res) { + + var id = req.params.id; + var query = "SELECT * FROM staff WHERE id=" + id; + + //filters + if ("fields" in req.query) + { + // le paramètre * sera remplcé par les colonnes à afficher + query = query.replace("*", req.query["fields"]); + } + + query += ";"; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify(result)); + }); + +}); + + +//update staff (full and partial update) +app.put('/staff/:id(\\d+)', function(req, res) { + + var id = req.params.id; + + //var query = "UPDATE animals SET (nom, race, nourriture, date_naissance, date_entree_zoo, cage) = '"+nom+"', '" +race + "', '"+nourriture+"', '"+dateN+"', '"+dateEZ+"','"+cage+"' WHERE id=" + id; + var query = "UPDATE staff"; + var conditions = ["id","firstname","lastname","wage"]; + partialUpdate(req,res,query,conditions,id); + +}); + + + +app.delete('/staff', function(req, res) { + + var query = "DELETE FROM staff"; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify("Success")); + }); + +}); + + +app.delete('/staff/:id(\\d+)', function(req, res) { + + var id = req.params.id; + var query = "DELETE FROM staff WHERE id=" + id; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify("Success")); + }); + +}); + + + + +/************************ +on crée une route capable d'afficher toutes les informations de la cage si on entre l'id de l'animal +on crée une deuxième route capable d'afficher toutes les informations sur la nourriture si on entre l'id de l'animal +on crée une troisième route capable d'afficher toutes les infos de l'animal si on entre l'id de la cage +on crée une quatrième route capable d'afficher toutes les infos sur l'animal avec l'id de la nourriture +************************/ + + + +/************************ +on crée une route capable d'afficher toutes les informations de la cage si on entre l'id de l'animal +************************/ + +app.get('/animals/:id/cages', function(req, res) { + + var id = req.params.id; + var query = "SELECT cages.* FROM animals INNER JOIN cages ON animals.id_cage = cages.id WHERE animals.id=" + id; + var conditions = ["id","name","description","area"]; + + mesFiltres(req,res,query,conditions); + +}); + + +app.get('/animals/:id/cages/:id_data', function(req, res) { + + var id_user = req.params.id; + var id_data = req.params.id_data; + + var query = "SELECT cages.* FROM animals INNER JOIN cages ON animals.id_cage = cages.id WHERE animals.id=" + id_user + " AND cages.id=" +id_data; + var conditions = ["id","name","description","area"]; + + mesFiltres(req,res,query,conditions); + +}); + + + +/************************ +on crée une deuxième route capable d'afficher toutes les informations sur la nourriture si on entre l'id de l'animal +************************/ + +app.get('/animals/:id/food', function(req, res) { + + var id = req.params.id; + var query = "SELECT food.* FROM animals INNER JOIN food ON animals.id = food.id_animal WHERE animals.id=" + id; + + var conditions = ["id","name","quantity","id_animal"]; + + mesFiltres(req,res,query,conditions); + +}); + +app.get('/animals/:id/food/:id_data', function(req, res) { + + var id_user = req.params.id; + var id_data = req.params.id_data; + + var query = "SELECT food.* FROM animals INNER JOIN food ON animals.id = food.id_animal WHERE animals.id=" + id_user + " AND food.id=" +id_data; + + var conditions = ["id","name","quantity","id_animal"]; + + mesFiltres(req,res,query,conditions); + +}); + + +/************************ +on crée une troisième route capable d'afficher toutes les infos de l'animal si on entre l'id de la cage +************************/ + +app.get('/cages/:id/animals', function(req, res) { + + var id = req.params.id; + var query = "SELECT animals.* FROM cages INNER JOIN animals ON cages.id = animals.id_cage WHERE cages.id=" + id; + + var conditions = ["id","name","breed","food_per_day", "birthday","entry_date","id_cage"]; + + mesFiltres(req,res,query,conditions); + +}); + +app.get('/cages/:id/animals/:id_data', function(req, res) { + + var id_user = req.params.id; + var id_data = req.params.id_data; + + var query = "SELECT animals.* FROM cages INNER JOIN animals ON cages.id = animals.id_cage WHERE cages.id=" + id_user + " AND animals.id=" +id_data; + + var conditions = ["id","name","breed","food_per_day", "birthday","entry_date","id_cage"]; + + mesFiltres(req,res,query,conditions); + +}); + + +/************************ +on crée une quatrième route capable d'afficher toutes les infos sur l'animal avec l'id de la nourriture +************************/ + +app.get('/food/:id/animals', function(req, res) { + + var id = req.params.id; + var query = "SELECT animals.* FROM food INNER JOIN animals ON food.id_animal = animals.id WHERE food.id=" + id; + + var conditions = ["id","name","breed","food_per_day", "birthday","entry_date","id_cage"]; + + mesFiltres(req,res,query,conditions); + +}); + +app.get('/food/:id/animals/:id_data', function(req, res) { + + var id_user = req.params.id; + var id_data = req.params.id_data; + + var query = "SELECT animals.* FROM food INNER JOIN animals ON food.id_animal = animals.id WHERE food.id=" + id_user + " AND animals.id=" +id_data; + + var conditions = ["id","name","breed","food_per_day", "birthday","entry_date","id_cage"]; + + mesFiltres(req,res,query,conditions); + +}); + + +/**************************************** +FOOD PER DAY +*******************************************/ +app.get('/food-stats', function(req, res) { + + + //var query = "SELECT animals.id as id, IFNULL(food.quantity/animals.food_per_day,0) as days_left FROM food INNER JOIN animals ON food.id_animal = animals.id"; + + var query = "SELECT animals.id as id, COALESCE(food.quantity/animals.food_per_day,0) as days_left FROM food INNER JOIN animals ON food.id_animal = animals.id"; + + db.query(query, function(err, result, fields) { + if (err) throw err; + res.send(JSON.stringify(result)); + }); + +}); + + + +app.listen(3000, function() { + + db.connect(function(err) { + + if (err) throw err; + console.log('Connection to database successful!'); + }); + + console.log('Example app listening on port 3000!'); +}); \ No newline at end of file From 3346ba543ede44d1a1c51d9cd39a75cfdefbe833 Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Tue, 18 Dec 2018 12:28:12 +0100 Subject: [PATCH 03/14] dockerfile --- Dockerfile | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..e1b8a4f2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,5 @@ +FROM node:8.14.0-alpine +copy ./root +RUN npm install express mysql +CMD node /root/zoo.js +EXPOSE 3010 \ No newline at end of file From 0a2afe7274bad23ac49ad2aac13e9dd9acf74a16 Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Tue, 18 Dec 2018 12:34:35 +0100 Subject: [PATCH 04/14] change dockerfile --- Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index e1b8a4f2..32416817 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ FROM node:8.14.0-alpine -copy ./root RUN npm install express mysql -CMD node /root/zoo.js +CMD node /index3.js EXPOSE 3010 \ No newline at end of file From c1dc03a292fd81c918548ee03cf85513e50275cd Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Tue, 18 Dec 2018 12:38:14 +0100 Subject: [PATCH 05/14] change file --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 32416817..620fc0b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ FROM node:8.14.0-alpine RUN npm install express mysql -CMD node /index3.js +CMD node index3.js EXPOSE 3010 \ No newline at end of file From a3547885ebf05bb3855d47a1d0f8db2d87d2634d Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Tue, 18 Dec 2018 12:40:19 +0100 Subject: [PATCH 06/14] change file --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 620fc0b0..2acde7fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ FROM node:8.14.0-alpine +copy index3.js RUN npm install express mysql CMD node index3.js EXPOSE 3010 \ No newline at end of file From b21a996aad0f0b542f764e8ce3d9840ba14315b8 Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Tue, 18 Dec 2018 12:42:02 +0100 Subject: [PATCH 07/14] changes --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 2acde7fa..83dddd63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ FROM node:8.14.0-alpine -copy index3.js +copy index3.js ./ RUN npm install express mysql CMD node index3.js EXPOSE 3010 \ No newline at end of file From e4bc96545d88091fd3d367019f20facbdf498e02 Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Tue, 18 Dec 2018 12:54:54 +0100 Subject: [PATCH 08/14] change --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 83dddd63..5b094a8e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,4 +2,4 @@ FROM node:8.14.0-alpine copy index3.js ./ RUN npm install express mysql CMD node index3.js -EXPOSE 3010 \ No newline at end of file +EXPOSE 3010 \ No newline at end of file From 4501f5a7f5a8e55041bf6c2f35edfedc2c2b52f0 Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Tue, 18 Dec 2018 13:47:00 +0100 Subject: [PATCH 09/14] change in js --- index3.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/index3.js b/index3.js index a205a3ff..eade647f 100644 --- a/index3.js +++ b/index3.js @@ -6,11 +6,11 @@ const app = express(); app.use(bodyParser.urlencoded({ extended: true })); var db = mysql.createConnection({ - host: "localhost", - user: "root", - password: "root", - database: "zoo", - port: "3307" + host: process.env.MYSQL_HOST, + user: proces.nv.MYSQL_LOGIN, + password: process.env.MYSQL_PASSWORD, + database: process.env.MYSQL_DATABASE, + port: process.env.MYSQL_PORT }); From 469844df37174f728ccbde2f8e3566217fcd45bf Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Tue, 18 Dec 2018 14:31:40 +0100 Subject: [PATCH 10/14] docker compose et answers.md --- answers.md | 41 ++++++++++++++++++++++++++--------------- docker-compose.yml | 4 ++++ 2 files changed, 30 insertions(+), 15 deletions(-) create mode 100644 docker-compose.yml diff --git a/answers.md b/answers.md index 3efcfdda..b386040b 100644 --- a/answers.md +++ b/answers.md @@ -4,34 +4,45 @@ Lastname:BERTHET BONDET Firstname: Aldric ## 2.2 -command: +command: docker run aldric ## 2.3 -question: -command: +question: L'accès n'est pas autorisé pour cause de port non ouvert. Il faut alors relancer notre container en ouvrant le port concerné +command: sudo docker run -p 3000:3000 -td aldric ## 2.5 -question: -command: +question: Il faut changer le tag +command: docker tag 77d21cd3e40d hogun/devops-lab:latest +command: docker push hogun/devops-lab:latest ## 2.6 -command: +command: sudo docker system prune -a -question: -command: +question: il faut pull l'image +command: sudo docker pull hogun/devops-lab -command: +command: sudo docker create hogun/devops-lab +command: sudo docker run --detach hogun/devops-lab ## 2.7 -question: -question: -command: +question: (goofy_zhukovsky) +question: rename file to api_web_js + +command: sudo docker ps -a +command: sudo docker rename goofy_zhukovsky api_web_js + -command: ## 2.8 -question: -output: +question: NAme : ALpine Linux +output: +3.8.1 +NAME="Alpine Linux" +ID=alpine +VERSION_ID=3.8.1 +PRETTY_NAME="Alpine Linux v3.8" +HOME_URL="http://alpinelinux.org" +BUG_REPORT_URL="http://bugs.alpinelinux.org" ## 3.1 command: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..e99fb15a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,4 @@ +version: '3' +services: + my-service: + image: my-image \ No newline at end of file From bd377b34201bd2cd8c95ffc953c40ff8491034b1 Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Tue, 18 Dec 2018 14:48:11 +0100 Subject: [PATCH 11/14] docker compose --- docker-compose.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index e99fb15a..c1abc494 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,16 @@ version: '3' services: my-service: - image: my-image \ No newline at end of file + + ports: + - "3000:80" + + environment: + - MYSQL_HOST=localhost + - MYSQL_LOGIN=root + - MYSQL_PASSWORD=root + - MYSQL_DATABASE=zoo + - MYSQL_PORT=3307 + + image: hogun/devops-lab + \ No newline at end of file From 8008b82ce7fee4e1a82e74cdcb6fb662a3c1c934 Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Tue, 18 Dec 2018 14:50:12 +0100 Subject: [PATCH 12/14] changes --- answers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/answers.md b/answers.md index b386040b..d4740c5b 100644 --- a/answers.md +++ b/answers.md @@ -25,8 +25,8 @@ command: sudo docker create hogun/devops-lab command: sudo docker run --detach hogun/devops-lab ## 2.7 -question: (goofy_zhukovsky) -question: rename file to api_web_js +question: Nom du fichier actuel : goofy_zhukovsky +question: On renomme le fichier avec le nom : api_web_js command: sudo docker ps -a command: sudo docker rename goofy_zhukovsky api_web_js From dddb24fe69316b940f2916bf079eae6cca45e1aa Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Tue, 18 Dec 2018 15:25:58 +0100 Subject: [PATCH 13/14] changes --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index c1abc494..6f2ef30a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ services: my-service: ports: - - "3000:80" + - "3000:3000" environment: - MYSQL_HOST=localhost From 4a5763ee7962191945be044b168414af1e2f168c Mon Sep 17 00:00:00 2001 From: GreySpectre Date: Tue, 18 Dec 2018 15:29:56 +0100 Subject: [PATCH 14/14] changes --- answers.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/answers.md b/answers.md index d4740c5b..5fbf01bc 100644 --- a/answers.md +++ b/answers.md @@ -45,8 +45,8 @@ HOME_URL="http://alpinelinux.org" BUG_REPORT_URL="http://bugs.alpinelinux.org" ## 3.1 -command: +command: sudo docker-compose up ## 3.4 -command: -command: +command: sudo docker-compose up -d +command: sudo docker-compose logs