Skip to content

Instantly share code, notes, and snippets.

@jhsu802701
Last active September 1, 2017 04:40
Show Gist options
  • Save jhsu802701/664e40c2f15e861bd64a3fd639163072 to your computer and use it in GitHub Desktop.
Save jhsu802701/664e40c2f15e861bd64a3fd639163072 to your computer and use it in GitHub Desktop.

Rails.MN Tutorial

Welcome to the Rails.MN Tutorial of Ruby on Racetracks! Although the Rails.MN group is dedicated to Ruby on Rails, the web site is static and uses Ruby's Jekyll tool instead of Rails.

Prerequisites

  • You should have version 4 of SparkyLinux installed as your host OS or virtual OS. You may also use any other Linux distro based on Debian Stretch. If you are using a Mac or Windows, you can use a VirtualBox virtual machine with SparkyLinux on it. For more details, go through the VirtualBox Tutorial.
  • You should have Docker installed in your SparkyLinux desktop Linux setup. This is covered in chapter 1 of the Docker Tutorial.
  • You should be familiar with the Docker way of developing in Jekyll. This is covered in the Docker tutorial.
  • You should have an account on GitHub.

Forking Rails.MN

Entering the Jekyll Docker Container

  • Enter the following commands in a terminal in SparkyLinux:
cd
git clone https://github.com/jhsu802701/docker-debian-stretch.git
cd docker-debian-stretch
  • Create the files for using a Docker container based on the rbenv-jekyll Docker image.
    • If you are using 64-bit Linux, enter the following command:
    sh rbenv-jekyll.sh
    
    • If you are using 32-bit Linux, enter the following command:
    sh 32rbenv-jekyll.sh
    
  • Enter the following command to enter the directory for using the development image:
cd rbenv-jekyll
  • You will be asked about your desired offset for the port numbers. Enter "0".
  • Download the rbenv-jekyll Docker image and start a Docker container based on it by entering the following command:
sh download_new_image.sh
  • In a few minutes, you will be automatically logged into the Docker container based on this Docker image.

Setting Up the App

  • In the rbenv-jekyll Docker container, enter the command "tmux" to start a tmux window.
  • Enter the following commands:
git clone (URL of your fork)
cd railsmn.github.io
bundle install
rm -rf ./_site
bundle exec jekyll build
bundle exec jekyll serve --host 0.0.0.0

Viewing the App

  • Once the server is running, go to the URL http://localhost:4000/ in your web browser in SparkyLinux to view your local version of the Rails.MN site.
  • NOTE: The ports.txt file in the shared directory shows which ports in desktop Linux correspond to the critical ports in the app in Docker. Port 4000 in Docker equates to port 4000 in the desktop Linux system.

Entering Commands

  • In the Docker container, press Ctrl-b and then "c" to create a new tmux window.
  • Enter the command "cd railsmn.github.io".
  • Use this new tmux window (Window 1) for entering commands. The original tmux window (Window 0) is dedicated to the Jekyll server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment