เข้าถึง
- เปิด browser และไปที่:
https://<SERVER_IP> - คาดว่าจะมีคำเตือน SSL ของ browser (self-signed certificate)
สร้างบัญชีผู้ดูแลระบบ
ก่อนเข้าสู่ระบบ คุณต้องสร้างบัญชีผู้ดูแลระบบก่อน
รันคำสั่งต่อไปนี้:
docker exec -it healthchecks /opt/healthchecks/manage.py createsuperuser
ปฏิบัติตามคำแนะนำเพื่อป้อน:
- ที่อยู่อีเมล
- รหัสผ่าน
เมื่อเสร็จแล้ว คุณสามารถเข้าสู่ระบบโดยใช้ข้อมูลประจำตัวที่สร้างขึ้นใหม่ได้
ไฟล์และไดเรกทอรีที่สำคัญ
- ไดเรกทอรีติดตั้ง:
/root/healthchecks - ไฟล์ environment:
/root/healthchecks/.env - ไฟล์ Docker Compose:
/root/healthchecks/docker-compose.yml - ฐานข้อมูล SQLite:
/var/lib/docker/volumes/healthchecks_healthchecks-data/_data - การกำหนดค่าไซต์ Nginx:
/etc/nginx/sites-available/healthchecks - ไซต์ที่เปิดใช้งาน:
/etc/nginx/sites-enabled/healthchecks - SSL certificates:
/etc/nginx/ssl/fullchain.pem,/etc/nginx/ssl/privkey.pem - ข้อมูลรับรองผู้ดูแลระบบ:
/root/.cloudzy-creds
จัดการสแต็ก
cd /root/healthchecks
# Start services
docker compose up -d
# Stop services
docker compose down
# Restart services
docker compose restart
# View logs
docker compose logs -f
การกำหนดค่าการตั้งค่าอีเมล (ไม่บังคับ)
จำเป็นต้องมีการกำหนดค่าอีเมลเพื่อเปิดใช้งานการแจ้งเตือน (เช่น การแจ้งเตือน รายงาน)
ตรวจสอบให้แน่ใจว่าอนุญาตการเชื่อมต่อ SMTP บนเซิร์ฟเวอร์นี้ ขอการเข้าถึง SMTP หากปิดใช้งานอยู่ในปัจจุบัน
แก้ไขไฟล์สภาพแวดล้อม:
nano /root/healthchecks/.env
ยกเลิกหมายเหตุและกำหนดค่าตัวแปรต่อไปนี้ด้วยรายละเอียดผู้ให้บริการ SMTP ของคุณ:
# DEFAULT_FROM_EMAIL=fixme-email-address-here
# EMAIL_HOST=fixme-smtp-host-here
# EMAIL_HOST_PASSWORD=fixme-smtp-password-here
# EMAIL_HOST_USER=fixme-smtp-username-here
# EMAIL_PORT=587
# EMAIL_USE_TLS=True
ใช้การเปลี่ยนแปลงโดยเริ่มบริการใหม่:
docker compose up -d
การเปิดใช้งาน SSL ด้วยโดเมน (ไม่บังคับ)
1. ชี้โดเมนของคุณไปยัง IP ของ server
2. แก้ไข .env เพื่อตั้งค่าโดเมนของคุณเป็น SITE_ROOT: SITE_ROOT=https://yourdomain.com
3. สร้างบริการใหม่:
cd /root/healthchecks/
docker compose up -d
4. แก้ไขการกำหนดค่า Nginx และแทนที่ทั้งสองอย่าง server_name <IP>; กับโดเมนของคุณ (<yourdomain.com>) สำหรับทั้ง HTTP (port 80) และ HTTPS (port 443) blocks:
vim /etc/nginx/sites-available/healthchecks
5. ติดตั้ง Certbot:
apt install -y certbot python3-certbot-nginx
6. รันคำสั่งต่อไปนี้เพื่อสร้างใบรับรอง Let’s Encrypt ที่ใช้งานได้:
certbot certonly --nginx --non-interactive --agree-tos --email [email protected] -d yourdomain.com
7. แทนที่ paths ของ SSL ใน Nginx config (ส่วน TLS):
vim /etc/nginx/sites-available/healthchecks
# Before:
# ssl_certificate /etc/nginx/ssl/fullchain.pem;
# ssl_certificate_key /etc/nginx/ssl/privkey.pem;
# After:
# ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
# ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
8. รีสตาร์ท Nginx เพื่อใช้การเปลี่ยนแปลง:
systemctl restart nginx
9. เปิด browser และไปที่: https://yourdomain.com