Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hgckc #9

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
ce6b3d4
Update package-lock.json
codezeron Mar 6, 2023
97df1cf
feat: configurado para entrar na porta 49160:1337 e criar imagem
codezeron Mar 27, 2023
9ea72fa
feat: add kustom argocd type
codezeron Mar 27, 2023
78e447f
Merge pull request #1 from codezeron/test-dev
codezeron Mar 27, 2023
2fc709c
feat: add resp do server com tempo agendado
codezeron Mar 31, 2023
ee643c2
feat: add cron with api response
codezeron Mar 31, 2023
639a100
Merge pull request #2 from codezeron/test-dev
codezeron Mar 31, 2023
c4ddc74
fix: config for deployment in argocd
codezeron Apr 5, 2023
83088a7
Merge pull request #3 from codezeron/test-dev
codezeron Apr 5, 2023
fd34519
fix: delete overlays files
codezeron Apr 5, 2023
b595ff8
Merge pull request #4 from codezeron/test-dev
codezeron Apr 5, 2023
8c84ad3
fix: ingress file
codezeron Apr 5, 2023
c0ba959
Merge pull request #5 from codezeron/test-dev
codezeron Apr 5, 2023
093e71e
fix: ingress spec seccion
codezeron Apr 5, 2023
bcbf957
Merge pull request #6 from codezeron/test-dev
codezeron Apr 5, 2023
f920d9a
fix: config for deployment in argocd
codezeron Apr 5, 2023
e5d7ca3
fix: all base files modify
codezeron Apr 5, 2023
d7c5045
fix: port 80 is server.js and cron.js
codezeron Apr 5, 2023
2555187
Merge pull request #7 from codezeron/test-dev
codezeron Apr 5, 2023
e56179f
feat: add heatlh check ingress
codezeron Apr 5, 2023
8e7c00a
Merge pull request #8 from codezeron/test-dev
codezeron Apr 5, 2023
838a510
Update cron.js
codezeron Apr 10, 2023
dc6f2ff
fix: port ingress and service
codezeron Apr 10, 2023
ff750e9
Merge pull request #9 from codezeron/test-dev
codezeron Apr 10, 2023
afb124a
Update ingress.yml
paulosilva3991 Apr 10, 2023
4c3438b
Merge pull request #10 from codezeron/paulosilva3991-patch-1
codezeron Apr 10, 2023
8add390
Update deployment.yml
paulosilva3991 Apr 10, 2023
dbc32c7
Update deployment.yml
paulosilva3991 Apr 10, 2023
962c0cc
Merge pull request #11 from codezeron/paulosilva3991-patch-1
codezeron Apr 10, 2023
751455e
Update ingress.yml
paulosilva3991 Apr 10, 2023
6b4ac37
Merge pull request #12 from codezeron/paulosilva3991-patch-1
codezeron Apr 10, 2023
9ffc130
fix: fix deploy manifest files
codezeron Apr 12, 2023
06eac9a
Merge branch 'master' into test-dev
codezeron Apr 12, 2023
c395b67
Merge pull request #13 from codezeron/test-dev
codezeron Apr 12, 2023
25c53cb
Update deployment.yml
codezeron Apr 12, 2023
4b7ceef
Update deployment.yml
codezeron Apr 12, 2023
790cf09
Update deployment.yml
codezeron Apr 12, 2023
41cb1c7
Merge pull request #14 from codezeron/deploy_no_regex
codezeron Apr 12, 2023
2ecd377
Revert "Update deployment.yml"
codezeron Apr 12, 2023
994903b
Merge pull request #15 from codezeron/revert-14-deploy_no_regex
codezeron Apr 12, 2023
f733411
Update README.md
codezeron Apr 12, 2023
c5d75cd
Update README.md
codezeron Apr 12, 2023
9037446
Update README.md
codezeron Apr 12, 2023
e0a065a
Update README.md
codezeron Apr 12, 2023
26a3cac
Update README.md
codezeron Apr 12, 2023
6666ad9
Update README.md
codezeron Apr 12, 2023
57c61c8
Update README.md
codezeron Apr 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
npm-debug.log
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM arm64v8/node:18.14-buster-slim

RUN apt-get update && apt-get upgrade -y


WORKDIR /SIMPLE-NODE-API

COPY ./package.json ./package.json
RUN npm install

COPY ./routes.js routes.js
COPY ./server.js server.js
COPY ./todos.js todos.js
COPY ./cron.js cron.js

EXPOSE 80
ENTRYPOINT [ "node", "cron" ]
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
# A Simple Nodejs API
## A Simple Nodejs API with OCI oke

First you must have kubectl and Argo-cd intalled on your oci's cluster <br>
`https://argo-cd.readthedocs.io/en/stable/getting_started`

Second, create app in Argo-cd server and write your custom namespace on "destination" space

After syncing, write on browser:
`http://144.22.248.251/testando/health`

It shoud return
`"OK"`

Where above ip is your LoadBalancer external ip, if you don't know, write:<br>
`kubectl get ingress --all-namespaces`
<br>
or
<br>
`kubectl get ingress -n <your_namespace>`

## Running the Application

1. Run `npm install`
2. Run `node server`
24 changes: 24 additions & 0 deletions cron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
var CronJob = require('cron').CronJob;
let porta = process.env.PORT || 80;
const { default: axios } = require('axios');
var express = require('express');
const http = require(`http`);
const app = express();
app.get(`/health`, (req, res) => res.status(200).json(`OK`));
const server = http.createServer(app);
server.listen(
porta,
() => console.log(`-- Backend Service (${porta}) --`)
);

const job = new CronJob('0 */1 * * * *', async function () {
try {
let response = await axios.get(process.env.CLIENT_URL)//configurar o CLIENT_URL=https://something/health
console.log('Resposta so servidor: OK', JSON.stringify(response.data))
} catch (error) {
console.log('ocorreu um erro:', JSON.stringify(error))
}

});
console.log('Resposta do servidor a cada minuto');
job.start();
Loading