Skip to content

codenlighten/ubuntu-ai-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Automated Ubuntu Server Setup

This repository provides a Node.js script (setup.js) that automates the provisioning of an Ubuntu server based on a structured JSON specification generated by your AI-driven StructuredResponseGenerator.

Features

  • Profile-based configuration: Define multiple setup profiles (e.g., web-node, docker-host, ci-runner) and generate tailored JSON specs.
  • Package installation: Installs required packages via apt-get.
  • Custom commands: Executes arbitrary shell commands.
  • Configuration files: Creates and writes configuration files at specified paths.
  • Service management: Enables and restarts systemd services.

Prerequisites

  • Ubuntu 20.04+ (or compatible Debian-based distro)
  • Node.js v18+
  • npm
  • An OpenAI API key with access to your StructuredResponseGenerator model.

Installation

  1. Clone this repository:

    git clone <your-repo-url>
    cd <your-repo-directory>
  2. Install Node.js dependencies:

    npm install
  3. Set your OpenAI API key as an environment variable:

    export OPENAI_API_KEY="sk-..."

Usage

  1. Make the setup script executable:

    chmod +x setup.js
  2. Run the script with a profile name:

    ./setup.js --profile web-node
    • The script will prompt the StructuredResponseGenerator to produce a JSON spec for the given profile.

    • It will then:

      1. Update apt-get and install all listed packages.
      2. Execute any additional shell commands.
      3. Write configuration files to their target paths.
      4. Enable and restart specified services.

Defining New Profiles

Profiles are defined by passing a different --profile argument. Under the hood, the script:

  1. Constructs a prompt asking for a JSON spec for that profile

  2. Uses your AI model to generate an object with these keys:

    • packages: string[]
    • commands: string[]
    • files: { path: string; content: string }[]
    • services: string[]

You can modify the prompt schema in setup.js to add or remove properties as needed.

Extending the Script

  • Change prompt: Adjust the prompt variable in setup.js for custom instructions.
  • Add validation: Integrate JSON schema validation before executing response content.
  • Dry-run mode: Add a flag to print actions without executing them.

Contributing

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature/awesome-profile.
  3. Commit your changes: git commit -m "Add awesome profile schema".
  4. Push to your branch: git push origin feature/awesome-profile.
  5. Open a pull request.

License

This project is MIT‑licensed. See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors