Skip to content

Add formio.sh installation script#178

Open
konard wants to merge 3 commits intoandchir:mainfrom
konard:issue-175-5e5fcd21554f
Open

Add formio.sh installation script#178
konard wants to merge 3 commits intoandchir:mainfrom
konard:issue-175-5e5fcd21554f

Conversation

@konard
Copy link
Copy Markdown
Contributor

@konard konard commented Jan 9, 2026

📋 Issue Reference

Fixes #175

🎯 Summary

This PR adds an automated installation script for Form.io (form and API platform) with MongoDB, following all requirements from requirements_for_scripts_ru.md.

🚀 What's Included

Core Components

  • Node.js 20.x (LTS) - Required runtime environment
  • MongoDB 8.0 - Database with dedicated user and limited privileges
  • Form.io - Form and API platform installed from official repository
  • Nginx - Reverse proxy with domain-specific log files
  • SSL Certificate - Automatic setup via Let's Encrypt/certbot

Script Features

✅ Ubuntu 24.04 support
✅ Automatic installer_user creation and usage
✅ Domain name passed as command-line argument
✅ Idempotent operation - safe to run multiple times
✅ Resource existence checks (user, database, repository, SSL)
✅ Git repository cloning with git checkout . before updates
✅ Systemd service with automatic restart on updates
✅ Secure password generation (20+ character random passwords)
✅ MongoDB user with limited privileges (not root)
✅ Beautiful colored output for better readability
✅ Comprehensive installation report with all credentials
✅ Non-interactive installation (no prompts)

📝 Usage

sudo ./scripts/formio.sh forms.example.com

🔧 Technical Details

Installation Process

  1. System dependencies installation (curl, git, build-essential, etc.)
  2. Node.js 20.x from NodeSource repository
  3. MongoDB 8.0 from official MongoDB repository
  4. Form.io repository cloning to /home/installer_user/formio
  5. Dependencies installation via yarn
  6. Building VM module and portal
  7. Environment configuration (.env file)
  8. Systemd service creation and startup
  9. Nginx reverse proxy configuration
  10. SSL certificate via Let's Encrypt

MongoDB Configuration

  • Dedicated database: formio
  • Dedicated user: formio (with readWrite role only)
  • No root user credentials exposed

Service Management

The script creates a systemd service that:

  • Runs as installer_user
  • Starts automatically on boot
  • Restarts on failure
  • Logs to journald

Security Features

  • Secure password generation (OpenSSL random)
  • JWT secret generation (64 characters)
  • SSL/TLS encryption
  • Security headers in Nginx
  • Limited database privileges
  • Credentials saved to secure report file (600 permissions)

🔍 Compliance with Requirements

All 17 requirements from requirements_for_scripts_ru.md are implemented:

  1. ✅ Ubuntu 24.04 adaptation
  2. ✅ installer_user creation
  3. ✅ Web server (Nginx) installation
  4. ✅ Domain argument
  5. ✅ SSL certificate via certbot
  6. ✅ No interactive prompts
  7. ✅ Git clone/pull support
  8. git checkout . before pull
  9. ✅ Idempotent design
  10. ✅ Resource existence checks
  11. ✅ Service restart if exists
  12. ✅ N/A (no Python venv)
  13. ✅ Dedicated DB user (not root)
  14. ✅ Separate Nginx logs per domain
  15. ✅ Skip SSL if exists
  16. ✅ Secure passwords in report
  17. ✅ Colored output

📦 Output

After successful installation, the script generates:

  • Installation report: /home/installer_user/formio_installation_report.txt
  • Contains all credentials and access information
  • Service management commands
  • Log file locations

🧪 Testing Notes

The script has been validated for:

  • ✅ Bash syntax correctness
  • ✅ Idempotent operations
  • ✅ Proper error handling with set -e
  • ✅ Following patterns from existing scripts (n8n.sh, rocketchat.sh)

📚 References


🤖 Generated with Claude Code

konard and others added 2 commits January 9, 2026 01:49
Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: andchir#175
Implements automated installation script for Form.io platform with MongoDB.

Features:
- Node.js 20.x installation
- MongoDB 8.0 setup with dedicated database user
- Form.io installation from official repository
- Systemd service configuration
- Nginx reverse proxy with SSL via Let's Encrypt
- Idempotent operation with resource checks
- Secure password generation and reporting

Follows all requirements from requirements_for_scripts_ru.md:
- Ubuntu 24.04 support
- installer_user creation and usage
- Domain argument and SSL certificate setup
- Git repository cloning with proper updates
- Database user with limited privileges
- Separate Nginx log files per domain
- Beautiful colored output
- Complete installation report

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@konard konard changed the title [WIP] Написать скрипт для установки formio Add formio.sh installation script Jan 9, 2026
@konard konard marked this pull request as ready for review January 9, 2026 00:53
@konard
Copy link
Copy Markdown
Contributor Author

konard commented Jan 9, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $0.960208 USD
  • Calculated by Anthropic: $0.652257 USD
  • Difference: $-0.307951 (-32.07%)
    📎 Log file uploaded as GitHub Gist (257KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Написать скрипт для установки formio

1 participant