Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
864290c
Add sonar scanner
rydrafi13 May 27, 2023
ac945f0
Add .env
rydrafi13 May 27, 2023
a56c38d
update coverage
rydrafi13 May 27, 2023
d8c3c7c
Update
rydrafi13 May 27, 2023
507b4fd
coverage delete
rydrafi13 May 27, 2023
7ab918d
Update
rydrafi13 May 27, 2023
9712c6a
update
rydrafi13 May 27, 2023
1f9a7bc
Update
rydrafi13 May 27, 2023
227a27f
Update coverage
rydrafi13 May 27, 2023
518d7c9
add coverage
rydrafi13 May 27, 2023
489d2f1
Test
rydrafi13 May 27, 2023
295fe3a
Test
rydrafi13 May 27, 2023
c645a3e
Test
rydrafi13 May 27, 2023
9681840
Test
rydrafi13 May 27, 2023
ee27d92
Test
rydrafi13 May 27, 2023
23f17df
Test
rydrafi13 May 27, 2023
e262a46
Test
rydrafi13 May 27, 2023
7c98f99
Test
rydrafi13 May 27, 2023
7bc647f
Fix Main branch
rydrafi13 May 27, 2023
70ff7d6
Fix main branch
rydrafi13 May 27, 2023
3b0cb75
Finished fix main branch
rydrafi13 May 27, 2023
50ade3a
Update Main Branch
rydrafi13 May 28, 2023
8d306f9
Update Main Branch
rydrafi13 May 28, 2023
595f5d5
Update test
Jun 13, 2023
1b99215
Update env
Jun 14, 2023
d263886
Merge branch 'main' of github.com:IDN-Training/simple-apps
Jun 14, 2023
f5944cf
Remove env
Jun 14, 2023
94680fe
Update
Jun 14, 2023
19e013a
Fix Problem
Jun 14, 2023
f52b816
Push
Jun 14, 2023
256b7a0
Update README.md
rydrafi13 Jan 5, 2024
011801b
Update README.md
rydrafi13 Jan 5, 2024
0889663
Update README.md
rydrafi13 Jan 5, 2024
17dcf8b
modify file index.html
15ahmadsolihin Oct 4, 2025
dacd6d0
add env
15ahmadsolihin Oct 4, 2025
40eae1b
Update index.html
15ahmadsolihin Oct 4, 2025
09d5e10
add file sonar properties
15ahmadsolihin Oct 5, 2025
4887c04
Merge branch 'main' of https://github.com/15ahmadsolihin/simple-apps
15ahmadsolihin Oct 5, 2025
7412a06
add dockerfile
15ahmadsolihin Oct 11, 2025
04231e5
add file docker-compose
15ahmadsolihin Oct 11, 2025
43113c8
modify sonarproperties
15ahmadsolihin Oct 11, 2025
0ea18e1
modify2 sonarproperties
15ahmadsolihin Oct 11, 2025
6d6f461
modified3 sonarproperties
15ahmadsolihin Oct 11, 2025
9e7e780
add trigger index. html
15ahmadsolihin Oct 11, 2025
6533e20
add jenkins file
15ahmadsolihin Oct 12, 2025
55a4c8b
add modify
15ahmadsolihin Oct 12, 2025
cd53243
add modfied
15ahmadsolihin Oct 12, 2025
505add2
remove npm coverage
15ahmadsolihin Oct 12, 2025
569897e
modif sonar for pipeline
15ahmadsolihin Oct 12, 2025
b5b6fe4
modify add deploy
15ahmadsolihin Oct 12, 2025
5736128
add image to dockerhub
15ahmadsolihin Oct 12, 2025
ea44340
modify
15ahmadsolihin Oct 12, 2025
37ab482
modify
15ahmadsolihin Oct 12, 2025
e13c69a
modify
15ahmadsolihin Oct 12, 2025
cec9e6e
modify
15ahmadsolihin Oct 12, 2025
8f15523
update Dockerfile to use Node.js 20-slim and improve COPY instructions
15ahmadsolihin Dec 20, 2025
eeb1b89
restore docker-compose configuration from backup
15ahmadsolihin Dec 20, 2025
dfab0c0
update
15ahmadsolihin Dec 20, 2025
c642555
update file env
15ahmadsolihin Dec 21, 2025
50d82d6
update index file
15ahmadsolihin Dec 21, 2025
3109935
create file jenkins
15ahmadsolihin Dec 21, 2025
fecd106
update
15ahmadsolihin Dec 21, 2025
f524f3f
update jenkinsfile
15ahmadsolihin Dec 21, 2025
c3ec584
update index file
15ahmadsolihin Dec 21, 2025
c4d954d
update index
15ahmadsolihin Dec 21, 2025
13b47b2
update 13:54
15ahmadsolihin Dec 21, 2025
36fd862
buat index2.html
15ahmadsolihin Dec 21, 2025
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
57 changes: 57 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
pipeline {
agent { label 'server6-solihin' }

stages {
stage('Pull SCM') {
steps {
git branch: 'main', url: 'https://github.com/15ahmadsolihin/simple-apps.git'
}
}

stage('Build') {
steps {
sh'''
cd app
npm install
'''
}
}

stage('Testing') {
steps {
sh'''
cd app
APP_PORT=50001 npm test
APP_PORT=50001 npm run test:coverage
'''
}
}

// stage('Code Review') {
// steps {
// sh'''
// cd app
// sonar-scanner \
// -Dsonar.projectKey=Simple-Apps \
// -Dsonar.sources=. \
// -Dsonar.host.url=http://172.23.x.x:9000 \
// -Dsonar.login=token-sonar
// '''
// }
// }

stage('Deploy') {
steps {
sh'''
docker compose up --build -d
'''
}
}

stage('Backup') {
steps {
sh 'docker compose push'
}
}
}
}
5 changes: 5 additions & 0 deletions app/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
DB_NAME=training
DB_HOST=172.23.7.116
DB_USER=peserta
DB_PASS=password
APP_PORT=3000
7 changes: 7 additions & 0 deletions app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM node:20-slim
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
EXPOSE 3000
CMD ["npm", "start"]
13 changes: 13 additions & 0 deletions app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Create env variable

```
vim .env
```

```
DB_NAME=training
DB_HOST=ipaddress
DB_USER=peserta
DB_PASS=password
APP_PORT=3000
```
6 changes: 3 additions & 3 deletions app.js → app/app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const express = require('express')
const mysql = require('mysql');
const app = express()
const PORT = process.env.PORT || 3000;
const path = require('path')
require('dotenv').config();

// Import Middleware
const logger = require('./middleware/logger')
Expand Down Expand Up @@ -31,8 +31,8 @@ app.get('/users', (req, res, next) => {
})
});

app.listen(PORT, () => {
console.log(`Example app listening on port ${PORT}`)
app.listen(process.env.APP_PORT, () => {
console.log(`Example app listening on port ${process.env.APP_PORT}`)
})

module.exports = app
File renamed without changes.
12 changes: 12 additions & 0 deletions app/middleware/db_connect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const mysql = require('mysql')
require('dotenv').config();

// Connect database
const connection = mysql.createConnection({
host: process.env.DB_HOST,
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_NAME
})

module.exports = connection
File renamed without changes.
6 changes: 3 additions & 3 deletions package.json → app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@
"scripts": {
"dev": "nodemon app",
"start": "node app",
"test:unit": "jest testing/app.test",
"test:integration": "jest testing/db.test"
"test": "jest --forceExit testing/",
"test:coverage": "jest --coverage --forceExit testing/"
},
"author": "Moch Rafi Riadi",
"license": "ISC",
"dependencies": {
"chai": "^4.3.7",
"dotenv": "^16.0.3",
"express": "^4.18.2",
"moment": "^2.29.4",
"mysql": "^2.18.1",
"nodemon": "^2.0.22"
},
"devDependencies": {
"chai": "^4.3.7",
"babel-jest": "^29.5.0",
"jest": "^29.5.0",
"supertest": "^6.3.3"
Expand Down
File renamed without changes
159 changes: 159 additions & 0 deletions app/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TechConsult | Solusi Transformasi Digital</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700&display=swap');
body { font-family: 'Inter', sans-serif; }
</style>
</head>
<body class="bg-gray-50 text-gray-800">

<nav class="fixed w-full z-50 bg-white/90 backdrop-blur-md shadow-sm">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-20 items-center">
<div class="flex-shrink-0 flex items-center">
<span class="text-2xl font-bold text-blue-600 tracking-tight">TECH<span class="text-gray-900">CONSULT</span></span>
</div>
<div class="hidden md:block">
<div class="ml-10 flex items-baseline space-x-8 font-medium">
<a href="#" class="hover:text-blue-600 transition">Beranda</a>
<a href="#services" class="hover:text-blue-600 transition">Layanan</a>
<a href="#about" class="hover:text-blue-600 transition">Tentang Kami</a>
<a href="#contact" class="bg-blue-600 text-white px-5 py-2 rounded-lg hover:bg-blue-700 transition">Hubungi Kami</a>
</div>
</div>
</div>
</div>
</nav>

<section class="pt-32 pb-20 bg-gradient-to-br from-slate-900 to-blue-900 text-white">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 flex flex-col md:flex-row items-center">
<div class="md:w-1/2 mb-10 md:mb-0">
<h1 class="text-4xl md:text-6xl font-bold leading-tight mb-6">
Akselerasi Bisnis Anda dengan <span class="text-blue-400">Teknologi Tepat.</span>
</h1>
<p class="text-lg text-gray-300 mb-8 pr-10">
Kami membantu perusahaan melakukan transformasi digital melalui strategi IT yang inovatif, aman, dan terukur.
</p>
<div class="flex space-x-4">
<a href="#services" class="bg-blue-600 hover:bg-blue-700 text-white px-8 py-3 rounded-lg font-semibold transition">Lihat Layanan</a>
<a href="#" class="border border-white/30 hover:bg-white/10 text-white px-8 py-3 rounded-lg font-semibold transition">Konsultasi Gratis</a>
</div>
</div>
<div class="md:w-1/2">
<img src="https://images.unsplash.com/photo-1550751827-4bd374c3f58b?auto=format&fit=crop&q=80&w=800" alt="Cyber Security" class="rounded-2xl shadow-2xl">
</div>
</div>
</section>

<section id="services" class="py-24">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 text-center">
<h2 class="text-blue-600 font-semibold tracking-wide uppercase">Layanan Kami</h2>
<p class="mt-2 text-3xl font-extrabold text-gray-900 sm:text-4xl">Solusi IT Komprehensif</p>

<div class="mt-16 grid grid-cols-1 md:grid-cols-3 gap-8">
<div class="bg-white p-8 rounded-xl shadow-sm border border-gray-100 hover:shadow-md transition">
<div class="w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center text-blue-600 mb-6 mx-auto">
<i class="fas fa-cloud text-2xl"></i>
</div>
<h3 class="text-xl font-bold mb-3">Cloud Infrastructure</h3>
<p class="text-gray-600">Migrasi dan pengelolaan infrastruktur cloud yang efisien dan skalabel untuk bisnis Anda.</p>
</div>

<div class="bg-white p-8 rounded-xl shadow-sm border border-gray-100 hover:shadow-md transition">
<div class="w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center text-blue-600 mb-6 mx-auto">
<i class="fas fa-shield-alt text-2xl"></i>
</div>
<h3 class="text-xl font-bold mb-3">Cyber Security</h3>
<p class="text-gray-600">Lindungi data aset berharga Anda dari ancaman siber dengan sistem keamanan berlapis.</p>
</div>

<div class="bg-white p-8 rounded-xl shadow-sm border border-gray-100 hover:shadow-md transition">
<div class="w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center text-blue-600 mb-6 mx-auto">
<i class="fas fa-code text-2xl"></i>
</div>
<h3 class="text-xl font-bold mb-3">Software Development</h3>
<p class="text-gray-600">Pengembangan aplikasi kustom yang dirancang khusus untuk memenuhi kebutuhan operasional.</p>
</div>
</div>
</div>
</section>

<section id="about" class="py-24 bg-white">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex flex-col md:flex-row items-center gap-16">
<div class="md:w-1/2">
<div class="grid grid-cols-2 gap-4">
<img src="https://images.unsplash.com/photo-1522071820081-009f0129c71c?auto=format&fit=crop&q=80&w=400" class="rounded-lg shadow-lg" alt="Team">
<img src="https://images.unsplash.com/photo-1519389950473-47ba0277781c?auto=format&fit=crop&q=80&w=400" class="rounded-lg shadow-lg mt-8" alt="Meeting">
</div>
</div>
<div class="md:w-1/2">
<h2 class="text-3xl font-bold mb-6 text-gray-900">Mengapa Memilih TechConsult?</h2>
<p class="text-gray-600 mb-6 leading-relaxed">
Dengan pengalaman lebih dari 10 tahun, kami memahami bahwa setiap bisnis memiliki tantangan unik. Kami tidak hanya memberikan teknologi, tapi memberikan solusi strategis yang membantu Anda tumbuh.
</p>
<ul class="space-y-4">
<li class="flex items-center space-x-3 text-gray-700">
<i class="fas fa-check-circle text-green-500"></i>
<span>Tim Ahli Tersertifikasi Internasional</span>
</li>
<li class="flex items-center space-x-3 text-gray-700">
<i class="fas fa-check-circle text-green-500"></i>
<span>Dukungan Teknis 24/7</span>
</li>
<li class="flex items-center space-x-3 text-gray-700">
<i class="fas fa-check-circle text-green-500"></i>
<span>Pendekatan Berbasis Data & Hasil</span>
</li>
</ul>
</div>
</div>
</div>
</section>

<footer id="contact" class="bg-gray-900 text-white pt-16 pb-8">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 grid grid-cols-1 md:grid-cols-4 gap-12 mb-16">
<div class="col-span-1 md:col-span-1">
<span class="text-2xl font-bold text-blue-400">TECHCONSULT</span>
<p class="mt-4 text-gray-400 text-sm leading-relaxed">
Partner terpercaya untuk solusi IT dan transformasi digital perusahaan Anda di era modern.
</p>
</div>
<div>
<h4 class="text-lg font-semibold mb-6">Navigasi</h4>
<ul class="space-y-4 text-gray-400 text-sm">
<li><a href="#" class="hover:text-white transition">Beranda</a></li>
<li><a href="#services" class="hover:text-white transition">Layanan</a></li>
<li><a href="#about" class="hover:text-white transition">Tentang Kami</a></li>
</ul>
</div>
<div>
<h4 class="text-lg font-semibold mb-6">Kontak</h4>
<ul class="space-y-4 text-gray-400 text-sm">
<li><i class="fas fa-envelope mr-2"></i> info@techconsult.co.id</li>
<li><i class="fas fa-phone mr-2"></i> +62 21 1234 5678</li>
<li><i class="fas fa-map-marker-alt mr-2"></i> Sudirman, Jakarta Pusat</li>
</ul>
</div>
<div>
<h4 class="text-lg font-semibold mb-6">Ikuti Kami</h4>
<div class="flex space-x-4">
<a href="#" class="w-10 h-10 bg-gray-800 rounded-full flex items-center justify-center hover:bg-blue-600 transition"><i class="fab fa-linkedin-in"></i></a>
<a href="#" class="w-10 h-10 bg-gray-800 rounded-full flex items-center justify-center hover:bg-blue-600 transition"><i class="fab fa-twitter"></i></a>
<a href="#" class="w-10 h-10 bg-gray-800 rounded-full flex items-center justify-center hover:bg-blue-600 transition"><i class="fab fa-instagram"></i></a>
</div>
</div>
</div>
<div class="max-w-7xl mx-auto px-4 border-t border-gray-800 pt-8 text-center text-gray-500 text-sm">
<p>&copy; 2024 TechConsult. Seluruh hak cipta dilindungi.</p>
</div>
</footer>

</body>
</html>
1 change: 1 addition & 0 deletions app/public/index2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test branch
File renamed without changes.
44 changes: 44 additions & 0 deletions app/testing/app.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const request = require('supertest');
const mysql = require('mysql');
require('dotenv').config();

const connection = require('../middleware/db_connect');
const app = require('../app'); // Replace with the path to your application file

describe('Unit Test /', () => {
it('should respond with index.html', async () => {
const response = await request(app).get('/');
expect(response.status).toBe(200);
});
});

describe('Unit Test /app1', () => {
it('should respond with "Hello App1!"', async () => {
const response = await request(app).get('/app1');
expect(response.status).toBe(200);
});
});

describe('Unit Test /app2', () => {
it('should respond with "Hello App2!"', async () => {
const response = await request(app).get('/app2');
expect(response.status).toBe(200);
});
});

describe('Integration Test Connect Database', () => {
beforeEach(() => {
// Set the connection for the application to use
app.set('connection', connection.connect);
});

afterEach(() => {
// Close the connection pool after the tests are done
connection.end();
});

it('should respond with users data', async () => {
const response = await request(app).get('/users');
expect(response.status).toBe(200);
});
});
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: app

services:
app:
image: ahmadsolihin/simple-app:1.0
build: ./app
ports:
- "5000:3000"
volumes:
- vol-upload:/app/public/images/

volumes:
vol-upload:
11 changes: 0 additions & 11 deletions middleware/db_connect.js

This file was deleted.

Loading