diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..52aa1dd3f788667537c5aa7e72ee93d7461f290e --- /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 31d4f1d6f49515b19a456f79629ce4c0e7fdff8f..ae82e7f2f25193f28e1ceff9117a5942d5b6c7c3 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 e8faa909d2bd1715542a0370e9e796ce3ae052cc..d72fa3fad943c2a5b3fffd5537e84e1f36b3f3fc 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 ff5c9c9d302706d42b389614189c6705e77c7430..440a9393de249fcc9717e193388bd1cdef90b55e 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 0000000000000000000000000000000000000000..fec5524b67a15405573a8bf974424153d9e9a5b4 --- /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