dans-site init
This is the fist page post. Followed the guide from Techno Tim to build this site. Then push this site into a doocker file, also from on of Techno Tim’s guides.
UPDATE: Migrated to Hugo see my latest post for more details.
What did I do?
-
Build Jekyll
Step one is to install ruby, then use gem to install jekyll and bundler.
On Ubuntu
sudo apt update sudo apt install ruby-full build-essential zlib1g-dev gitOn MacOS
brew install chruby ruby-install xzInstall bundler
gem install jekyll bundler cd project-file bundle -
Modify jekyll config
Next we need to modify the config file.
timezone: America/Denver title: Dans-Homepage description: >- Dans site for sharing the things I build (and break)And update all the social links. Also make sure to update the
_data/contact.ymlfile with what contact sites I want. Remove Twitter and rss, add Mostodon and LinkedIn. -
Add pages
Next step will be to add pages. This is done by adding a
YYYY-MD-DD-name.mdto the_posts/folder.This file also needs a header at the top
--- title: dans-site init date: 2023-03-04 10:00:00 -700 catagories: [meta,setup] tags: [meta,setup] ---Then the rest of the file is filled with the markdown for the post.
-
Build for prod
Next step is to view and build the site.
Use
bundle exec jekyll sto build the site localy. This will build the site then host it locally on port4000. Once we like how it looks, we can complie the whole site to html for publishing to the web.JEKYLL_ENV=production bundle exec jekyll bAdding the
JEKYLL_ENV=productionput all the needed html pages in the_sitefolder. From there it’s ready to be hosted. -
Docker build with
Once it’s in that folder, we can push all the files into a docker image. Dockerfile is silly simple. Nginx apline stable.
FROM nginx:stable-alpine COPY ./_site /usr/share/nginx/htmlThen just build and run it.
docker build . -t dans-homepage docker run -d -p 80:80 dans-homepage -
Push dockerfile to AWS?
The original plan was to add my Dockerfile to ECR and from there spin up ECS to deply it. But the virtual networking to connect all that has been a little ticky. So for now we just spin up a single EC2 instance, run through all the same steps, and poing
oconnordaniel.comto the Elastic IP address of the instance.The next plan will be to do 1. Something a little more streamlined in terms of “Once I hit
commit && push origin main, the site just updates. And 2. Setting up a fancier and more docker style set up the a single EC2 instance. Cause at that point I might as well just Linode the whole thing.