* editing post for lewdlad and adding s1ck diagram of architecture

This commit is contained in:
shockrah 2021-07-17 11:55:14 -07:00
parent fbe4781890
commit 5bfe5994b1
3 changed files with 485 additions and 14 deletions

409
media/img/lewdlad/arch.svg Normal file
View File

@ -0,0 +1,409 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
id="svg8"
version="1.1"
viewBox="0 0 230.77873 116.26804"
height="11.626804cm"
width="23.077873cm"
inkscape:export-filename="/home/shockrah/arch.svg.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
sodipodi:docname="arch.svg">
<defs
id="defs2">
<rect
x="55.464069"
y="35.958199"
width="43.066639"
height="21.447441"
id="rect425" />
</defs>
<sodipodi:namedview
units="cm"
inkscape:pagecheckerboard="true"
showgrid="false"
inkscape:document-rotation="0"
inkscape:current-layer="layer1"
inkscape:document-units="mm"
inkscape:cy="177.02922"
inkscape:cx="260.40981"
inkscape:zoom="0.70710678"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
borderopacity="1.0"
bordercolor="#666666"
pagecolor="#000000"
id="base"
inkscape:window-width="1920"
inkscape:window-height="1058"
inkscape:window-x="0"
inkscape:window-y="22"
inkscape:window-maximized="1"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="backs"
transform="translate(-11.336331,-5.0007677)">
<rect
style="fill:#ffffff;stroke-width:0.316169"
id="rect7-1"
width="106.52345"
height="53.471294"
x="11.336331"
y="67.797516"
ry="3.0127974"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<text
xml:space="preserve"
style="font-size:10.5833px;line-height:18.6px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
x="29.803932"
y="77.632545"
id="text393"><tspan
sodipodi:role="line"
id="tspan391"
x="29.803932"
y="77.632545"
style="stroke-width:0.264583">Game servers</tspan></text>
<text
xml:space="preserve"
id="text423"
style="font-size:10.5833px;line-height:18.6px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;white-space:pre;shape-inside:url(#rect425);" />
</g>
<g
id="layer1"
inkscape:groupmode="layer"
inkscape:label="Layer 1"
transform="translate(-11.336331,-5.0007677)">
<rect
style="fill:#00ff66;stroke-width:0.102712"
id="rect90"
width="16.173546"
height="13.230754"
x="18.561098"
y="83.926842"
ry="0.99613762"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<rect
style="fill:#ff0000;fill-opacity:1;stroke-width:0.102712"
id="rect90-5"
width="16.173546"
height="13.230754"
x="37.53619"
y="83.926842"
ry="0.99613762"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<rect
style="fill:#00ff66;fill-opacity:1;stroke-width:0.102712"
id="rect90-5-6"
width="16.173546"
height="13.230754"
x="37.53619"
y="100.23837"
ry="0.99613762"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<rect
style="fill:#ff0000;fill-opacity:1;stroke-width:0.102712"
id="rect90-5-2"
width="16.173546"
height="13.230754"
x="18.561098"
y="100.345"
ry="0.99613762"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<rect
style="fill:#00ff66;fill-opacity:1;stroke-width:0.102712"
id="rect90-5-1"
width="16.173546"
height="13.230754"
x="56.511284"
y="83.926842"
ry="0.99613762"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<rect
style="fill:#ff0000;stroke-width:0.102712"
id="rect90-5-6-2"
width="16.173546"
height="13.230754"
x="56.511284"
y="100.23837"
ry="0.99613762"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<rect
style="fill:#ff0000;fill-opacity:1;stroke-width:0.102712"
id="rect90-5-9"
width="16.173546"
height="13.230754"
x="75.486389"
y="83.926842"
ry="0.99613762"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<rect
style="fill:#00ff66;fill-opacity:1;stroke-width:0.102712"
id="rect90-5-6-3"
width="16.173546"
height="13.230754"
x="75.486389"
y="100.23837"
ry="0.99613762"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<rect
style="fill:#ff0000;fill-opacity:1;stroke-width:0.102712"
id="rect90-5-1-0"
width="16.173546"
height="13.230754"
x="94.461472"
y="83.926842"
ry="0.99613762"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<rect
style="fill:#ff0000;stroke-width:0.102712"
id="rect90-5-6-2-6"
width="16.173546"
height="13.230754"
x="94.461472"
y="100.23837"
ry="0.99613762"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<rect
style="fill:#ffffff;stroke-width:0.199523"
id="rect7"
width="106.52345"
height="21.294701"
x="11.336331"
y="5.0007677"
ry="1.199833"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<text
xml:space="preserve"
style="font-size:10.5833px;line-height:18.6px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
x="44.634991"
y="20.032154"
id="text11"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"><tspan
sodipodi:role="line"
id="tspan9"
x="44.634991"
y="20.032154"
style="stroke-width:0.264583">LewdLad</tspan></text>
<rect
style="fill:#ffffff;stroke-width:0.158535"
id="rect7-2"
width="63.459583"
height="22.567453"
x="158.30746"
y="50.834526"
ry="1.2715453"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<text
xml:space="preserve"
style="font-size:10.5833px;line-height:18.6px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
x="162.79707"
y="65.058525"
id="text246"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"><tspan
sodipodi:role="line"
x="162.79707"
y="65.058525"
style="stroke-width:0.264583"
id="tspan248">LoggerLad</tspan></text>
<text
xml:space="preserve"
style="font-size:7.15674px;line-height:12.5779px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;stroke-width:0.178919"
x="-62.169464"
y="67.520874"
id="text397"
transform="rotate(-90)"><tspan
sodipodi:role="line"
id="tspan395"
x="-62.169464"
y="67.520874"
style="stroke-width:0.178919" /></text>
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.239954"
id="rect433"
width="7.3296876"
height="17.367353"
x="-54.963844"
y="40.785397"
ry="2.5700593" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.17833"
id="rect435"
width="37.718185"
height="6.8451838"
x="-85.352341"
y="51.307564"
ry="0.69888401" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.237835"
id="rect437"
width="7.601191"
height="18.477961"
x="-85.352341"
y="51.307564"
ry="0.69888359" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.17833"
id="rect435-7"
width="37.718185"
height="6.8451838"
x="-54.963844"
y="51.307564"
ry="0.69888401" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.237835"
id="rect437-9"
width="7.601191"
height="18.477961"
x="-24.846848"
y="51.307564"
ry="0.69888359" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.24265"
id="rect433-2"
width="7.4953017"
height="17.367353"
x="60.550732"
y="32.017338"
ry="2.5700593" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.221992"
id="rect435-0"
width="58.448711"
height="6.8451838"
x="11.528774"
y="42.539505"
ry="0.69888401" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.221287"
id="rect437-2"
width="6.580184"
height="18.477961"
x="11.528774"
y="42.539505"
ry="0.69888359" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.221992"
id="rect435-7-3"
width="58.448711"
height="6.8451838"
x="58.619282"
y="42.539505"
ry="0.69888401" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.221287"
id="rect437-2-5"
width="6.580184"
height="18.477961"
x="110.48781"
y="42.539505"
ry="0.69888359" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.228483"
id="rect435-0-4"
width="61.91687"
height="6.8451838"
x="5.3627915"
y="-142.58075"
ry="0.69888401"
transform="rotate(90)" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.221287"
id="rect437-2-5-7"
width="6.580184"
height="18.477961"
x="5.3627915"
y="-142.58075"
ry="0.69888359"
transform="rotate(90)" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.24265"
id="rect433-2-8"
width="7.4953017"
height="17.367353"
x="56.316204"
y="-153.10292"
ry="2.5700593"
transform="rotate(90)" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.228483"
id="rect435-0-4-4"
width="61.91687"
height="6.8451838"
x="59.339615"
y="-142.58075"
ry="0.69888401"
transform="rotate(90)" />
<rect
style="fill:#ffffff;fill-opacity:1;stroke-width:0.221287"
id="rect437-2-5-7-5"
width="6.580184"
height="18.477961"
x="114.6763"
y="-142.58075"
ry="0.69888359"
transform="rotate(90)" />
<text
xml:space="preserve"
style="font-size:8.7214px;line-height:15.3277px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;stroke-width:0.218035"
x="46.994785"
y="48.698639"
id="text823"><tspan
sodipodi:role="line"
id="tspan821"
x="46.994785"
y="48.698639"
style="stroke-width:0.218035">controls</tspan></text>
<text
xml:space="preserve"
style="font-size:6.69015px;line-height:11.7579px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;stroke-width:0.167254"
x="37.214851"
y="-137.27663"
id="text827"
transform="rotate(90)"><tspan
sodipodi:role="line"
id="tspan825"
x="37.214851"
y="-137.27663"
style="stroke-width:0.167254">Report logs to</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

30
posts/eco-eats.md Normal file
View File

@ -0,0 +1,30 @@
# Economical Eats
## A dense packing of information those in recently found hard times
It's official: your _broke and need help, but food is expensive and you're starving, what do you do?_ Let me show you.
## Precursor
* These tips are general purpose and can be changed to fit your needs
* The target audience is anyone who hasn't been _broke_
* These tips are to arm you with the knowledge to survive in modern circumstances
## Good Wholesome Tips
## Ugly Tips
## Blackpill
> These are absolute last resort and if you find yourself here either you fucked up or still have a chance to fix something else
> Nearly all of the following tips are demonstrably awful for you in some way
## More resources
Here's a bunch of links
## Afterthoughts
todo

View File

@ -2,29 +2,29 @@
## What is "Lewdlad"
Lewdlad is a Discord chat bot I created which (at the time of writing this) is used to orchestrate multiple AWS EC2 servers to provide affordable game servers to various communities that I help run.
Lewdlad is a Discord chat bot I created which (at the time of writing this) is used to orchestrate multiple AWS EC2 servers which run different game servers(Minecraft, Reflex, Hexxit, etc).
### Some history
The very first version of Lewdlad was a python script that would literally pick random images from a set of red boards on 4chan and send it to a random online person in the guild.
Eventually I created a bot(that had 1 command), that would invoke this script and send the results to whoever invoked the command.
That command is `.roll`.
After some time I added some more 4chan related commands and eventually _the Hanime module_.
The first version of Lewdlad was a Python script that would literally pick random images from a set of red boards on 4chan and send it to a random person.
Eventually I turned it into a bot which basically just sent the random image to whoever invoked the command.
The Hanime module is weird because it was conceived out of a joke: "what if Lewdlad recommended some fire hentai".
Being that it was likely 2 AM and I was bored I did some searching and found that there is no public API for Hanime.
I then opened up the site and did some reverse engineering to figure out how to spoof a browser request and get some results.
Some reversing and trial-and-error later and I had a working request script, and could search.
Finally I took this script, wrapped with some ergonomics and hooked it into the Lewdlad's codebase.
After some time came the _Hanime_ module, which came from a joke of "I wish Lewdlad would send some fire hentai.
After some research I realized querying the site wasn't going to be easy since there wasn't a public nice made API.
To this end I opened up the site and did some reverse engineering to figure out how to spoof a browser request and get some results.
Some reversing and trial-and-error later and I had a working request script which I could hook up to the bot.
Slapped it all behind a command with some basic arguments and like `.pron` was born.
### The beginnings of orchestration
### The beginnings of the server manager
Around this time I started hosting a minecraft server for friends to play on.
Being that the server had limited _burst capacity_ I knew I had to make sure the server could replenish its burst for when the _peak hours_ hit.
To achieve this I put Lewdlad on the same server as the minecraft game files and put the `start-minecraft.sh` script behind a command for Lewdlad to use.
Being hosted on AWS meant the server had _burst capacity_, which basically means the CPU can boost temporarily to handle harder workloads.
This ability is similar to a magic ability in most games, takes up some MP and has to recharge.
While idling a vanilla minecraft server sits very close to the _burst limit_ where the CPU starts using its _burst capability_.
To make sure it didn't needlessly burst I put Lewdlad on the same server as the minecraft game files and put a `start-minecraft.sh` script behind a command for the bot to use.
The architecture was surprisingly simple and ended up being way more flexible and easy to use than I ever expected.
Basically each game had its own directory in a predetermined directory:
I ended up extending it to this with multiple games so each game had its own directory in a predetermined directory:
```
Lewdlad/
@ -61,4 +61,36 @@ This meant a minimal configuration could look like
Adding crash safety is trivially easy as recovering is a matter of checking configuration files and determining which are _falsely active_.
## A new Architecture
The new architecture has a few goals in mind:
* Reduce operating costs
* Reduce impact of game failure
* learned the hard way how bad wine would throttle everything
* More flexibility
![](/media/img/lewdlad/arch.svg)
The text version of this goes like this:
* Lewdlad lives on its own virtual private server
* Each game server is now its own EC2 instance
* Basically just an EC2 cluster
* Loggerlad is whatever I decide to use for centralized logging
### Pros
* Only get charged for ec2 instances that are _actually live/running_
* Elastic IP's are cheap as hell per month
* Lots of free logging services that I could technically even host my self.