Home dans-site init
Post
Cancel

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.

What did I do?

  1. Build Jekyll

    Step one is to install ruby, then use gem to install jekyll and bundler.

    On Ubuntu

    1
    2
    
     sudo apt update
     sudo apt install ruby-full build-essential zlib1g-dev git
    

    On MacOS

    1
    
     brew install chruby ruby-install xz
    

    Install bundler

    1
    2
    3
    
     gem install jekyll bundler
     cd project-file
     bundle
    
  2. Modify jekyll config

    Next we need to modify the config file.

    1
    2
    3
    4
    
     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.yml file with what contact sites I want. Remove Twitter and rss, add Mostodon and LinkedIn.

  3. Add pages

    Next step will be to add pages. This is done by adding a YYYY-MD-DD-name.md to the _posts/ folder.

    This file also needs a header at the top

    1
    2
    3
    4
    5
    6
    
     ---
     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.

  4. Build for prod

    Next step is to view and build the site.

    Use bundle exec jekyll s to build the site localy. This will build the site then host it locally on port 4000. Once we like how it looks, we can complie the whole site to html for publishing to the web.

    1
    
     JEKYLL_ENV=production bundle exec jekyll b
    

    Adding the JEKYLL_ENV=production put all the needed html pages in the _site folder. From there it’s ready to be hosted.

  5. 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.

    1
    2
    
     FROM nginx:stable-alpine
     COPY ./_site /usr/share/nginx/html
    

    Then just build and run it.

    1
    2
    
     docker build . -t dans-homepage
     docker run -d -p 80:80 dans-homepage
    
  6. 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.com to 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.

This post is licensed under CC BY 4.0 by the author.