Connects to Woodpecker CI and dynamically creates an agent in the cloud.

Overview

Picus

status-badge

Picus connects to a Woodpecker CI server and creates an agent in the cloud when there are pending jobs. The agent will be shutdown when there are no more build jobs for a specific time in order to reduce cloud costs. Picus polls the Woodpecker API and starts an agent in the cloud when it is required. Currently Hetzner cloud is supported.

Usage

Picus provides a container image which can be used with docker-compose to start the service:

# docker-compose.yml
version: '3'

services:
  picus:
    # Better replace latest with specific version in next line
    image: windsource/picus:latest
    restart: always
    environment:
      - PICUS_WOODPECKER_SERVER=https://woodpecker.example.com
      - PICUS_WOODPECKER_TOKEN=<...>
      - PICUS_AGENT_WOODPECKER_SERVER=woodpecker.example.com:443
      - PICUS_AGENT_WOODPECKER_AGENT_SECRET=<...>
      - PICUS_HCLOUD_TOKEN=<...>
      - PICUS_HCLOUD_SERVER_TYPE=cx21
      - PICUS_HCLOUD_LOCATION=nbg1
      - [email protected]
      - PICUS_HCLOUD_ID=my-woodpecker-instance

The following environment variables can or have to be used:

Name Description Default
PICUS_WOODPECKER_SERVER URL to the Woodpecker host like https://woodpecker.example.com -
PICUS_WOODPECKER_TOKEN Personal token to Woodpecker -
PICUS_POLL_INTERVAL Interval in which Picus will poll the Woodpecker API /api/queue/info. For format see go_parse_duration. 10s
PICUS_MAX_IDLE_TIME Duration to wait after the last running job before shutting down an agent. For format see go_parse_duration. 30m
PICUS_AGENT_WOODPECKER_SERVER See Woodpecker doc -
PICUS_AGENT_WOODPECKER_AGENT_SECRET See Woodpecker doc -
PICUS_AGENT_WOODPECKER_GRPC_SECURE See Woodpecker doc true
PICUS_HCLOUD_TOKEN API token for Hetzner cloud -
PICUS_HCLOUD_SERVER_TYPE Server type in Hetzner cloud to use for agent cx11
PICUS_HCLOUD_LOCATION Location to start server in Hetzner cloud nbg1
PICUS_HCLOUD_SSH_KEYS List of ssh keys to apply to the server separated by comma -
PICUS_HCLOUD_ID Unqiue id to identify resources created in Hetzner Cloud for this instance of Picus. Used to separate resources for different Picus installations in Hetzner cloud project. Observe limitation in RFC 1123. picus-test

Development

Picus is written in Rust. The project provides a VSCode devcontainer which contains all required tools.

Build

cargo build

Run

cargo test

In order to run the tests with Hetzner cloud as wll, provide the required environment variables and run

cargo cargo test -- --ignored
You might also like...
A tray application for Windows that gives you push notifications and instant downloads of new posts, messages and stories posted by models you subscribe to on Onlyfans.

OF-notifier A tray application for Windows that gives you push notifications and instant downloads of new posts, messages and stories posted by models

A simpler and 5x faster alternative to HashMap in Rust, which doesn't use hashing and doesn't use heap

At least 5x faster alternative of HashMap, for very small maps. It is also faster than FxHashMap, hashbrown, ArrayMap, and nohash-hasher. The smaller

A comprehensive and FREE Online Rust hacking tutorial utilizing the x64, ARM64 and ARM32 architectures going step-by-step into the world of reverse engineering Rust from scratch.
A comprehensive and FREE Online Rust hacking tutorial utilizing the x64, ARM64 and ARM32 architectures going step-by-step into the world of reverse engineering Rust from scratch.

FREE Reverse Engineering Self-Study Course HERE Hacking Rust A comprehensive and FREE Online Rust hacking tutorial utilizing the x64, ARM64 and ARM32

Leetcode Solutions in Rust, Advent of Code Solutions in Rust and more

RUST GYM Rust Solutions Leetcode Solutions in Rust AdventOfCode Solutions in Rust This project demostrates how to create Data Structures and to implem

:crab: Small exercises to get you used to reading and writing Rust code!
:crab: Small exercises to get you used to reading and writing Rust code!

rustlings 🦀 ❤️ Greetings and welcome to rustlings. This project contains small exercises to get you used to reading and writing Rust code. This inclu

A catalogue of Rust design patterns, anti-patterns and idioms

Rust Design Patterns An open source book about design patterns and idioms in the Rust programming language that you can read here. Contributing You ar

Simple and performant hot-reloading for Rust

reloady Simple, performant hot-reloading for Rust. Requires Rust nightly and only works on Linux for now. installing CLI To install the CLI helper car

Rust library for hardware accelerated drawing of 2D shapes, images, and text, with an easy to use API.
Rust library for hardware accelerated drawing of 2D shapes, images, and text, with an easy to use API.

Speedy2D Hardware-accelerated drawing of shapes, images, and text, with an easy to use API. Speedy2D aims to be: The simplest Rust API for creating a

Compare the size of v8 and quickjs
Compare the size of v8 and quickjs

rust_v8_and_quickjs Size debug release quickjs 1,758,728 1,281,104 v8 40,047,648 20,956,816 Chart License rust_v8_and_quickjs is released under the MI

Comments
  • OpenStack support

    OpenStack support

    Hello, first of all: this is an incredibly cool project and I think it will make Woodpecker-CI generally much more useful!

    I'd like to use this autoscaler in a private Openstack cloud. Since the project is implemented in Rust, I probably won't be able to quickly put together a PR for this provider, but I found this Rust library for talking to the Openstack API: https://lib.rs/crates/openstack

    opened by jacksgt 1
Releases(0.2.0)
Owner
Holger Dormann
Holger Dormann
A cloud-native distributed serverless workers platform.

rusty-workers A cloud-native distributed serverless workers platform. Features JavaScript and WebAssembly engine powered by V8 Fetch API Highly scalab

Heyang Zhou 1.8k Jan 2, 2023
Keep a Hetzner Cloud firewall up to date with your dynamic public IP address.

hcloud-firewall-controller hcloud-firewall-controller determines the current public IP and creates or updates a Hetzner Cloud firewall with this IP. S

Max Rosin 4 Feb 6, 2023
An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous and blocking clients respectively.

eithers_rust An API for getting questions from http://either.io implemented fully in Rust, using reqwest and some regex magic. Provides asynchronous a

null 2 Oct 24, 2021
Safe, efficient, and ergonomic bindings to Wolfram LibraryLink and the Wolfram Language

wolfram-library-link Bindings to the Wolfram LibraryLink interface, making it possible to call Rust code from the Wolfram Language. This library is us

Wolfram Research, Inc. 28 Dec 6, 2022
This blog provides detailed status updates and useful information about Theseus OS and its development

The Theseus OS Blog This blog provides detailed status updates and useful information about Theseus OS and its development. Attribution This blog was

Theseus OS 1 Apr 14, 2022
Omeglib, a portmanteau of "omegle" and "library", is a crate for interacting with omegle, simply and asynchronously

Omeglib, a portmanteau of "omegle" and "library", is a crate for interacting with omegle, simply and asynchronously. It is intended to suit one's every requirement regarding chat on omegle.

null 1 May 25, 2022
Fast and simple datetime, date, time and duration parsing for rust.

speedate Fast and simple datetime, date, time and duration parsing for rust. speedate is a lax† RFC 3339 date and time parser, in other words, it pars

Samuel Colvin 43 Nov 25, 2022
In this repository you can find modules with code and comments that explain rust syntax and all about Rust lang.

Learn Rust What is this? In this repository you can find modules with code and comments that explain rust syntax and all about Rust lang. This is usef

Domagoj Ratko 5 Nov 5, 2022
A tool and library to losslessly join multiple .mp4 files shot with same camera and settings

mp4-merge A tool and library to losslessly join multiple .mp4 files shot with same camera and settings. This is useful to merge multiple files that ar

Gyroflow 7 Jan 2, 2023