Compare commits

...

2 commits

Author SHA1 Message Date
d3f56052a0 package update & move to docker for web service
Some checks failed
ci / builder (push) Failing after 18s
2025-01-24 11:26:09 -06:00
2b1a0fe04d feat: journal 01-22-25 + misc. fixes 2025-01-24 11:25:02 -06:00
12 changed files with 1808 additions and 1667 deletions

34
.dockerignore Normal file
View file

@ -0,0 +1,34 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/.next
**/.cache
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/charts
**/docker-compose*
**/compose.y*ml
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
**/build
**/dist
LICENSE
README.md

View file

@ -0,0 +1,41 @@
name: ci
on:
push:
branches:
- "main"
jobs:
builder:
runs-on: docker
container:
image: node:23-alpine
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up context
uses: docker context create builders
- name: Set up Docker Build
uses: docker/setup-buildx-action@v2
with:
version: latest
endpoint: builders
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY_URL }}
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ vars.REGISTRY_URL }}/${{ env.GITHUB_REPOSITORY }}:latest

79
Dockerfile Normal file
View file

@ -0,0 +1,79 @@
# syntax=docker/dockerfile:1
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/go/dockerfile-reference/
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7
ARG NODE_VERSION=23.3.0
ARG PNPM_VERSION=9.10.0
################################################################################
# Use node image for base image for all stages.
FROM node:${NODE_VERSION}-alpine AS base
# Set working directory for all build stages.
WORKDIR /usr/src/app
# Install pnpm.
RUN --mount=type=cache,target=/root/.npm \
npm install -g pnpm@${PNPM_VERSION}
RUN corepack enable
################################################################################
# Create a stage for installing production dependecies.
FROM base AS deps
# Download dependencies as a separate step to take advantage of Docker's caching.
# Leverage a cache mount to /root/.local/share/pnpm/store to speed up subsequent builds.
# Leverage bind mounts to package.json and pnpm-lock.yaml to avoid having to copy them
# into this layer.
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
--mount=type=cache,target=/root/.local/share/pnpm/store \
pnpm install --prod --frozen-lockfile
################################################################################
# Create a stage for building the application.
FROM deps AS build
# Download additional development dependencies before building, as some projects require
# "devDependencies" to be installed to build. If you don't need this, remove this step.
RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=pnpm-lock.yaml,target=pnpm-lock.yaml \
--mount=type=cache,target=/root/.local/share/pnpm/store \
pnpm install --frozen-lockfile
# Copy the rest of the source files into the image.
COPY . .
# Run the build script.
RUN pnpm run build
################################################################################
# Create a new stage to run the application with minimal runtime dependencies
# where the necessary files are copied from the build stage.
FROM base AS final
# Use production node environment by default.
ENV NODE_ENV=production
# Run the application as a non-root user.
USER node
# Copy package.json so that package manager commands can be used.
COPY package.json .
# Copy the production dependencies from the deps stage and also
# the built application from the build stage into the image.
COPY --from=deps /usr/src/app/node_modules ./node_modules
COPY --from=build /usr/src/app/dist ./dist
# Expose the port that the application listens on.
ENV HOST=0.0.0.0
ENV PORT=4321
EXPOSE 4321
# Run the application.
CMD pnpm start

22
README.Docker.md Normal file
View file

@ -0,0 +1,22 @@
### Building and running your application
When you're ready, start your application by running:
`docker compose up --build`.
Your application will be available at http://localhost:4321.
### Deploying your application to the cloud
First, build your image, e.g.: `docker build -t myapp .`.
If your cloud uses a different CPU architecture than your development
machine (e.g., you are on a Mac M1 and your cloud provider is amd64),
you'll want to build the image for that platform, e.g.:
`docker build --platform=linux/amd64 -t myapp .`.
Then, push it to your registry, e.g. `docker push myregistry.com/myapp`.
Consult Docker's [getting started](https://docs.docker.com/go/get-started-sharing/)
docs for more detail on building and pushing.
### References
* [Docker's Node.js guide](https://docs.docker.com/language/nodejs/)

57
compose.yaml Normal file
View file

@ -0,0 +1,57 @@
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Docker Compose reference guide at
# https://docs.docker.com/go/compose-spec-reference/
# Here the instructions define your application as a service called "server".
# This service is built from the Dockerfile in the current directory.
# You can add other services your application may depend on here, such as a
# database or a cache. For examples, see the Awesome Compose repository:
# https://github.com/docker/awesome-compose
services:
server:
build:
context: .
environment:
NODE_ENV: production
ports:
- 127.0.0.1:4321:4321
watchtower:
image: containrrr/watchtower
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /$HOME/.docker/config.json:/config.json
command: --interval 300
# The commented out section below is an example of how to define a PostgreSQL
# database that your application can use. `depends_on` tells Docker Compose to
# start the database before your application. The `db-data` volume persists the
# database data between container restarts. The `db-password` secret is used
# to set the database password. You must create `db/password.txt` and add
# a password of your choosing to it before running `docker-compose up`.
# depends_on:
# db:
# condition: service_healthy
# db:
# image: postgres
# restart: always
# user: postgres
# secrets:
# - db-password
# volumes:
# - db-data:/var/lib/postgresql/data
# environment:
# - POSTGRES_DB=example
# - POSTGRES_PASSWORD_FILE=/run/secrets/db-password
# expose:
# - 5432
# healthcheck:
# test: [ "CMD", "pg_isready" ]
# interval: 10s
# timeout: 5s
# retries: 5
# volumes:
# db-data:
# secrets:
# db-password:
# file: db/password.txt

View file

@ -4,51 +4,53 @@
"version": "0.0.1", "version": "0.0.1",
"scripts": { "scripts": {
"dev": "astro dev", "dev": "astro dev",
"start": "export $(cat .env.runtime) && node ./dist/server/entry.mjs", "start": "node ./dist/server/entry.mjs",
"build": "astro check && astro build", "build": "astro check && astro build",
"preview": "astro preview", "preview": "astro preview",
"astro": "astro" "astro": "astro"
}, },
"dependencies": { "dependencies": {
"@astrojs/check": "^0.9.4", "@astrojs/check": "^0.9.4",
"@astrojs/mdx": "^3.1.9", "@astrojs/mdx": "^4.0.7",
"@astrojs/node": "^8.3.4", "@astrojs/node": "^9.0.1",
"@astrojs/prism": "^3.1.0", "@astrojs/prism": "^3.2.0",
"@astrojs/react": "^3.6.2", "@astrojs/react": "^4.1.6",
"@astrojs/rss": "^4.0.9", "@astrojs/rss": "^4.0.11",
"@astrojs/tailwind": "^5.1.2", "@astrojs/tailwind": "^5.1.5",
"@fontsource/libre-baskerville": "^5.1.0", "@fontsource/libre-baskerville": "^5.1.1",
"@fontsource/nunito": "^5.1.0", "@fontsource/nunito": "^5.1.1",
"@types/react": "^18.3.11", "@types/react": "^18.3.18",
"@types/react-dom": "^18.3.0", "@types/react-dom": "^18.3.5",
"astro": "^4.16.10", "astro": "^5.1.8",
"astro-icon": "^1.1.1", "astro-icon": "^1.1.5",
"astro-m2dx": "^0.7.16", "astro-m2dx": "^0.7.16",
"date-fns": "^4.1.0", "date-fns": "^4.1.0",
"date-fns-tz": "^3.2.0", "date-fns-tz": "^3.2.0",
"feed": "^4.2.2", "feed": "^4.2.2",
"github-slugger": "^2.0.0", "github-slugger": "^2.0.0",
"linkedom": "^0.18.5", "linkedom": "^0.18.6",
"node-html-parser": "^6.1.13",
"prism": "^4.1.2", "prism": "^4.1.2",
"prism-react-renderer": "^2.4.0", "prism-react-renderer": "^2.4.1",
"prismjs": "^1.29.0", "prismjs": "^1.29.0",
"react": "^18.3.1", "react": "^18.3.1",
"react-code-block": "^1.0.0", "react-code-block": "^1.1.1",
"react-dom": "^18.3.1", "react-dom": "^18.3.1",
"react-icons": "^5.3.0", "react-icons": "^5.4.0",
"rehype-mdx-code-props": "^3.0.1", "rehype-mdx-code-props": "^3.0.1",
"rehype-pretty-code": "^0.14.0", "rehype-pretty-code": "^0.14.0",
"rehype-slug": "^6.0.0", "rehype-slug": "^6.0.0",
"tailwindcss": "^3.4.13", "sharp": "^0.33.5",
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7", "tailwindcss-animate": "^1.0.7",
"typescript": "^5.6.2" "typescript": "^5.7.3",
"@types/lodash": "^4.17.14",
"astro-auto-import": "^0.4.4",
"astro-mdx-code-blocks": "^0.0.6",
"lodash": "^4.17.21"
}, },
"packageManager": "pnpm@9.10.0+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c", "packageManager": "pnpm@9.10.0+sha512.73a29afa36a0d092ece5271de5177ecbf8318d454ecd701343131b8ebc0c1a91c487da46ab77c8e596d6acf1461e3594ced4becedf8921b074fbd8653ed7051c",
"devDependencies": { "devDependencies": {
"@types/lodash": "^4.17.13",
"astro-auto-import": "^0.4.4",
"astro-mdx-code-blocks": "^0.0.6",
"lodash": "^4.17.21",
"node-html-parser": "^6.1.13"
} }
} }

3053
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,8 @@ import { parse } from 'node-html-parser';
// https://ellodave.dev/blog/article/using-svgs-as-astro-components-and-inline-css/ // https://ellodave.dev/blog/article/using-svgs-as-astro-components-and-inline-css/
export interface Props { export interface Props {
icon: string icon: string,
class: string,
} }
function getSVG(name: string) { function getSVG(name: string) {

View file

@ -97,7 +97,7 @@ import HR from "../HR.astro";
button.addEventListener("click", (event) => { button.addEventListener("click", (event) => {
if (!menu.classList.contains("active")) { // if closed, stop having it be closed! if (!menu.classList.contains("active")) { // if closed, stop having it be closed!
menu.classList.add("active"); menu.classList.add("active");
button.setAttribute("aria-expanded", true); button.setAttribute("aria-expanded", "true");
// we need to set the max height to the height of the accordion object so the animations work correctly // we need to set the max height to the height of the accordion object so the animations work correctly
content.classList.remove("hidden"); content.classList.remove("hidden");
@ -105,7 +105,7 @@ import HR from "../HR.astro";
chevron.classList.add("rotate-180"); chevron.classList.add("rotate-180");
} else { // if open, stop having it be open!!!! } else { // if open, stop having it be open!!!!
menu.classList.remove("active"); menu.classList.remove("active");
button.setAttribute("aria-expanded", false); button.setAttribute("aria-expanded", "false");
content.style.maxHeight = '0px'; content.style.maxHeight = '0px';
chevron.classList.remove("rotate-180"); chevron.classList.remove("rotate-180");

View file

@ -21,7 +21,7 @@ if (p.href.includes('https://') || p.href.includes('http://')) {
<slot/> <slot/>
{external ? ( {external ? (
<> <>
<Icon icon="FaExternalLink" class='w-2.5 inline-block align-super fill-crusta-800 fill:stroke-night-400' aria-hidden="true"/> <Icon icon="FaExternalLink" class='w-2.5 inline-block align-super fill-crusta-800 dark:fill-night-400' aria-hidden="true"/>
<span class="hidden">opens in a new tab</span> <span class="hidden">opens in a new tab</span>
</> </>
) : ''} ) : ''}

View file

@ -21,7 +21,7 @@ import { timeZone } from "../lib/utils";
<h2 class="font-serif text-3xl my-2">Hey. Welcome to City 23.</h2> <h2 class="font-serif text-3xl my-2">Hey. Welcome to City 23.</h2>
<Picture <Picture
src={cri} src={cri}
alt="A scrunkly picture of my sona crying" alt="A scrunkly drawing of my sona crying"
class="w-20 mr-4 inline-flex float-left" class="w-20 mr-4 inline-flex float-left"
/> />
<p class="mb-2"> <p class="mb-2">
@ -34,18 +34,10 @@ import { timeZone } from "../lib/utils";
<a href="/journal" class="font-serif text-subtitle text-sm hover:underline">November 14, 2024</a> <a href="/journal" class="font-serif text-subtitle text-sm hover:underline">November 14, 2024</a>
</p> </p>
<MDXCallout preset="new"> <MDXCallout preset="info">
This site is now using the <a href="https://astro.build">Astro web framework</a>! whoops i forgor to pay my hosting provider so my website went poof. i fixed it. website back now. yey
Previously, this site was using <a href="https://nextjs.org">Next.js</a>, a fullstack framework built for big whig companies
with big whig webapps... and it didn't really fit this site. Hopefully, the move to Astro will mean a more responsive and performant
blog that still has room to expand in the future. To learn more about this, check out my <a href="/journal#2024-11-12"
class="text-subtitle hover:underline">latest journal entry</a>.
<br/><br/> <br/><br/>
I also want to note that there are now only <b>two</b> content feeds, Atom and JSON, Expect an editing pass to my last blog post (f i n a l l y) sometime soon-ish.
accessed via <a href="/feeds/feed.xml" class="text-subtitle hover:underline"><code>/feeds/feed.xml</code></a> and <a href="/feeds/feed.json" class="text-subtitle hover:underline"><code>/feeds/feed.json</code></a> respectively. This was done to simplify my RSS feeds and give myself
less work lmao.
<br/><br/>
If you have any questions (or bug reports) regarding the transition to Astro, please reach out via email. Hope you enjoy the new site!
</MDXCallout> </MDXCallout>
<h2 class="font-serif text-2xl mb-2">recent posts</h2> <h2 class="font-serif text-2xl mb-2">recent posts</h2>

View file

@ -13,30 +13,42 @@ import Icon from "../components/Icon.astro";
## now ## now
Working on my website instead of taking notes for class because i do not control the hyperfixation.... and also I'm way behind and I am too stressed to catch up right now ;3; it's 4am. i need to sleep. but i will not. because i do not control the eep
--- ---
<MDXAccordion title="todo"> <MDXAccordion title="todo">
- [ ] Make an editing pass on the last blog post (FINALLY) so I can stop worrying about it.
- [ ] Just. Write. Goddammit.
- [ ] Figure out how to make the API route serving the Atom feed ([feed.xml](../feeds/feed.xml)) actually send an xml file that can be recognized by the browser (i.e. allowing for a `.xsl` to work with it and/or opening it automatically in your RSS reader of choice). - [ ] Figure out how to make the API route serving the Atom feed ([feed.xml](../feeds/feed.xml)) actually send an xml file that can be recognized by the browser (i.e. allowing for a `.xsl` to work with it and/or opening it automatically in your RSS reader of choice).
- [ ] Write *oooooooone* more blog post deliberately **less** involved in order to break my habit of assuming a blog post has to have 5000 characters and five headings to be worth posting
- [ ] Pretty up the python function blog post to fix typos and have clearer instructions (it *is* a tutorial, after all).
- [ ] Set up a dev version of this site & start implementing the account system!
</MDXAccordion> </MDXAccordion>
{/*
--- ---
## todo # 2025-01-22
- [ ] Make external links open in a new tab. This should be pretty easy to implement. Oh my god!!! It's another year!!!!
- [ ] Potentially add an extra "new-tab" flag to MDX links (a space & "+" after the link in the parentheses? that might be too complicated
to implement nicely tho)
- [ ] Automatically insert an "external link" icon (<MdOpenInNew size='16' className="inline-flex"/>) on links that open in a new tab.
- [ ] Set up a dev version of this site & start implementing the account system!
*/}
--- In fact, it has officially been six-ish months since this version of my website has been around
(yes, it's only been two since I switched to Astro, but since that was more of a technical migration rather
than a whole website redesign, I'm not counting that lol).
On one hand, it is really cool that I've settled on something that I can feel proud of every time I look at it.
On the other hand, **my god do I need to put more stuff on here.**
So, here's the current plan:
- Make an editing pass on the last blog post (FINALLY) so I can stop worrying about it.
- Just. Write. Goddammit.
- Theeeeeen maybe we can worry about that fancy comments system I keep fantasizing about.
Heck, if you want to leave me a note on one of my blog posts, there's a great way to do so: email me! Or fedi me!! Or bsky me (ok maybe dont do that because i rarely use bsky)!!!
The main reason I want to implement a comments system is to build a community... but I can't really do that if
there are no people to fill it. So if you want to be a part of that, let me know.
......Completely unrelated question, does anyone want to see an eleboog.com IRC chatroom?
oh and [obligatory song link](https://www.youtube.com/watch?v=kI811LrVAu8)
# 2024-11-14 # 2024-11-14
@ -409,8 +421,12 @@ As usual, [here's my song recommendation of the whenever](https://www.youtube.co
--- ---
<MDXCallout preset="note">The rest of this page contains older journal entries ported over from the previous version of this site.</MDXCallout>
<MDXAccordion title="really old entries">
<MDXCallout preset="note">
This section contains older journal entries ported over from the previous version of this site.
</MDXCallout>
# 2023-08-20 # 2023-08-20
My CalcKey instance has been perpetually upset at me. It sucks because if I undo my migration, I'll likely lose all of my follows and followers. I think I might need to upgrade my VPS so it isn't using up all my server's resources... but I'm not sure if I can afford it right now. If you have some suggestions as to how I can fix this, email me lol My CalcKey instance has been perpetually upset at me. It sucks because if I undo my migration, I'll likely lose all of my follows and followers. I think I might need to upgrade my VPS so it isn't using up all my server's resources... but I'm not sure if I can afford it right now. If you have some suggestions as to how I can fix this, email me lol
@ -477,4 +493,4 @@ oh also pro tip that i just learned: adding two or more spaces to a line and the
# 2023-03-28 # 2023-03-28
Gonna try to use this as a space to put stuff that doesn't feel "big enough" for a blog post. Hopefully this encourages me to actually use this site more lol Gonna try to use this as a space to put stuff that doesn't feel "big enough" for a blog post. Hopefully this encourages me to actually use this site more lol
</MDXAccordion>