All Projects → brunofacca → rails-development-environment

brunofacca / rails-development-environment

Licence: MIT license
Development environment for Ruby on Rails based on Vagrant, VirtualBox and Ubuntu 16.04 LTS (Xenial Xerus).

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to rails-development-environment

Dev
The only truly universal productive development platform with Docker on macOS, Linux and Windows! http://blog.teracy.com/2016/12/20/teracy-dev-the-only-truly-universal-productive-development-platform-with-docker-on-macos-linux-and-windows/ http://slides.teracy.net/hoatle/productive-dev-workflow-with-teracy-dev/latest/
Stars: ✭ 84 (+68%)
Mutual labels:  vagrant, virtualbox, development-environment
vagrant-pebble-sdk
This repo contains allows you to quickly and easily create a Virtual Machine with a working Pebble SDK install using Vagrant and Virtualbox
Stars: ✭ 13 (-74%)
Mutual labels:  vagrant, virtualbox
packer-windows
Windows Templates for Packer: Windows 11, Windows 10, Windows Server 2022, 2019, 2016, also with Docker
Stars: ✭ 1,116 (+2132%)
Mutual labels:  vagrant, virtualbox
ansible-vbox-vagrant-kubernetes
Building a Kubernetes Cluster with Vagrant and Ansible
Stars: ✭ 70 (+40%)
Mutual labels:  vagrant, virtualbox
iosxrv-x64-vbox
IOS XR VirtualBox Vagrant Image Generation tools
Stars: ✭ 72 (+44%)
Mutual labels:  vagrant, virtualbox
nodejs-dev-vm
DEPRECATED Simple Node.js Development VM using Vagrant + VirtualBox + Ansible
Stars: ✭ 25 (-50%)
Mutual labels:  vagrant, virtualbox
packer-FreeBSD
Build a FreeBSD VM for Vagrant using packer
Stars: ✭ 23 (-54%)
Mutual labels:  vagrant, virtualbox
guix-vm
Scripts and support necessary to make a GuixSD Virtualbox image
Stars: ✭ 18 (-64%)
Mutual labels:  vagrant, virtualbox
opnsense-starterkit
Try opnsense, build opnsense images or start development
Stars: ✭ 18 (-64%)
Mutual labels:  vagrant, virtualbox
kubernetes the easy way
Automating Kubernetes the hard way with Vagrant and scripts
Stars: ✭ 22 (-56%)
Mutual labels:  vagrant, virtualbox
dev-with-docker-on-ubuntu
After fighting with Docker on OSX and the need for 2-way syncs, fsevents, etc. I developed a desire to get back to a simple(r) development environment on a linux based VM. This project is a jumping off point.
Stars: ✭ 25 (-50%)
Mutual labels:  vagrant, development-environment
hassio-vagrant
Vagrant box running Hass.io / Home Assistant
Stars: ✭ 42 (-16%)
Mutual labels:  vagrant, virtualbox
vagrant-boot2docker-swarm
A multi-machine Docker swarm Vagrant environment
Stars: ✭ 16 (-68%)
Mutual labels:  vagrant, virtualbox
upstream-institute-virtual-environment
A Vagrant-based image creator for OpenStack Upstream Training sessions
Stars: ✭ 18 (-64%)
Mutual labels:  vagrant, virtualbox
development-environment
A development environment for Java, Python, Node.js and Go built using Vagrant
Stars: ✭ 50 (+0%)
Mutual labels:  vagrant, virtualbox
drupal8-vagrant
Simple Drupal 8 Development Environment
Stars: ✭ 59 (+18%)
Mutual labels:  vagrant, development-environment
junos-orchestration-with-vagrant
How to orchestrate and provision Junos virtual machines with Vagrant
Stars: ✭ 14 (-72%)
Mutual labels:  vagrant, virtualbox
Vagrantboxes
Handcrafted Arch Linux Vagrant base box with ❤️
Stars: ✭ 242 (+384%)
Mutual labels:  vagrant, virtualbox
packer-centos
Create CentOS images for different hypervisors with Packer
Stars: ✭ 18 (-64%)
Mutual labels:  vagrant, virtualbox
acquia-cloud-vm
VirtualBox/Vagrant-based VM to closely match Acquia Cloud environment.
Stars: ✭ 20 (-60%)
Mutual labels:  vagrant, virtualbox

Zen Rails Development Environment

Summary

Development environment for Ruby on Rails based on Vagrant, VirtualBox and Ubuntu 16.04 LTS (Xenial Xerus).

The Vagrant provisioning scripts do the following:

  • Set the VM locale and time zone.
  • Configure the VM for SSH access with a custom SSH key.
  • Use RVM to install any version of Ruby and Rails in the VM.
  • Install PostgreSQL, configure it to listen on 0.0.0.0, create a new user called ubuntu with password localdbpass and grant it CREATEDB permissions.
  • Install MySQL, configure it to listen on 0.0.0.0 and set the password of the root user to localdbpass.
  • Install Yarn, Rails' official Frontend package manager as of Rails 5.1.
  • Install and configure Git at the VM.
  • Install Elastic Beanstalk CLI at the VM.
  • Install Heroku CLI at the VM.
  • Install Selenium Webdriver, ChromeDriver, and Xvfb. These allow the execution of JavaScript-enabled tests on Minitest or RSpec (with Capybara) using headless Google Chrome.

Other scripts run at shell startup to set environment variables and Bash shortcuts (aliases and functions).

Installation

  1. Install the latest version of Vagrant and VirtualBox on the host machine.

  2. Choose a directory for your VirtualBox shared folder (in the host machine). Download this repository and unzip it inside the chosen directory.

  3. Create an SSH key pair, name the files id_rsa (private key), id_rsa.pub (public key), and place them in the vm_provisioning directory.

  4. Edit the Vagrantfile in order to customize the values of the variables located in the "User Configurations" section.

  5. Optional: If you require any custom environment variables to be available at the guest VM, create a file named environment_variables.sh within the vm_provisioning directory and set your environment vars using the standard bash syntax: one export VAR_NAME='var value' declaration per line. Those vars will be loaded automatically every time the VM boots. That is a good place to store your API keys and other secrets.

  6. Optional: If you wish to use any custom bash aliases or functions, add them to bash_shortcuts.sh

  7. Optional: If you intend to use Selenium and Chrome headless with Capybara and RSpec, add the following to spec/rails_helper.rb:

    require 'selenium-webdriver'
    
    Capybara.register_driver :selenium do |app|
      options = Selenium::WebDriver::Chrome::Options.new
      # The window size is important for screenshots
      options.add_argument "--window-size=1366,768"
      Selenium::WebDriver::Chrome.driver_path = "/usr/local/bin/chromedriver"
      Capybara::Selenium::Driver.new(app, 
                                     browser: :chrome, 
                                     options: options)
    end
    

Files and their purposes

File Contents and/or purpose Executed at Called by
bash_shortcuts.sh Custom bash aliases and function definitions. "Login" (shell startup) Symlink at /etc/profile.d
environment_variables.sh Custom environment variable definitions. You may store your API keys and other secrets here, as long as you keep this file outside any Git repositories. "Login" (shell startup) Symlink at /etc/profile.d
boot.sh Custom startup commands. These commands were not inserted in rc.local because: a) we prefer Bash over Bourne Shell; b) the -e flag used in rc.local's shebang line causes undesired behavior. VM boot /etc/rc.local
custom_rc_local.sh Custom rc.local. Waits for the Vagrant shared folder to be mounted and executes the custom boot script (boot.sh). VM boot Installed by provision.sh
provision.sh Installs and configures everything in the VM, except Ruby and Rails. VM provisioning Vagrantfile
install_ruby.sh Installs Ruby and Rails in the VM at the end of provisioning. VM provisioning Vagrantfile
Vagrantfile General configurations. Set up the VirtualBox VM and the provisioning process. vagrant up, halt, etc the user

Usage

cd to the directory where the Vagrantfile is (in the host machine) and run:

  • vagrant up to start the VM;
  • vagrant ssh to access the VM via SSH;
  • vagrant halt to turn off the VM;

You can also access the VM via SSH by connecting to port 2222 of the host machine with your favorite SSH client, using the private key specified in the ssh_private_key variable of the Vagrantfile.

Shortcuts

All shortcuts except jcurl only work when executed within a Rails app directory.

rs rails s -b 0.0.0.0
rc rails console

br bin/rspec. Use within the Rails application folder to run RSpec with Spring.
brfd bin/rspec --format documentation

tdl tail -f development log
ttl tail -f test log
ctl clear test log
cdl clear development log

jcurl runs curl -s and pretty prints JSON output with the awesome_print gem. Takes a URL as an argument.

bi Run bundle install in multiple parallel threads (faster).

gpl git pull
ga git add
gc git commit. Takes a commit message as an argument.
gp git push. Takes a remote name and a branch name as optional arguments (e.g., origin master)
gs git status
gl git log

Contributing

Bug reports

Please use the issue tracker to report any bugs.

Developing

  1. Create an issue and describe your idea
  2. Fork it
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Commit your changes (git commit -m 'Add some feature')
  5. Publish the branch (git push origin my-new-feature)
  6. Create a Pull Request

License

Released under the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].