+New post

+New color for code text(lightgreen)
*Removing check in upload.sh for file(filtering via find -type f)
This commit is contained in:
shockrah 2021-02-08 20:43:59 -08:00
parent 31dde1140a
commit 8b7c5243d1
5 changed files with 92 additions and 5 deletions

View File

@ -1,6 +1,13 @@
# Definitely not a blog
## I swear
## **[Auto Deploying to VPS and Neocities with Docker](/post/docker-ftw.html)**
> _February 08, 2021_
> All under Gitlab's CI/CD System
## **[Making Ice Cream at Home](/post/ice-cream.html)**
> _July 24, 2020_

View File

@ -8,7 +8,7 @@
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css" integrity="sha384-nn4HPE8lTHyVtfCBi5yW9d20FjT8BJwUXyWZT9InLYax14RDjBj46LmSztkmNP9w" crossorigin="anonymous">
<link rel="shortcut icon" type="image/png" href="/favicon.png"/>
<!-- Side menu forces things properly apparantly-->
<link rel="stylesheet" href="/style.css?v=1.2">
<link rel="stylesheet" href="/style.css?v=1.3">
<!-- Opengraph meme -->
<meta property="og:title" content="Definitely not a blog">
<meta property="og:site_name" content="Shockrah's Blog">

78
posts/docker-ftw.md Normal file
View File

@ -0,0 +1,78 @@
# Using Gitlab CI For VPS and Neocites Deployment
_I'll make this one short_: Deploying to a VPS is pretty easy when its already configured with Nginx to serve static content, but Neocities is a slight worse pain. Several scripts later I've figured out how to 100% automate pushing to both.
## Docker
A few notes about this docker file:
* Could be made way smaller if using Alpine
* Setting up Pandoc on alpine is way more effort on Alpine because you have to compile it yourself as its not in the official Alpine repos
* gensite is a script I wrote for building markdown based sites with Pandoc with 0 deps
```
FROM debian:sid-slim
RUN apt-get update && apt-get install -y git pandoc
# For more easily logging into ionos
RUN apt-get install -y sshpass
RUN apt-get install -y curl
RUN git clone https://gitlab.com/shockrah/site-generator /tmp/gensite
RUN cd /tmp/gensite && ./install.sh g
RUN rm -rf /tmp/gensite
```
## Gitlab's CI Script
It should be noted there are more environment variables set in Gitlab's WebUI to make this script work but basically everything is there.
```
image: shockrah/website:1.3
stages:
- build
- deploy
variables:
SHOPTS: "-o StrictHostKeyChecking=no"
before_script:
- eval $(ssh-agent -s)
- echo "${SSH_PRIVATE_KEY}" | ssh-add - > /dev/null
- mkdir -p ~/.ssh/
- chmod 700 ~/.ssh/
build-site:
stage: build
script:
bash ./build.sh
artifacts:
expire_in: 10 mins
paths: ["./.mirror"]
deploy-vps:
stage: deploy
script:
- ssh $SHOPTS root@shockrah.xyz "rm -rf /var/www/website"
- scp $SHOPTS -r .mirror root@shockrah.xyz:/var/www/website/
deploy-neocities:
stage: deploy
script:
# First the html
- bash upload.sh -h
# then we do the media files
- bash upload.sh -M
```

View File

@ -12,6 +12,10 @@ a {
color: white;
}
code {
color: lightgreen;
}
blockquote {
border-left: 10px solid #1f8dd6;
}

View File

@ -32,11 +32,9 @@ _upload_media() {
}
_upload_all_media() {
for file in $(find media);do
for file in $(find media -type f);do
echo Uploading media: $file
if [ -f $file ];then
curl -H "$auth" -F "$file=@$file" $url/api/upload > /dev/null
fi
curl -H "$auth" -F "$file=@$file" $url/api/upload -s > /dev/null
done
}