rails/rails-dev-box hiện có 2.0k sao trên GitHub, viết chủ yếu bằng Shell. A virtual machine for Ruby on Rails core development
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
A Virtual Machine for Ruby on Rails Core Development
Introduction
Please note this VM is not designed for Rails application development, only Rails core development.
This project automates the setup of a development environment for working on Ruby on Rails itself. Use this virtual machine to work on a pull request with everything ready to hack and run the test suites.
Requirements
VirtualBox
Vagrant 2
Install the vagrant-vbguest plugin: vagrant plugin install vagrant-vbguest.
How To Build The Virtual Machine
Building the virtual machine is this easy:
host $ git clone https://github.com/rails/rails-dev-box.git
host $ cd rails-dev-box
host $ vagrant up
That's it.
After the installation has finished, you can access the virtual machine with
Port 3000 in the host computer is forwarded to port 3000 in the virtual machine. Thus, applications running in the virtual machine can be accessed via localhost:3000 in the host computer. Be sure the web server is bound to the IP 0.0.0.0, instead of 127.0.0.1, so it can access all interfaces:
bin/rails server -b 0.0.0.0
RAM and CPUs
By default, the VM launches with 2 GB of RAM and 2 CPUs.
These can be overridden by setting the environment variables RAILS_DEV_BOX_RAM and RAILS_DEV_BOX_CPUS, respectively. Settings on VM creation don't matter, the environment variables are checked each time the VM boots.
RAILS_DEV_BOX_RAM has to be expressed in megabytes, so configure 4096 if you want the VM to have 4 GB of RAM.
What's In The Box
Development tools
Git
Ruby 4.x (installed via mise)
Bundler
SQLite3, MySQL, and Postgres
Databases and users needed to run the Active Record test suite
System dependencies for nokogiri, sqlite3, mysql2, and pg
Memcached
Redis
RabbitMQ
An ExecJS runtime
Recommended Workflow
The recommended workflow is
edit in the host computer and
test within the virtual machine.
Just clone your Rails fork into the rails-dev-box directory on the host computer:
Vagrant mounts that directory as /vagrant within the virtual machine:
vagrant@rails-dev-box:~$ ls /vagrant
bootstrap.sh MIT-LICENSE rails README.md Vagrantfile
Install gem dependencies in there:
vagrant@rails-dev-box:~$ cd /vagrant/rails
vagrant@rails-dev-box:/vagrant/rails$ bundle
Some Rails components (e.g. Action Cable) include JavaScript packages. Install their dependencies before running tests:
vagrant@rails-dev-box:/vagrant/rails$ cd actioncable && yarn install
We are ready to go to edit in the host, and test in the virtual machine.
Please have a look at the Contributing to Ruby on Rails guide for tips on how to run test suites, how to generate an application that uses your local checkout of Rails, etc.
This workflow is convenient because in the host computer you normally have your editor of choice fine-tuned, Git configured, and SSH keys in place.
Virtual Machine Management
When done just log out with ^D and suspend the virtual machine
host $ vagrant suspend
then, resume to hack again
host $ vagrant resume
Run
host $ vagrant halt
to shutdown the virtual machine, and
host $ vagrant up
to boot it again.
You can find out the state of a virtual machine anytime by invoking
host $ vagrant status
Finally, to completely wipe the virtual machine from the disk destroying all its contents:
host $ vagrant destroy # DANGER: all is gone
Please check the Vagrant documentation for more information on Vagrant.
Faster Rails test suites
The default mechanism for sharing folders is convenient and works out the box in
all Vagrant versions, but there are a couple of alternatives that are more
performant.
rsync
Vagrant 1.5 implements a sharing mechanism based on rsync
that dramatically improves read/write because files are actually stored in the
guest. Just throw
for automatic syncs. See the post linked above for details.
NFS
If you're using Mac OS X or Linux you can increase the speed of Rails test suites with Vagrant's NFS synced folders.
With an NFS server installed (already installed on Mac OS X), add the following to the Vagrantfile:
config.vm.synced_folder '.', '/vagrant', type: 'nfs'
config.vm.network 'private_network', ip: '192.168.50.4' # ensure this is available
Then
host $ vagrant up
Please check the Vagrant documentation on NFS synced folders for more information.
Troubleshooting
On vagrant up, it's possible to get this error message:
The box 'ubuntu/yakkety64' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
vagrant login. Also, please double-check the name. The expanded
URL and error message are shown below:
URL: ["https://atlas.hashicorp.com/ubuntu/yakkety64"]
Error:
And a known work-around (https://github.com/Varying-Vagrant-Vagrants/VVV/issues/354) can be:
sudo rm /opt/vagrant/embedded/bin/curl
License
Released under the MIT License, Copyright (c) 2012–ω Xavier Noria.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/rails/rails-dev-box là nguồn chính thức.
rails/rails-dev-box có bao nhiêu sao?
rails/rails-dev-box có 2.0k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/rails/rails-dev-box. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
rails/rails-dev-box có tag gì không?
Bản đồng bộ chưa ghi nhận topic GitHub nào cho rails/rails-dev-box. GitHub topics hiển thị ở thanh bên phải trang repo — đó là nơi đáng kiểm tra nhất.
rails/rails-dev-box còn đang phát triển không?
Commit gần nhất trên rails/rails-dev-box là 5 tháng trước (theo timestamp GitHub). Repo có 566 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
rails/rails-dev-box viết bằng ngôn ngữ gì?
rails/rails-dev-box chủ yếu viết bằng Shell. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
rails-dev-box có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về rails-dev-box.