add iocaine blog post

This commit is contained in:
lia
2025-08-25 21:26:10 +00:00
parent 2e397c5be3
commit 35aa3b076f

View File

@@ -70,7 +70,7 @@ pub trait BlogEntry: Sized {
"certified catgirl™", "certified catgirl™",
"software engineer", "software engineer",
"professional yapper", "professional yapper",
"neurospicy and disabled" "neurospicy and disabled",
], ],
about: "", about: "",
}, },
@@ -83,17 +83,122 @@ pub trait BlogEntry: Sized {
}, },
]; ];
const POSTS: [&'static Post; 1] = [ const POSTS: [&'static Post; 2] = [
/*&Post { &Post {
id: 0, id: 0,
authors: &[0], authors: &[0],
title: "sweet little poison", title: "haj, world!",
utcdate: "1970-01-01", utcdate: "2025-08-24",
content: r#" content: r#"
### this will be a future write-up how i set up iocaine with caddy and docker. ### my first blogpost
### here's my docker-compose.yml: haj! and welcome to my first blogpost.
this blogpost won't have that much content.
fun fact: this post becomes html from markdown :3
pretty cool, ain't it? we think so too.
it's for including images, formatted text, code and content much easier.
i also added a too overcomplicated blog backend that allows authors and posts by u8::MAX, cause why not.
won't post that much either way, so why bother with higher values.
nonetheless... have a great day, evening, whatever daytime it's for you rn and stay safe. ♡
you may take a look at my other blogposts. this one was basically practially just a test.
"#,
},
&Post {
id: 1,
authors: &[0],
title: "sweet little poison",
utcdate: "2025-08-25",
content: r#"
### > setting up iocaine with docker and caddy. ~
sup, today we're going to give ya a crash course on how to homebrew poison for ai. ^.^
we'll be utilizing docker for containerization and caddy as a reverse-proxy.
```yml #### > preparing docker and files ~
first, we're going to create a new external network and recreate our file struct.
in this example we're going to name it "caddy". very creative, i know.
we achieve this by running following pile of commands:
```sh
docker network create caddy && \
mkdir -p ./caddy/pages/example.com ./iocaine ./socks && \
touch ./docker-compose.yml ./caddy/proxy ./iocaine/config.toml && \
touch ./caddy/pages/example.com/index.html && \
printf '<html><body><h1>hellow body consisting of blood and flesh</h1></body></html>' \
> ./caddy/pages/example.com/index.html
```
after running that we should be set and ready for the next few steps.
if you're curious, this is how it should look like right now:
```sh
Documents/example » tree .
.
├── caddy
│   ├── pages
│   │   └── example.com
│   │   └── index.html
│   └── proxy
├── docker-compose.yml
├── iocaine
│   └── config.toml
└── socks
```
#### > downloading data and configuring iocaine ~
next things next: we're going to download a robots.json, some markov-chain-stuffies and a words.txt.
for now, we will be using the default stuff from the official docs cause why not:
```sh
curl --proto '=https' --tlsv1.3 \
-L https://archive.org/download/GeorgeOrwells1984/1984_djvu.txt \
-o ./iocaine/1984.txt && \
curl --proto '=https' --tlsv1.3 \
-L https://archive.org/download/ost-english-brave_new_world_aldous_huxley/Brave_New_World_Aldous_Huxley_djvu.txt \
-o ./iocaine/brave-new-world.txt && \
curl --proto '=https' --tlsv1.2 \
-L https://git.savannah.gnu.org/cgit/miscfiles.git/plain/web2 \
-o ./iocaine/words.txt && \
curl --proto '=https' --tlsv1.3 \
-L https://github.com/ai-robots-txt/ai.robots.txt/raw/refs/heads/main/robots.json \
-o ./iocaine/robots.json
```
most importantly, we have to scrape nam-shub-of-enki from gergely's git.
here's a way to curl and extract it automatically in the correct folder:
```sh
curl --proto '=https' --tlsv1.3 \
-L https://git.madhouse-project.org/api/packages/iocaine/generic/nam-shub-of-enki/20250711.0/nam-shub-of-enki-20250711.0.tar.zst \
-o ./iocaine/nam-shub-of-enki.tar.zst && \
sudo tar -xvf ./iocaine/nam-shub-of-enki.tar.zst -C ./iocaine
```
now, we're going to prepare our iocaine/config.toml like this:
```sh
cat > ./iocaine/config.toml <<'YAML'
[server]
bind = "/run/iocaine/waow.socket"
unix_listen_access = "everybody"
[server.control]
bind = "/run/iocaine/listen.socket"
unix_listen_access = "owner"
[server.request-handler]
path = "/data"
language = "roto"
[sources]
words = "/data/words.txt"
markov = [ "/data/1984.txt", "/data/brave-new-world.txt" ]
[metrics]
enable = false
YAML
```
#### > cooking up our docker compose file for deployment ~
i have fucked around with docker a little while to make this somehow work.
here's a command which will insert needed content into our docker-compose.yml:
```sh
cat > ./docker-compose.yml <<'YAML'
services: services:
caddy: caddy:
image: caddy:alpine image: caddy:alpine
@@ -107,10 +212,10 @@ services:
- "443:443" - "443:443"
- "443:443/udp" - "443:443/udp"
networks: networks:
- nginx - caddy
volumes: volumes:
- ./socks:/run/iocaine:ro - ./socks:/run/iocaine:ro
- ./nginx/pages:/var/www/html - ./caddy/pages:/var/www/html
- ./caddy/data:/data - ./caddy/data:/data
- ./caddy/config:/config - ./caddy/config:/config
- ./caddy/proxy:/etc/caddy/Caddyfile:ro - ./caddy/proxy:/etc/caddy/Caddyfile:ro
@@ -122,15 +227,13 @@ services:
hostname: proxy.iocaine hostname: proxy.iocaine
restart: unless-stopped restart: unless-stopped
ports: ports:
- "42069:42069" - "127.0.0.1:42069:42069"
networks: networks:
- nginx - caddy
volumes: volumes:
- ./iocaine:/data
- ./socks:/run/iocaine:rw - ./socks:/run/iocaine:rw
# - iocainesocket:/run/iocaine/waow.socket:rw - ./iocaine:/data
environment: environment:
# - IOCAINE__SERVER__BIND="0.0.0.0:42069"
- IOCAINE__SERVER__BIND="/run/iocaine/waow.socket" - IOCAINE__SERVER__BIND="/run/iocaine/waow.socket"
- IOCAINE__SERVER__UNIX_LISTEN_ACCESS="everybody" - IOCAINE__SERVER__UNIX_LISTEN_ACCESS="everybody"
- IOCAINE__SERVER__REQUEST_HANDLER__PATH="/data" - IOCAINE__SERVER__REQUEST_HANDLER__PATH="/data"
@@ -140,39 +243,19 @@ services:
- IOCAINE__SOURCES__WORDS="/data/words.txt" - IOCAINE__SOURCES__WORDS="/data/words.txt"
- IOCAINE__SOURCES__MARKOV=["/data/1984.txt", "/data/brave-new-world.txt"] - IOCAINE__SOURCES__MARKOV=["/data/1984.txt", "/data/brave-new-world.txt"]
- IOCAINE__METRICS__ENABLE=false - IOCAINE__METRICS__ENABLE=false
command: --config-file /data/config.toml - NSOE__AI_ROBOTS_TXT_PATH=/data/robots.json
command: --config-file /data/config.toml start
networks: networks:
nginx: caddy:
external: true external: true
YAML
``` ```
### my file-tree: #### > finishing up with caddy and deploying ~
our caddyfile needs some love to work.
here's what i ripped from the official docs:
```sh ```sh
services/proxy » tree iocaine cat > ./iocaine/proxy <<'TXT'
iocaine
├── 1984.txt
├── brave-new-world.txt
├── nam_shub_of_enki
│   ├── classify
│   │   └── mod.roto
│   ├── config.roto
│   ├── detect
│   │   └── mod.roto
│   ├── mod.roto
│   └── tests
│   └── mod.roto
├── nam-shub-of-enki-20250711.0.tar.zst
├── nam-shub-of-enki-latest.tar.zst
├── pkg.roto
├── robots.json
└── words.txt
```
### and my caddy-snippet with example:
```txt
(iocaine) { (iocaine) {
@read method GET HEAD @read method GET HEAD
@not-read not { @not-read not {
@@ -196,28 +279,20 @@ example.com {
reverse_proxy http://example:8080 reverse_proxy http://example:8080
} }
default { default {
respond 405 # this is the behaviour if neither a GET nor HEAD request comes in
reverse_proxy http://example:8080
} }
} }
} }
TXT
``` ```
"#, now the last thing that's left is a plain and simple:
}, `docker compose up -d`
*/&Post { and we should be good to go!
id: 0,
authors: &[0], i hope this post made it easier/helped you with setting up iocaine on your own server. ♡
title: "haj, world!", it's good to have this set up just to fuck around with fucking parisitic generative ai stealing your things.
utcdate: "2025-08-24", gatekeep your stuff from big corpos that are trying to make their business from your experience and skills.
content: r#"
### my first blogpost
haj! and welcome to my first blogpost.
this blogpost won't have that much content.
fun fact: this post generates html from markdown :3
so i can include images, formatted text, code and content much easier.
i also added a too overcomplicated blog backend that allows authors and posts by u8::MAX, cause why not.
won't post that much either way, so why bother with higher values. /srs
nonetheless... have a great day, evening, whatever daytime it's for you rn and stay safe. ♡s
"#, "#,
}, },
]; ];