Skip to content

zweihaka/node-php-devops

Repository files navigation

node-php-devops

A self-hosted server monitoring platform. Three target servers (Alpha, Beta, Gamma) are continuously checked for availability — login to the dashboard to watch their status in real time.


Stack

Layer Technology
Frontend PHP 8.2 + Nginx
Backend Node.js
Database MySQL 8.0
Cache Redis 7
Orchestration Docker Swarm
CI/CD GitLab CI
Monitoring Prometheus + Grafana + Node Exporter + cAdvisor

Services

Service Description
frontend-web Nginx — serves PHP files and proxies /api/ to backend
frontend-php PHP-FPM — renders dashboard and login page
backend Node.js REST API — auth, server management, status
worker Node.js — pings target servers every 15 seconds
mysql Stores users, servers, check history
redis Caches latest server statuses
target-alpha/beta/gamma Nginx containers acting as monitored servers
prometheus Scrapes metrics from backend, node-exporter, cAdvisor
grafana Visualizes infrastructure metrics
node-exporter Sends host metrics
cadvisor Sends info about containers

Quick Start

Prerequisites

  • (You can setup new server using ansible playbook)
  • Docker with Swarm mode enabled
  • GitLab Runner with devops tag registered on your server

1. Create overlay network

docker network create --driver overlay --attachable app-network

2. Create secrets

mkdir -p secrets
echo "your_db_password" > secrets/db_password.txt
echo "your_db_user"     > secrets/db_user.txt
echo "your_db_name"     > secrets/db_name.txt
echo "your_jwt_secret"  > secrets/jwt_secret.txt
echo "your_gf_password" > secrets/gf_password.txt

3. Deploy

docker stack deploy -c docker-stack.yml uptime-stack
docker stack deploy -c monitoring-stack.yml monitoring

4. Access

Service URL
Dashboard http://your-ip
Grafana http://your-ip:3000
Prometheus http://your-ip:9090

CI/CD

Push to main → GitLab CI automatically:

  1. Builds backend and frontend images
  2. Pushes them to GitLab Container Registry
  3. Deploys updated stack via Docker Swarm (CI/CD doesnt deploy nor build monitoring stack)

Default credentials

username: zweihaka
password: password

Change the password hash in db/init.sql before deploying to production.

About

A self-hosted server monitoring platform. Three target servers (Alpha, Beta, Gamma) are continuously checked for availability — login to the dashboard to watch their status in real time.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors