Welcome to the new Ruby.MN Tutorial of Ruby on Racetracks! Please note that this tutorial sets up the existing Ruby.MN project. The tutorial that walks you through the process of replicating the new Ruby.MN app is at https://github.com/jhsu802701/tutorial-rails-rubymn2.
- 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 Ruby on Rails. This is covered in the Docker tutorial.
- Enter the following commands in a terminal in SparkyLinux:
cd
mkdir jhsu802701
cd jhsu802701
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-rubymn2 Docker image.
- If you are using 64-bit Linux, enter the following command:
sh rbenv-rubymn2.sh
- If you are using 32-bit Linux, enter the following command:
sh 32rbenv-rubymn2.sh
- Enter the following command to enter the directory for using the development image:
cd rbenv-rubymn2
- You will be asked about your desired offset for the port numbers. Enter "3".
- Download the rbenv-rubymn2 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.
- In the rbenv-rubymn2 Docker container, enter the command "tmux" to start a tmux window.
- Enter the following commands:
git clone https://github.com/jhsu802701/rubymn2.git
cd rubymn2
sh build_fast.sh; sh server.sh
- The build_fast.sh script will prompt you for a username and password. Then it will install the gems, configures the PostgreSQL database, and runs the tests. This process takes just a few minutes. If all goes well, all of the tests will pass.
- The database names in the development, testing, and production environments are in the config/database.yml file. Note that this file is listed in the .gitignore file.
- The username and password used to access this database are in the config/application.yml file. Note that this file is also listed in the .gitignore file.
- Once the server is running, go to the URL http://localhost:3003/ in your web browser in SparkyLinux to view the Ruby.MN app.
- 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 3000 in Docker equates to port 3003 in the desktop Linux system.
- Open pgAdmin in SparkyLinux to view the data in the Ruby.MN app.
- In the upper left corner of the pgAdmin window, click on the plug icon to add a server.
- Fill in the following server parameters:
- Name: rubymn2
- Host: localhost
- Port: 15435
- Username: (the database username you selected)
- Password: (the database password you selected)
- NOTE: The ports.txt file in the shared directory shows which ports in the host correspond to the critical ports in the app in Docker. Port 5432 in Docker equates to port 15435 in the desktop Linux system.
- In the Object browser, go to Server Groups -> Servers -> rubymn2 -> Databases -> (development database name) -> schemas -> public - Tables. Right-click on the desired object and go to View Data -> View All Rows. You can now see the data.
- In the Docker container, press Ctrl-b and then "c" to create a new tmux window.
- Enter the command "cd rubymn2".
- Use this new tmux window (Window 1) for entering commands. The original tmux window (Window 0) is dedicated to the Rails server.
- In the Docker container, enter the command "sh mailcatcher.sh". This runs the mail server.
- Go to the URL http://localhost:1083/ in your web browser in SparkyLinux to view the development environment emails, which simulate the user experience.
- NOTE: The ports.txt file in the shared directory shows which ports in the host correspond to the critical ports in the app in Docker. Port 1080 in Docker equates to port 1083 in the desktop Linux system.