Deploying this Site
Now that the Inovato Quadra is setup and ready to go, I need to put some stuff on it. I’ve always had a need to do more learn more web-technologies (sometimes our day jobs don’t use interesting and new tech).
After searching “whats the best static site generator”, by far the most lauded was jekyll.
Jekyll on WSL
Setting jekyll up is pretty simple, if you already have Windows Susbsystem for Linux installed on your Windows computer. Which I do. Here’s the install guide for windows.
The linked guide has you install ruby 2.5. I found that it didn’t work at all on my WSL. Instead I had to upgrade to ruby2.6.
Here’s the basic rundown (as given by the guide):
$ sudo apt-get update -y
$ sudo apt-get upgrade -y
$ sudo apt-add-repository ppa:brightbox/ruby-ng
$ sudo apt-get update -y
$ sudo apt-get install ruby2.5 ruby2.5-dev build-essential dh-autoreconf
Afterwards you go on to run gem update
and gem install jekyll bundler
.
The second command didn’t want to work With ruby version 2.5 on WSL. There were
issues about version that popped up (but I don’t have the output and can’t really
remember what they were). So I had to do this:
$ sudo apt-get remove ruby2.5
$ sudo apt-get remove ruby2.5-dev
$ sudo apt-get install ruby2.6 ruby2.6-dev
$ sudo gem install jekyll bundler
Also I’m not sure if this a WSL thing, but all the jekyll cmds need sudo
Now jekyll is up and running on WSL and we can create a site using sudo jekyll new site_name
.
Thats basically how this site was started. The content, theme and configuration of
jekyll can come later.
Serving
I searched around for barebones http servers and landed on using httpd from a busybox container.
FROM busybox:1.35
# Create a non-root user to own the files and run our server
RUN adduser -D static
USER static
WORKDIR /home/krinkle/
# We could copy the _site output of jekyll into the image but we
# will use a bind mount to serve up the webiste files.
# COPY ./_site/ .
# Run BusyBox httpd on port 3000
CMD ["busybox", "httpd", "-f", "-v", "-p", "3000", "-h", "/home/krinkle/_site"]
# use this to bring up a shell for busybox to explore the container
# CMD ["busybox", "ash"]
Once built (via docker build -t krinkle/www:latest .
), we can create a
docker-compose.yml
file.
version: "3"
services:
frontend:
container_name: krinklesite
image: krinkle/www:latest
volumes:
- ./my_site:/home/krinkle/_site
ports:
- "80:3000"
restart: unless-stopped
docker compose up -d
and were off serving this static site.
Now where are our static site files? The bind mount tells us ./my_site:/home/krinkle/_site
.
This maps the my_site
directory within the current directory on the host machine
(the inovato quadra) to the directory inside the container /home/krinkle/_site/
.
When deploying, if you move my_site
on the host machine to backup location
(like my_site_bak), and then try to put a new my_site folder. The docker container
will not update with the new files. Docker is smart enough to follow the old bind
point even if it’s renamed. Ask me how I know.
Now it’s time to write some content and get rich store the technical steps
I will forget in a few years.