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

health check added #191

Open
wants to merge 65 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
6316a4a
yaml file added
tomavasi Aug 12, 2024
7d1775f
yml file update with date directory
tomavasi Aug 12, 2024
4685469
error fixed
tomavasi Aug 12, 2024
c3d3d31
pipeline.yml added
tomavasi Aug 12, 2024
9ce0167
another try
tomavasi Aug 12, 2024
0d2e7df
corrected mistakes
tomavasi Aug 12, 2024
c9c1a8c
changed export default to module.exports
tomavasi Aug 12, 2024
c6bf40d
changes in quotes
tomavasi Aug 13, 2024
bd8d7ff
changes on the linter
tomavasi Aug 13, 2024
de6e340
changes on yaml file
tomavasi Aug 13, 2024
9bb2a00
lint fixes
tomavasi Aug 13, 2024
4fc06eb
yaml update
tomavasi Aug 13, 2024
ef43059
package.json fixes
tomavasi Aug 13, 2024
68edbce
error fixed in PokemonPage
tomavasi Aug 13, 2024
542f271
playwirght tests added
tomavasi Aug 13, 2024
548c80b
changes for linter
tomavasi Aug 13, 2024
ff25aeb
only playwright tests
tomavasi Aug 13, 2024
898a9c1
only playwright tests
tomavasi Aug 13, 2024
3af1314
extra yaml file for playwright install
tomavasi Aug 13, 2024
e4e1fb7
build_step file added
tomavasi Aug 13, 2024
010435f
Update build_step.sh
tomavasi Aug 13, 2024
abea216
change ownership in yml
tomavasi Aug 13, 2024
555873e
Merge branch 'main' of https://github.com/tomavasi/full-stack-open-po…
tomavasi Aug 13, 2024
4a406bc
render pipeline deploy
tomavasi Aug 13, 2024
7fe8ef4
small change in pipeline
tomavasi Aug 13, 2024
251456c
change in app.js
tomavasi Aug 13, 2024
a366d27
app health
tomavasi Aug 13, 2024
b9c8e2a
Update app.js
tomavasi Aug 13, 2024
40739e9
Update app.js
tomavasi Aug 13, 2024
47ed767
pipeline changes
tomavasi Aug 13, 2024
f7c6419
Merge pull request #1 from tomavasi/secondary
tomavasi Aug 13, 2024
18bbd40
deploy only in merge/push
tomavasi Aug 13, 2024
f53de32
actions on secondary
tomavasi Aug 13, 2024
34a80d2
changes on yml file
tomavasi Aug 13, 2024
cd18979
small change pipeline
tomavasi Aug 13, 2024
680c01f
Merge pull request #2 from tomavasi/secondary
tomavasi Aug 13, 2024
b0c9391
versioning
tomavasi Aug 14, 2024
d38d026
Merge pull request #3 from tomavasi/secondary
tomavasi Aug 14, 2024
092d390
Update pipeline.yml
tomavasi Aug 14, 2024
311aad3
Merge pull request #4 from tomavasi/secondary
tomavasi Aug 14, 2024
b06593e
Update2 pipeline.yml
tomavasi Aug 14, 2024
1b3338e
Merge pull request #5 from tomavasi/secondary
tomavasi Aug 14, 2024
50744fc
Update and skip hello.yml
tomavasi Aug 14, 2024
f401644
Update and skip playwright.yml
tomavasi Aug 14, 2024
06cebd0
Update and skip playwright.yml
tomavasi Aug 14, 2024
8f727e4
some changes
tomavasi Aug 14, 2024
1f2b957
Merge branch 'secondary' of https://github.com/tomavasi/full-stack-op…
tomavasi Aug 14, 2024
3801a82
Update hello.yml
tomavasi Aug 14, 2024
3d15e8f
Update hello.yml
tomavasi Aug 14, 2024
2652db7
Update hello.yml
tomavasi Aug 14, 2024
9a24e80
Update hello.yml
tomavasi Aug 14, 2024
cb65e56
Update hello.yml
tomavasi Aug 14, 2024
8547013
Update hello.yml
tomavasi Aug 14, 2024
023ed2d
skip deployement and tagging
tomavasi Aug 14, 2024
ac4fd63
Merge branch 'main' into secondary
tomavasi Aug 14, 2024
e6e7667
Merge pull request #6 from tomavasi/secondary
tomavasi Aug 14, 2024
8701c62
skip all
tomavasi Aug 14, 2024
11abb36
merging
tomavasi Aug 14, 2024
ae378be
Merge pull request #7 from tomavasi/secondary
tomavasi Aug 14, 2024
9cc0d18
[skip]
tomavasi Aug 14, 2024
f695a7d
Merge pull request #8 from tomavasi/secondary
tomavasi Aug 14, 2024
5090cdb
testing webhooks
tomavasi Aug 14, 2024
42b6264
health check added #skip
tomavasi Aug 14, 2024
22c49f6
Merge branch 'main' into secondary
tomavasi Aug 14, 2024
9d0cbe7
Merge pull request #9 from tomavasi/secondary
tomavasi Aug 14, 2024
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
17 changes: 9 additions & 8 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ module.exports = {
"env": {
"browser": true,
"es6": true,
"jest/globals": true
"jest/globals": true,
"node": true
},
"extends": [
"eslint:recommended",
Expand All @@ -20,30 +21,30 @@ module.exports = {
],
"rules": {
"indent": [
"error",
1,
2
],
"linebreak-style": [
"error",
1,
"unix"
],
"quotes": [
"error",
1,
"single"
],
"semi": [
"error",
"never"
],
"eqeqeq": "error",
"no-trailing-spaces": "error",
"eqeqeq": 1,
"no-trailing-spaces": 1,
"object-curly-spacing": [
"error", "always"
],
"arrow-spacing": [
"error", { "before": true, "after": true }
],
"no-console": "error",
"no-console": "off",
"react/prop-types": 0
}
}
}
18 changes: 18 additions & 0 deletions .github/workflows/healthCheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Health check

on:
schedule:
- cron: '0 0 * * *'

jobs:
check-health:
runs-on: ubuntu-20.04
steps:
- name: Check the deployed service URL
uses: jtalk/url-health-check-action@v4
with:
url: https://full-stack-open-pokedex-cvtb.onrender.com/health
follow-redirect: false
max-attempts: 3
retry-delay: 5s
retry-all: false
88 changes: 88 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Deployment pipeline

on:
push:
branches:
- main
pull_request:
branches: [main, master]
types:
- opened
- synchronize

jobs:
build_and_test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Check style
run: npm run lint
- name: Build
run: npm run build
- name: Run playWright test
run: npx playwright install --with-deps && npm run test:e2e

notify-build:
needs: build_and_test
runs-on: ubuntu-20.04
steps:
- name: Build Success
uses: rjstone/discord-webhook-notify@v1
if: failure()
with:
severity: warn
details: Test webook Succeeded!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}


deploy:
needs: build_and_test
if: ${{ github.event_name == 'push' && !contains(join(github.event.commits.*.message, ' '), '#skip') }}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: 'Change ownership build file'
run: chmod -v +x build_step.sh
- name: Deploy to production
uses: johnbeynon/render-deploy-action@v0.0.8
with:
service-id: ${{ secrets.RENDER_SERVICE_ID }}
api-key: ${{ secrets.RENDER_API }}
wait-for-success: true

notify-deploy:
needs: deploy
runs-on: ubuntu-20.04
steps:
- name: Deployment Success
uses: rjstone/discord-webhook-notify@v1
if: success()
with:
severity: info
details: Deplyoment successful!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}

versioning:
needs: deploy
if: ${{ github.event_name == 'push' && !contains(join(github.event.commits.*.message, ' '), '#skip') }}
runs-on: ubuntu-20.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Bump version and push tag
uses: anothrNick/github-tag-action@v1
env:
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }}
DEFAULT_BUMP: 'patch'
WITH_V: true
PRERELEASE: true




6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
dist/
node_modules/
node_modules/
/test-results/
/playwright-report/
/blob-report/
/playwright/.cache/
22 changes: 16 additions & 6 deletions app.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
const express = require("express");
const app = express();
const express = require("express")

const app = express()

// get the port from env variable
const PORT = process.env.PORT || 5000;
const PORT = process.env.PORT || 5000

app.use(express.static("dist"));
app.use(express.static("dist"))

app.listen(PORT, () => {
console.log(`server started on port ${PORT}`);
});
console.log(`server started on port ${PORT}`)
})

app.get('/version', (req, res) => {
res.send('1') // change this string to ensure a new version deployed
})

app.get('/health', (req, res) => {
// eslint-disable-next-line no-constant-condition
res.send('ok')
})
8 changes: 8 additions & 0 deletions build_step.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

echo "Build script"

# add the commands here

npm install
npm run build
Loading