This is a server agent that you can run locally on your server. It is designed to handle tasks and manage jobs according to the defined configurations.
- bun
- bun:sqlite
- crypto -> for secure token encription
To install the required dependencies, use Bun:
bun install
To set up the database schema and perform migrations, run:
bun run migrate
This command will create the necessary tables and ensure the database is up-to-date.
To start the REST API server, which allows you to set jobs and manage users who can add jobs to the server, use:
bun run server
The REST API server provides endpoints for job and user management.
To run the server agent that processes jobs, execute:
bun run agent
The agent continuously processes jobs and performs the assigned tasks according to the configurations.
-
Start the REST API Server: This will allow you to create and manage jobs and users.
-
Run the Agent: This will continuously process the jobs as per the configurations and schedules.
Here’s the updated README
section for the REST API reference, including the necessary curl commands and instructions for managing cookies and tokens.
To log in and receive a session cookie:
curl -c cookies.txt --location 'http://localhost:3000/api/v1/login' \
--header 'Content-Type: application/json' \
--header 'X-Forwarded-For: 10.0.0.10' \
--data-raw '{
"email": "agayen04@gmail.com"
}'
You need to collect the token from the cookies.txt
file. After logging in, the token will be in the cookies file. The format of the file might look like this:
# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
#HttpOnly_localhost FALSE / TRUE 1722059024 token 31b121f36081c46aee3a7c4fdaa8fa97:1d600f5365bb46ba4b6e4ac9286778cfa64e470a31f14b0a4e2fbfa9da6e4362d5aecf4446c5cbfdf5f45d1a303d50b8c2b08aa3388aee18c7715ae0aa7eb1834550657c626484cc8708738c1166f550
Here, the token is:
31b121f36081c46aee3a7c4fdaa8fa97:1d600f5365bb46ba4b6e4ac9286778cfa64e470a31f14b0a4e2fbfa9da6e4362d5aecf4446c5cbfdf5f45d1a303d50b8c2b08aa3388aee18c7715ae0aa7eb1834550657c626484cc8708738c1166f550
To list users, including the token from the cookies:
curl --location --request GET 'http://localhost:3000/api/v1/users' \
--header 'Content-Type: application/json' \
--header 'X-Forwarded-For: 10.0.0.10' \
--header 'Cookie: token=<token>'
Replace <token>
with the actual token you extracted.
To list jobs, including the token from the cookies:
curl --location --request GET 'http://localhost:3000/jobs' \
--header 'Content-Type: application/json' \
--header 'X-Forwarded-For: 10.0.0.10' \
--header 'Cookie: token=<token>'
Replace <token>
with the actual token you extracted.
To create a new job, including the token from the cookies:
curl --location 'http://localhost:3000/api/v1/jobs' \
--header 'Content-Type: application/json' \
--header 'X-Forwarded-For: 10.0.0.10' \
--header 'Cookie: token=<token>' \
--data-raw '{
"type": "test",
"data": "opos test.py"
}'
Replace <token>
with the actual token you extracted.
To create a new user, including the token from the cookies:
curl --location 'http://localhost:3000/api/v1/users' \
--header 'Content-Type: application/json' \
--header 'X-Forwarded-For: 10.0.0.10' \
--header 'Cookie: token=<token>' \
--data-raw '{
"email": "agayen@gmail.com",
"name": "Abhijit test",
"role": "user"
}'
Replace <token>
with the actual token you extracted.
- UI will be available soon
- RPC call support
- Enhanced security