Skip to content

Commit

Permalink
fix: update build script and healthz endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
sydrawat01 committed Jan 12, 2024
1 parent ef83b32 commit ec3fcb6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/packer-build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Instance Refresh
name: Build

on:
workflow_dispatch:
Expand All @@ -8,6 +8,23 @@ jobs:
tests:
runs-on: ubuntu-latest
environment: ${{ vars.ENVIRONMENT }}
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_DB: ${{ vars.DATABASE }}
POSTGRES_USER: ${{ vars.DBUSER }}
POSTGRES_PASSWORD: ${{ secrets.DBPASSWORD }}
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
name: Run unit tests
steps:
- uses: actions/checkout@v4
Expand Down
3 changes: 2 additions & 1 deletion aws/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ echo "|
echo "| INSTALL SCRIPT v1.0 |"
echo "| |"
echo "+-----------------------------------------------------------------------------------------------------------------------------------------+"
sudo apt-get update --quiet && sudo apt-get upgrade -y

# Install zip and unnzip
echo "+-----------------------------------------------------------------------------------------------------------------------------------------+"
Expand Down Expand Up @@ -105,7 +106,7 @@ echo "|
echo "| Installing AWS Cloudwatch Agent |"
echo "| |"
echo "+-----------------------------------------------------------------------------------------------------------------------------------------+"
wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
wget -q https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb
AWSCLDWTCH=$?
if [ $AWSCLDWTCH -eq 0 ]; then
sleep 5
Expand Down
2 changes: 1 addition & 1 deletion src/routes/health.route.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import { health } from '../controllers/health.controller.js'
const router = express.Router()

router.get('/', health)
router.get('/health', health)
router.get('/healthz', health)

export { router as healthRoute }
2 changes: 1 addition & 1 deletion tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import app from '../app.js'
describe('Unit Test Suite', () => {
it('GET /health API endpoint', (done) => {
supertest(app)
.get('/health')
.get('/healthz')
.expect(200)
.end((err, res) => {
if (err) return done(err)
Expand Down

0 comments on commit ec3fcb6

Please sign in to comment.