mirror of
https://github.com/morten-olsen/mini-loader.git
synced 2026-02-08 01:36:26 +01:00
chore: added documentation
This commit is contained in:
3
docs/faq.md
Normal file
3
docs/faq.md
Normal file
@@ -0,0 +1,3 @@
|
||||
## FAQ
|
||||
|
||||
Nothing here yet...
|
||||
@@ -1,10 +1,18 @@
|
||||
First let’s install the CLI, which allow us to interact with a mini-loader server, but also run our workloads locally to validate that they are working
|
||||
## 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
|
||||
```
|
||||
|
||||
Next we need a script - let’s start simple with a script which will just output a single artifact called “hello”
|
||||
### 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";
|
||||
@@ -12,18 +20,25 @@ import { artifacts } from "@morten-olsen/mini-loader";
|
||||
artifacts.create('hello', 'world');
|
||||
```
|
||||
|
||||
We save our script as `script.mjs`
|
||||
Save this file as `script.mjs`.
|
||||
|
||||
Note that we are referencing a package we don’t have. mini-loader support automatically downloading packages when it prepares the script. We could also have initialised a node project and installed the dependency (useful if you are using typescript and want typings)
|
||||
#### 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.
|
||||
|
||||
Next we want to execute our script locally to validate that it actually works as we intended
|
||||
### 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
|
||||
```
|
||||
|
||||
Note the `-ai` which tells the CLI to download any packages referenced when it bundles the script
|
||||
The `-ai` flag instructs the CLI to automatically download any referenced packages when bundling the script.
|
||||
|
||||
This should output that the script indeed created a new artifact named “hello”
|
||||
After running the command, you should see an output confirming that a new artifact named “hello” was created successfully.
|
||||
|
||||
[Next: setting up the server](./setup-server.md)
|
||||
### 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)
|
||||
@@ -1 +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)
|
||||
@@ -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)
|
||||
@@ -1,35 +1,60 @@
|
||||
The easiest way to get up and running is using docker
|
||||
Certainly! Here's a revised version of your documentation page to make it
|
||||
## Quick Start with mini loader using Docker
|
||||
|
||||
First let’s deploy the container
|
||||
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
|
||||
```
|
||||
|
||||
That’s it, your server should be running
|
||||
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
|
||||
```
|
||||
|
||||
Next we need to authorize. Since we have not setup authorization, we need to use our container to issue a token.
|
||||
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
|
||||
```
|
||||
|
||||
Which will output a token for us to use
|
||||
This command will output a token. Keep this token handy as you'll need it for the next step.
|
||||
|
||||
Now we need to authorize our CLI client before we can start to interact with our server.
|
||||
### Step 4: Authorize the CLI Client
|
||||
|
||||
Now, authorize your CLI client to interact with the server:
|
||||
|
||||
```bash
|
||||
mini-loader auth login https://localhost:4500
|
||||
```
|
||||
|
||||
Verify that the CLI is working by fetching the loads
|
||||
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
|
||||
```
|
||||
|
||||
[Next: interacting with the server](./interacting-with-server.md]
|
||||
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)
|
||||
Reference in New Issue
Block a user