Coder Social home page Coder Social logo

sophieye / ethanschoonover.com Goto Github PK

View Code? Open in Web Editor NEW

This project forked from altercation/old-ethanschoonover.com-original

0.0 1.0 0.0 33.59 MB

website source (hakyll, pandoc markdown)

Home Page: http://ethanschoonover.com

Haskell 5.76% Shell 6.11% Emacs Lisp 3.97% HTML 14.97% Perl 7.63% C 0.57% Java 0.34% JavaScript 1.02% PHP 0.73% Python 1.91% Ruby 0.71% TeX 0.77% AppleScript 3.49% Vim Script 39.45% CSS 12.57%

ethanschoonover.com's Introduction

ethanschoonover.com site source

I use Hakyll to maintain this site. See the bin directory for the site.hs which builds the site statically.

Source structure

├── bin         hakyll source code
├── etc         nginx local config files
├── files       downloads, global to site
├── pages       special pages (colophon, error pages)
│   └── errors
├── posts       one time posts, with possible updates
├── projects    ongoing, updated projects
├── resources   static resources
│   ├── css
│   ├── img
│   └── js
├── src         non hakyll source files
│   └── psd
└── templates   templates used by hakyll

Deployment process overview

Local site modifications are tested until correct and pushed to github for offsite storage. When site updates are ready for public deployment I push to my web server.

Some subdirectories, notably the project subdirectories, are managed using git-subtree. The web pages for those project are identical to the github repository for those projects. The Hakyll site.hs code processes them and converts the github specific absolute urls to be relative to my server's webroot.

Git subtree has the advantage of allowing me to work on the project from either the main project directory on my machine or from the website directory (for local site preview). Additionally, the project itself is maintained with several git-subtree subdirectories, allowing me to break out the vim subdirectory as it's own repository and work on it, for instance, from within my personal dotfiles.

See http://chrisdone.com/posts/2010-04-04-hakyll-and-git-for-you-blog.html for other details on a similar hakyll-github-server deployment process that I took inspiration from.

Key commands

  • Building Hakyll site.hs

    ghc --make bin/site

  • Clean and preview site locally. bin is in my path so I can just use site and it will source locally.

    site clean site preview site preview 8900 (alternate port)

  • Create git-subtree repo (my own standardized naming conventions)

    • Add remotes:

      git remote add remote-solarized
      [email protected]:altercation/solarized.git

    • Add subtrees:

      git subtree add --prefix=projects/solarized
      remote-solarized master

    • Pull changes into local subtree

      git subtree pull --prefix=projects/solarized
      remote-solarized master

    • Push changes from local subtree

      git subtree push --prefix=projects/solarized
      remote-solarized master

  • Push to github

    standard commit and push

  • Deploy to live site

    git push aithops

Deployment Server

  • Site root and config

      /srv/www
      ├── commons
      │   └── errors
      │       ├── 403
      │       ├── 404
      │       └── 50x
      ├── domains
      │   └── domain.tld
      ├── etc
      └── logs
    
  • Create repository and configure on remote

    www@aithops$ mkdir ethanschoonover.com www@aithops$ cd ethanschoonover.com www@aithops$ git init www@aithops$ git config receive.denyCurrentBranch 'ignore' www@aithops$ cd .. www@aithops$ chmod -R g+w ethanschoonover.com

    (last command only required as I'll be commiting as a different user that is also a member of the www group)

  • Post-receive Hook

    ethanschoonover.com/.git/hooks/post-receive file (ensure this is set to executable):

      #!/bin/bash
    
      export LANG=en_US.UTF-8
    
      if [ -n $GIT_DIR ]; then
              unset GIT_DIR
              cd ..
      fi
    
      # force checkout
      git checkout -f
    
      # build site binary (if no change it won't build)
      ghc --make bin/site
    
      #backup current state for quick recovery, just in case
      rm -rf _previous 
      cp -r _site _previous 
    
      # build site to _site directory
      # note: this is not a full rebuild, but could be
      # if we did a relink to the _previous directory prior
      # to the rebuild, then a link back to _site
      bin/site build
    
      # ensure we have the correct link on initial build
      # (commented out option force overrides)
      # ln -sfn _site _live
      if [ ! -h _live ]; then
              ln -s _site _live;
      fi
    
  • Commit to server

      $ git push aithops
    

Notes

See my dotfile repository for my master gitignore file. I've added both _cache and _site there (along with the standard haskell ignores) and locally I've added bin/site (the compile hakyll binary).

ethanschoonover.com's People

Contributors

adamv avatar altercation avatar bobthecow avatar borisfaure avatar brantb avatar callahad avatar counterleft avatar deplorableword avatar dstcruz avatar icathing avatar markstory avatar nelstrom avatar rcarmo avatar sellout avatar tpope avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.