Develop a Rails application with Wazaterm

This section describes how to develop Rails applications using Wazaterm.

What you need
  • PC with internet connection
  • A browser
  • Unix environment or software with SSH Local Port Forwarding (autossh is recommended).

I will explain how to use it from an iPad in another article. This time, I will explain how to use it from Mac.

1. Launch Wazaterm

Start Wazaterm by referring to this article.

2. Install Ruby

Install ruby by using rbenv tool.

# sudo apt install rbenv
$ rbenv install 
$ ~/.rbenv/bin/rbenv init
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ rbenv install -L | less  # check version
$ rbenv install 3.0.3 # install supported ones
$ ruby -v # check version

3. Create Rails project

$ gem install rails
$ rails new my_project 

4. Start the Rails server

The default port of the development server is 3000, but Wazaterm opens 3000, so if you want to use SSH port forwarding, start the server on a port other than 3000 or 5000. In this example, the port number is 8000. (see Available ports for Wazaterm for more details)

$ cd my_project
$ rails server -p 8000

5. Use autossh on your PC for local port forwarding

$ autossh -M 50100 -NT -o "ServerAliveInterval 60" -o TCPKeepAlive=yes -o "ServerAliveCountMax 120"  -L 8000:localhost:8000 username@hostname.wazaterm.com &

The idea is the same, so Windows will use WSL (Windows Subsystem for Linux) and ChromeOS will use Crostini with the Unix that comes with the OS

6. Access and check with a browser

Enter localhost:8000 in your browser and you will see the first page. From here, you can use the CLI editor or VS Code to develop.

onrails (1).png