Compare commits

..

No commits in common. "b1fe38da5a7e732a522c4744aa6d5354effe8c4c" and "f66e46850f68461854c1c7532b34fa637617bff7" have entirely different histories.

8 changed files with 4 additions and 104 deletions

View file

@ -1,23 +0,0 @@
name: Build and push Docker image
# Only on new tags
on:
push:
tags:
- "*.*.*"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- name: Update jsr.json
run: sed -i "s/x.x.x/${{ github.ref_name }}/g" jsr.json
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- run: deno publish

View file

@ -1,7 +0,0 @@
ISC License
Copyright 2024 staxman authors
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View file

@ -4,36 +4,6 @@ AWS CDK but for normal people. Don't worry about scaling and AWS bills, just ren
Also this is only going to be tested with Deno. You deserve better than node.
## Usage
Use with [staxman](https://git.fromouter.space/staxman) (WIP).
Usage example (v0):
```ts
import { Stack } from "../mod.ts";
interface RedisStackOptions {
stackName?: string;
redisVersion?: string;
}
export class RedisStack extends Stack {
constructor(props: ImmichStackOptions) {
super(props.stackName ?? "immich");
const redis = this.addService("redis", {
image: `registry.hub.docker.com/library/redis:${props.redisVersion ?? "alpine"}`,
restart: "unless-stopped"
});
}
}
const stack = new RedisStack({ redisVersion: "6.2-alpine" });
```
For a more in-depth example, see the example stacks in `example/`.
## World domination plan
Current status: v0 - Annoyingly, this already kinda works!

View file

@ -1,9 +0,0 @@
{
"$schema": "https://jsr.io/schema/config-file.v1.json",
"name": "@staxman/containerlib",
"version": "x.x.x",
"exports": "./mod.ts",
"publish": {
"exclude": [".forgejo"]
}
}

View file

@ -1,4 +1,4 @@
import { DefinitionsNetwork } from "../compose-schema.ts";
import { DefinitionsNetwork } from "../compose-schema";
export class Network {
constructor(

View file

@ -17,30 +17,6 @@ function mapRecordToCompose<T, F extends { toCompose(): T }>(
);
}
/**
* Stack is a collection of services, networks, and volumes.
* Every stack gets turned into a compose file at the end of the execution.
* To create a stack, define a new class that extends Stack, then
* instantiate the class with the name of the stack.
*
* Example:
* ```ts
* import { Stack } from "../mod.ts";
*
* class ExampleStack extends Stack {
* constructor(name: string) {
* super(name);
*
* const redis = this.addService("redis", {
* image: "registry.hub.docker.com/library/redis:6.2-alpine",
* restart: "unless-stopped",
* });
* }
* }
*
* const stack = new ExampleStack("example");
* ```
*/
export class Stack {
private services: Record<string, Service> = {};
private networks: Record<string, Network> = {};

View file

@ -1,4 +1,4 @@
import { DefinitionsVolume } from "../compose-schema.ts";
import { DefinitionsVolume } from "../compose-schema";
export class Volume {
constructor(

View file

@ -7,17 +7,10 @@ export function registerDeployment(stack: Stack) {
deployments.push(stack);
}
export function getStacks(): Record<string, ComposeSpecification> {
globalThis.addEventListener("unload", () => {
const stacks: Record<string, ComposeSpecification> = {};
for (const stack of deployments) {
stacks[stack.name] = stack.toComposeFile();
}
return stacks;
}
globalThis.addEventListener("unload", () => {
if (deployments.length > 0) {
// Print stacks
console.log(JSON.stringify(getStacks(), null, 2));
}
console.log(JSON.stringify(stacks, null, 2));
});