The best way to control Claude Code, Codex and more from any computer or phone

main
ts 32 lines 898 Bytes
Raw
1 import * as Hetzner from "@alchemy.run/hetzner";
2 import * as Alchemy from "alchemy";
3 import * as Config from "effect/Config";
4 import * as Effect from "effect/Effect";
5
6 const DEFAULT_PUBLIC_KEY =
7 "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINxKqNPbcpc0Hl9QguQ/M5OU1xk9YiNOtfeywcHiBu6d alchemy-hetzner-server-example";
8
9 export default Alchemy.Stack(
10 "HetznerServerExample",
11 {
12 providers: Hetzner.providers(),
13 state: Alchemy.localState(),
14 },
15 Effect.gen(function* () {
16 const publicKey = yield* Config.String("SSH_PUBLIC_KEY").pipe(
17 Config.withDefault(DEFAULT_PUBLIC_KEY),
18 );
19 const key = yield* Hetzner.SshKey("deploy", { publicKey });
20 const server = yield* Hetzner.Server("box", {
21 serverType: "cx22",
22 image: "ubuntu-24.04",
23 location: "nbg1",
24 sshKeys: [key],
25 });
26
27 return {
28 ipv4: server.ipv4,
29 ipv6: server.ipv6,
30 };
31 }),
32 );