This commit is contained in:
Morten Olsen
2024-01-12 12:43:51 +01:00
commit 6d8e5bf955
109 changed files with 9246 additions and 0 deletions

19
docs/anti-features.md Normal file
View File

@@ -0,0 +1,19 @@
## Anti-Features
### Understanding the Limitations
While mini loader is designed for simplicity and ease of use, it's important to understand its limitations, especially regarding task isolation and scalability. This section outlines these "anti-features" to help you assess if mini loader is the right tool for your needs.
### No Task Isolation
- **Process-Based Execution**: In mini loader, each task is run as a process on the server. This means there isn't any task isolation. If task isolation is crucial for your use case (e.g., running untrusted code), mini loader might not be the ideal solution.
### Limited Scalability
- **Single-Server Design**: The architecture of mini loader is oriented towards simplicity and ease of use on a single server. As such, it does not support horizontal scaling or load distribution across multiple servers. If your project requires high scalability to handle large-scale workloads, you might want to consider other tools that are designed for such environments.
### Aimed at Simplicity, Not Scale
The core philosophy of mini loader is to provide a straightforward, user-friendly platform for managing and executing workloads. It's particularly well-suited for individual developers, small teams, or small-scale applications where the ease of setup and use is prioritized over the ability to scale or isolate tasks.
For those who need advanced features like task isolation or high scalability, there are other more complex tools available that might better suit those specific requirements.

0
docs/creating-an-api.md Normal file
View File

3
docs/faq.md Normal file
View File

@@ -0,0 +1,3 @@
## FAQ
Nothing here yet...

44
docs/first-workload.md Normal file
View File

@@ -0,0 +1,44 @@
## Getting Started with mini loader CLI
Welcome to the mini loader CLI! This guide will walk you through the installation of the CLI, creating a simple script, and executing it locally to ensure everything works smoothly.
### Step 1: Install the CLI
The mini loader CLI is your gateway to interacting with a mini-loader server and running workloads locally for validation. Install it globally using npm with the following command:
```bash
npm install -g @morten-olsen/mini-loader-cli
```
### Step 2: Create Your First Script
Now, let's write a basic script that outputs a single artifact named “hello”. Create a new file with the following JavaScript code:
```javascript
import { artifacts } from "@morten-olsen/mini-loader";
artifacts.create('hello', 'world');
```
Save this file as `script.mjs`.
#### A Note on Dependencies
In this script, we're using the `@morten-olsen/mini-loader` package, which might not be installed in your local environment. No worries though, as mini loader can automatically download necessary packages when preparing the script. Alternatively, for a more structured approach (especially if you're using TypeScript), you can initialize a Node.js project and install the dependencies for complete access to typings.
### Step 3: Run the Script Locally
To validate that your script is functioning correctly, execute it locally using the following command:
```bash
mini-loader local run script.mjs -ai
```
The `-ai` flag instructs the CLI to automatically download any referenced packages when bundling the script.
After running the command, you should see an output confirming that a new artifact named “hello” was created successfully.
### What's Next?
Congratulations on setting up and running your first script with mini loader! You're now ready to take the next step.
[Next: Setting Up the Server](./setup-server.md)

34
docs/getting-started.md Normal file
View File

@@ -0,0 +1,34 @@
# Getting Started with mini loader
Welcome to the mini loader guide! This documentation will help you quickly get up and running with mini loader, a versatile tool designed to simplify your workload management.
## Overview
mini loader is a powerful yet user-friendly tool that allows you to manage and execute workloads efficiently. Whether you're a solo developer, part of a small team, or just someone looking to automate routine tasks, mini loader is designed to make your life easier.
## Prerequisites
Before diving into mini loader, ensure you have the following:
- Docker installed on your machine (for running the mini loader server)
- Node.js and npm installed (for using the mini loader CLI)
## Contents
- [Creating you first workload](./installation.md): Learn how to write workloads and execute them locally with the mini loader CLI
- [Running the server](./pushing-managing-loads.md): Instructions on how to run the server locally using docker.
- [Interacting with the server](./interacting-with-server.md): Learn the basic commands used to manage workloads.
- [Managing secrets](./managing-secrets.md): Upload secrets to the server that can be used inside your scripts.
- [Authorization](./setting-up-oidc.md): Extend the authorization using OIDC
- [Create an API](./creating-an-api.md): Create a workload which exposes a HTTP api
## Getting Help
If you encounter any issues or have questions, please refer to the [FAQs](./faqs.md)
## Let's Get Started!
Ready to streamline your workload management? Let's jump right into [creating your first workload](./first-workload.md) and set up the mini loader CLI!
[Next: create a workload](./first-workload.md)

View File

@@ -0,0 +1,70 @@
## Interacting with the server
The mini loader CLI is your primary tool for interacting with the server. This guide will walk you through the basic commands and their usage.
### Getting Help
For assistance with any command, append `--help` to it. For example, to see documentation for the `loads push` command:
```bash
mini-loader loads push --help
```
### Push a Load to the Server
To push a script to your server:
```bash
mini-loader loads push <script-path> -i <id>
```
- `<id>` is the identifier for your script. If omitted, an ID will be auto-generated.
- To immediately trigger a run of the load after pushing, add the `-r` flag.
### Checking Run Status
To list the status of all runs:
```bash
mini-loader runs ls
```
- To filter runs by a specific load, add `-l <load-id>`.
### Retrieving Logs
To view logs:
```bash
mini-loader logs ls
```
- To view logs from a specific run, use `-r <run-id>`.
- To view logs for a specific load, use `-l <load-id>`.
### Listing Artifacts
To list all artifacts:
```bash
mini-loader artifacts ls
```
- You can filter the artifacts by a specific run using `-r <run-id>`.
- Alternatively, filter by load using `-l <load-id>`.
### Downloading an Artifact
To download a specific artifact:
```bash
mini-loader artifacts pull <id> > myfile.txt
```
Replace `<id>` with the identifier of the artifact you wish to download.
### Ready for More?
You're now equipped to manage loads, runs, logs, and artifacts using the mini loader CLI. For advanced usage, such as managing secrets, proceed to the next section.
[Next: Managing Secrets](./managing-secrets.md)

0
docs/managing-secrets.md Normal file
View File

0
docs/setting-up-oidc.md Normal file
View File

60
docs/setup-server.md Normal file
View File

@@ -0,0 +1,60 @@
Certainly! Here's a revised version of your documentation page to make it
## Quick Start with mini loader using Docker
This guide will help you quickly set up and run a mini loader server using Docker. Follow these simple steps to deploy your server and start interacting with it using the [mini-loader CLI](./first-workload.md).
### Step 1: Deploy the mini loader Container
To begin, let's deploy the mini loader container. Run the following command in your terminal:
```bash
docker run -p 4500:4500 -n mini-loader ghcr.io/morten-olsen/mini-loader:main
```
This command downloads the latest mini loader image and runs it, exposing port 4500.
### Step 2: Verify Server Health
Once the container is running, you can check the server's health:
```bash
curl http://localhost:4500/health
```
This command should return a response indicating that the server is running smoothly.
### Step 3: Authorize Using a Token
Initially, your server won't have any authorization setup. You can issue a token directly from the container to use for authorization:
```bash
docker exec mini-loader mini-loader create-token
```
This command will output a token. Keep this token handy as you'll need it for the next step.
### Step 4: Authorize the CLI Client
Now, authorize your CLI client to interact with the server:
```bash
mini-loader auth login https://localhost:4500
```
Enter the token when prompted.
### Step 5: Verify CLI Connection
Finally, verify that the CLI is properly configured to interact with your server:
```bash
mini-loader loads ls
```
This command lists all the loads currently on your server, confirming that the CLI is communicating successfully with the server.
### Ready to Go!
You've successfully deployed and configured your mini loader server using Docker! You're now ready to start interacting with the server.
[Next: Interacting with the Server](./interacting-with-server.md)