From 68d2566522ba3c1b990cfb180c1c18fdede06a4b Mon Sep 17 00:00:00 2001 From: "Henrique V. Ehrenfried" <hvehrenfried@inf.ufpr.br> Date: Tue, 5 Jun 2018 11:45:21 -0300 Subject: [PATCH] Change default port --- Dockerfile | 11 +++++++++++ README.md | 28 +++++++++++++++++++++++++++- enviroment.js | 2 +- server/config.json | 2 +- server/datasources.json.homologa | 18 ++++++++++++++++++ 5 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 Dockerfile create mode 100644 server/datasources.json.homologa diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..52aa1dd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM node:latest + +RUN apt-get -y update -qq && apt-get install -y -qq apt-utils tree + +COPY . . + +RUN npm install + +EXPOSE 4001 + +CMD npm start \ No newline at end of file diff --git a/README.md b/README.md index 31d4f1d..ae82e7f 100644 --- a/README.md +++ b/README.md @@ -71,4 +71,30 @@ The result will be something similar to: { "category_name": "Categoria teste", "category_description": "Categoria usada para testar funcionalidades" -} \ No newline at end of file +} +``` + +## Deploy on SMPPIRHOMOLOGA + +Whenever you are ready to deploy, please change the `datasources.json` with the `datasources.json.homologa`. + +After that, you can use the Docker image: + +Para criar a imagem nova + +`sudo docker build --tag mapping-api .` + +Para exportar a imagem + +`sudo docker save -o ~/mapping-api.tar mapping-api` + +Para importar a image + +`sudo docker load -i ~/mapping-api.tar ` + +Para rodar a imagem + +`sudo docker run -d --rm -p 4001:4001 --net="host" --name mapping-api mapping-api` + + +:warning: O `-d` significa daemon, não quiser que o comando de rodar imagem rode em segundo plano, remova este argumento :warning: \ No newline at end of file diff --git a/enviroment.js b/enviroment.js index e8faa90..d72fa3f 100644 --- a/enviroment.js +++ b/enviroment.js @@ -1,4 +1,4 @@ -const URL = 'http://localhost:3000/api/'; +const URL = 'http://localhost:4001/api/'; const randomLowerCase = function() { let possible = 'abcdefghijklmnopqrstuvwxyz'; diff --git a/server/config.json b/server/config.json index ff5c9c9..440a939 100644 --- a/server/config.json +++ b/server/config.json @@ -1,7 +1,7 @@ { "restApiRoot": "/api", "host": "0.0.0.0", - "port": 3000, + "port": 4001, "remoting": { "context": false, "rest": { diff --git a/server/datasources.json.homologa b/server/datasources.json.homologa new file mode 100644 index 0000000..fec5524 --- /dev/null +++ b/server/datasources.json.homologa @@ -0,0 +1,18 @@ +{ + "db": { + "name": "db", + "connector": "memory" + }, + "SMPPIR_CheckIn2": { + "host": "localhost", + "port": 5432, + "url": "postgres://smppir:123mudar@localhost:5432/smppir_checkin?ssl=false", + "database": "smppir_checkin", + "password": "123mudar", + "name": "SMPPIR_CheckIn2", + "connector": "postgresql", + "user": "postgres", + "ssl": false + } + } + \ No newline at end of file -- GitLab