Documentation
MyOpsAgent Overview API Reference Architecture Overview Customer Setup & Onboarding Guide Deployment & Environment Setup Guide Documentation Placement & Access Guide Error Codes & Operational Guarantees

Internal Technical Documentation · Version 1.0

MyOpsAgent Deployment & Environment Setup Guide

This document provides a complete, end-to-end guide for deploying, configuring, and maintaining the MyOpsAgent backend. It is intended for internal engineering teams, DevOps personnel, and future developers who will work on the platform.

MyOpsAgent is designed to be lightweight, portable, and easy to deploy on a wide range of hosting environments — from shared hosting to dedicated servers and cloud platforms. This guide ensures that deployments are consistent, secure, and reproducible across all environments.

1. System Requirements

MyOpsAgent has minimal infrastructure requirements. The following configuration is recommended for production deployments.

Server Requirements

  • PHP 8.1 or later
  • MySQL 8.0 or later
  • Apache or Nginx
  • HTTPS enabled
  • Composer (optional, for future expansion)

Recommended PHP Extensions

  • mysqli
  • json
  • mbstring
  • openssl

Minimum Hardware

  • 1 vCPU
  • 1 GB RAM
  • 10 GB storage
  • 2+ vCPU
  • 4+ GB RAM
  • SSD storage
  • Automated backups

2. Directory Structure

The MyOpsAgent backend uses a clean, modular directory structure:

Directory Layout
public_html/
    api.php
    docs/
        api.md
        overview.pdf
        setup-guide.pdf
        error-codes.pdf
app/
    Domain/
        Entities/
        ValueObjects/
    Application/
        UseCases/
        Controllers/
    Infrastructure/
        Persistence/
        Logging/
        Security/

Key Directories

  • public_html/ — Contains the public API entry point (api.php) and documentation.
  • app/Domain/ — Contains pure domain logic: entities, value objects, and domain rules.
  • app/Application/ — Contains use cases and controllers that orchestrate domain logic.
  • app/Infrastructure/ — Contains database repositories, logging, and security components.

This structure ensures clean separation of concerns and long-term maintainability.

3. Environment Configuration

MyOpsAgent uses environment variables to configure database access, admin keys, and other sensitive settings.

Create a .env file in the project root:

.env Example
DB_HOST=localhost
DB_USER=myops
DB_PASS=yourpassword
DB_NAME=myopsagent

ADMIN_KEY=your_admin_key_here

Environment Variable Descriptions

Variable Description
DB_HOST MySQL host address
DB_USER MySQL username
DB_PASS MySQL password
DB_NAME Database name
ADMIN_KEY Secret admin key for privileged operations

Security Notes

  • Never commit .env to version control.
  • Always provide .env.example for developers.
  • Rotate admin keys periodically.

4. Database Setup

MyOpsAgent requires the following tables:

  1. organisations — Stores organisation metadata.
  2. organisation_api_keys — Stores API keys, labels, and revocation timestamps.
  3. organisation_usage — Tracks daily usage, rate limits, and counters.
  4. decisions — Stores immutable decision records.
  5. audit_log — Stores request/response logs for compliance and debugging.
  6. migrations (optional) — Tracks schema changes.

Deployment Steps

1. Create the database

CREATE DATABASE myopsagent;

2. Import the schema

mysql -u myops -p myopsagent < schema.sql

3. Verify tables exist

SHOW TABLES;

4. Create an initial organisation and API key

Use the admin endpoint (e.g. /create_api_key) to create the first organisation and API key after the schema is in place.

5. Deployment Workflow

Below is the recommended deployment workflow for production environments.

Step 1 — Upload Code

Deploy the following directories:

  • public_html/
  • app/
  • .env (created on server)

Ensure correct file permissions:

chmod -R 755 public_html
chmod -R 755 app
chmod 600 .env

Step 2 — Configure Web Server

Apache Example

Apache VirtualHost
<VirtualHost *:443>
    DocumentRoot /var/www/myopsagent/public_html
    ServerName myopsagent.com

    <Directory /var/www/myopsagent/public_html>
        AllowOverride All
        Require all granted
    </Directory>

    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/myopsagent.crt
    SSLCertificateKeyFile /etc/ssl/private/myopsagent.key
</VirtualHost>

Nginx Example

Nginx Server Block
server {
    listen 443 ssl;
    server_name myopsagent.com;

    root /var/www/myopsagent/public_html;

    ssl_certificate /etc/ssl/certs/myopsagent.crt;
    ssl_certificate_key /etc/ssl/private/myopsagent.key;

    index api.php;
}

Step 3 — Configure Environment

Create .env on the server and populate it with production values.

Step 4 — Run Database Migrations

Import the schema and verify database connectivity from the application.

Step 5 — Test Core Endpoints

Test the following endpoints:

  • /health
  • /?route=create_api_key
  • /?route=decide
  • /?route=revoke_api_key

Verify:

  • Correlation IDs are generated
  • Audit logs are written
  • Usage counters increment correctly

Step 6 — Enable Monitoring

Recommended monitoring tools:

  • UptimeRobot
  • Pingdom
  • CloudWatch
  • Datadog

Monitor:

  • Response times
  • Error rates
  • Usage spikes

6. Logging & Monitoring

MyOpsAgent logs every request with:

  • Correlation ID
  • Route
  • Status
  • Duration
  • Payload
  • Result

Logs are stored in the audit_log table and can be used for debugging, compliance, and operational analytics.

Recommended Log Retention

  • 90 days for standard customers
  • 365 days for enterprise customers

7. Security Best Practices

  • Use HTTPS exclusively
  • Rotate admin keys every 90 days
  • Rotate API keys regularly
  • Restrict database access by IP
  • Enable automated backups
  • Use fail2ban or equivalent
  • Monitor for unusual usage patterns

8. Backup & Recovery

Daily Backups

  • Database dump
  • .env file
  • Audit logs

Recovery Procedure

  1. Restore database
  2. Restore .env
  3. Redeploy code
  4. Test /health
  5. Test /decide

9. Scaling Considerations

MyOpsAgent scales horizontally due to:

  • Stateless engine
  • Lightweight API gateway
  • Minimal database load

To scale the platform:

  • Add more web servers behind a load balancer
  • Enable read replicas for MySQL
  • Shard organisations if needed for very large deployments

Conclusion

This deployment guide provides everything required to install, configure, and maintain the MyOpsAgent backend in a secure and reproducible manner. By following these steps, your team can ensure consistent deployments, reliable performance, and long-term maintainability.

MyOpsAgent is designed to grow with your organisation — from initial deployment to enterprise-scale operations.