[Gandi][Simple Hosting] Déploiement d’une application Node.js
1) Répertoire de travail :
[~] ➔ mkdir -p GANDI/NODEJS [~] ➔ cd GANDI/NODEJS/ [~/GANDI/NODEJS] ➔
2) Création du répertoire de l’application :
[~/GANDI/NODEJS] ➔ mkdir -p monappli [~/GANDI/NODEJS] ➔ cd monappli/ [~/GANDI/NODEJS/monappli] ➔
3) Création d’un fichier de test :
Ouvrir :
server.js
Ajouter :
var http = require("http"); var port = process.env['PORT'] || 8080; http.createServer(function(req, res) { res.writeHead(200, {"Content-Type": "text/html; charset=utf-8"}); res.end('Mon appli' + " Mon appli Node.js
" + "Test"); }).listen(port); console.log("Server ready to accept requests on port %d", port);
4) Initialiser le dépôt :
[~/GANDI/NODEJS/monappli] ➔ git init
5) Ajouter la branche origin :
[~/GANDI/NODEJS/monappli] ➔ git remote add origin git+ssh://4899712@git.dc0.gpaas.net/default.git
6) Ajouter les fichiers :
[~/GANDI/NODEJS/monappli] ➔ git add -A
7) Committer la 1er version :
[~/GANDI/NODEJS/monappli] ➔ git commit -m "Version 0.0.1" [master (commit racine) bee41ce] Version 0.0.1 1 file changed, 10 insertions(+) create mode 100644 defaults/server.js [~/GANDI/NODEJS/monappli] ➔
8) Pousser le commit vers le dépôt distant :
[~/GANDI/NODEJS/monappli] ➔ git push origin master 4899712@git.dc0.gpaas.net's password: Counting objects: 4, done. Delta compression using up to 2 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (4/4), 555 bytes | 0 bytes/s, done. Total 4 (delta 0), reused 0 (delta 0) To git+ssh://4899712@git.dc0.gpaas.net/default.git * [new branch] master -> master [~/GANDI/NODEJS/monappli] ➔
9) A partir de la page d’information de l’instance :
Activer la console
10) Déployer l’application :
[~/GANDI/NODEJS/monappli] ➔ ssh 4899712@git.dc0.gpaas.net 'deploy default.git' initializing builder ..................builder ready Vm password: Grabbing terminal Ok -----> Starting new deployment (default - master) -----> Fetching application code -----> Building new application Using Node.js version v0.12.7 Warning: until December 1st, 2015, we're using server.js in priority to start your application. For more information, please refer to your application's logs or the documentation. --------------------------- https://docs.npmjs.com/files/package.json http://wiki.gandi.net/simple/instance/nodejs --------------------------- -----> Copying new application sending incremental file list defaults/ defaults/server.js sent 529 bytes received 35 bytes 1128.00 bytes/sec total size is 418 speedup is 0.74 -----> Build complete -----> Cleaning temporary files [~/GANDI/NODEJS/monappli] ➔
11) Tester :
http://e048ae3035.url-de-test.ws/
Comments are closed, but trackbacks and pingbacks are open.