railsenv
v1.0.3
Published
Ruby on Rails development environment with Vagrant (Windows support) Edit
Downloads
2
Readme
railsenv - Rails development on Windows, Mac and Unix
Railsenv is an environment for private Ruby on Rails projects or big development-teams. This environment runs on Windows, Mac and unix systems. The railsenv-environment includes a virtual server (Ubuntu 16.04 xenial) with a lot of pre-installed good stuff you need to develop Rails applications.
By installing rbenv, rails, mysql etc. on a virtual server, instead of your main system, your computer stays clean and there's no risks of breaking any configurations. And if you accidentally break something within your Railsenv system, simply just reinstall Railsenv and continue your development in a new fresh environment.
All unix commands, like rails server
, rake db:migrate
& rake guard
and all gems like livereload, sidekiq or sass are available and runs within the virtual environment, while your project folder still is accessible from your main system. That means that you can use your favourite code editor like Sublime Text / Visual Studio Code or tools like Github Desktop.
Windows 10: This environment works at least as good on OSX or Linux, but the main purpose of the development was to create a sustainable development environment for my new PC with Windows 10. Running RoR directly on the Windows system didn't work good at all, and when running through Bash on Ubuntu on Windows - even if it worked sometimes - the performance was really bad. Rails works best in a real Unix environment - that's why I created railsenv - an Ubuntu environment 100% separeted from your main system.
Included software & versions
- rbenv, 1.1.1
- ruby, 2.3.1
- nodejs, 8.8.1
- mysql, 14.14
- postgree sql, 9.5.9
- redis, 4.0.2
- openssh, 7.2p2
- bash, 4.3.48
- and many more goodies..
Getting Started
0. Install required software
Make sure you've installed Nodejs, VirtualBox 5.1, as well as Vagrant before you move on with railsenv. Don't be afraid if all these softwares are new to you, all of them comes with an easy installer for every platform.
Windows / Mac
- Download & install Node.js
- Download & install VirtualBox 5.1
- Download & install Vagrant
Ubuntu / Debian
Follow this tutorial to install Virtualbox on your dist, and then install NodeJS & Vagrant via apt-get
:
$ sudo apt-get update
$ sudo apt-get install nodejs
$ sudo apt-get install npm # Node Package Manager
$ sudo apt-get install vagrant
1. Install Railsenv
Open a new terminal window (or the Command Prompt if you're on Windows) and install railsenv
globally using Node Package Manager (npm).
Windows 10: Make sure that you install all programs in the same environment. If you've installed Node, VirtualBox and Vagrant on your main system, you must install railsenv via your Command Prompt and not via WSL/"Bash on Ubuntu on Windows".
$ npm install -g railsenv
Confirm that railsenv
and all of the required softwares are installed correctly by running check
:
$ railsenv check
-----------------------------------
[ok] Found VirtualBox
[ok] Found Vagrant
-----------------------------------
Test passed with 0 errors and your system is compatible with Railsenv.
Provision and start your development server by running the command: 'railsenv start'
2. Start your railsenv-environment
If Railsenv was installed correctly, you should be able to access it from any folder on your system via your terminal or Command Prompt. Run railsenv start
to start your railsenv-environment. If this is the first time you're using railsenv
on your system, it will automatically download our modified copy of Ubuntu from the Vagrant Cloud. The download process may take a while depending on your internet speed, so this is a perfect time to grab a coffee from the coffe machine. Total download size is ~700MB.
$ railsenv start
Commands
Start development server
$ railsenv start
Stop development server
$ railsenv stop
Restart development server
$ railsenv restart
Check if development is up or down
$ railsenv status
Open virtual server in a bash/SSH window
$ railsenv ssh
Open & edit config.yaml in your default text editor.
$ railsenv config
Show help screen with instructions and arguments for all commands
$ railsenv help
Check if your system is ready for a railsenv environment.
$ railsenv check
Customization
Ruby version
Not happy with my choice of ruby 2.3.1
? No problem, it's easy to change the ruby version to whatever pleasures your needs. First, login to your environment with ssh by running the command railsenv ssh
, then run these commands in your rails-environment:
ubuntu@ubuntu-xenial:~$ rbenv install 2.4.2
ubuntu@ubuntu-xenial:~$ rbenv global 2.4.2
ubuntu@ubuntu-xenial:~$ rbenv rehash
Confirm your version change:
$ ruby -v
Credentials
SSH & mySQL
- host: 192.168.0.70
- user: ubuntu
- password: secret
KIAA (Known issues and answers)
Cannot render console from ip! Allowed networks: 127.0.0.1 **
Whitelist your local network by adding the following code to config/environments/development.rb
:
config.web_console.whitelisted_ips = ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16']