lcreid / rails-5-jade Goto Github PK
View Code? Open in Web Editor NEWRails 5 with Jekyll and Node on Ubuntu 18.04
License: MIT License
Rails 5 with Jekyll and Node on Ubuntu 18.04
License: MIT License
Could do this with a provisioner that always runs.
If we're going to use Webkit for a JavaScript driver, we also need to do this:
sudo apt-get install libqtwebkit-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x
sudo apt-get install xvfb
The last line installs a thing that starts a hidden X11 server, needed by webkit. There is a headless gem that helps use this X11 server, but I haven't figured it out yet.
When running more than one box, it's hard to tell which box is which. It would be wonderful if the host name of the box could set itself to something interesting, like perhaps the directory name on the host where the box resides.
You can't run two of these boxes at the same time on the same host, because they won't remap the ports.
The clock on the rails5 box drifts from real time. Perhaps this is because I haven't set up NTP for it.
I wonder if this is what causes the problem that we've observed that long-running boxes lose the ability to automatically identify when files have changed?
We have a variety of environments to support:
One of the challenges with other providers is that the Ubuntu preseed.cfg
script we use for Vagrant sets up the default user to be vagrant
, which while not unusable, might seem a bit strange in other environments (AWS or other cloud images, or other local virtualization solutions). We also install some things that we don't really need to, because they have to be set up in the script for the production environments.
Another part of this is the organization and naming of the project/repository.
In some cases we need a Bash script that we run on an existing image. In other cases we want to build an image with Packer and run the same scripts and others on that image.
Typically, to start a new project we want to do:
rails new --database=postgresql --skip-coffee .
This creates a config/database.yml
that doesn't match the docs. It would be nice to harmonize the docs and the build so that building a new project was easier.
When we upgrade a box, we lose all the Postgres data files. For a development box, that's not a big problem, but it would be nicer if the Postgres data files were in /vagrant
somewhere, like /vagrant/db
.
When upgrading versions of the box, you lose a bunch of the installed gems, and often they need to be updated anyway, for example, when the new box brings a new version of Rails.
Many of the thoughts in the second comment on Issue #5 apply here.
The model database is in FULL recovery mode, which means all databases created are also in FULL recovery mode. This means the database log files grow forever, and eventually the Vagrant box runs out of space.
In the initial build, we need to do something like:
ALTER DATABASE model SET RECOVERY SIMPLE;
go
The following answer says what to do when your log is big: https://stackoverflow.com/a/18292136/3109926
In the case of Bundler, leaving the gem version too flexible has caused quite a bit of grief lately, due to changes in the binstubs generated by Bundler. Since the binstubs are generated on the development box, care must be taken to ensure that Bundler is the same version on the development box as on the production box (or UAT or any other environment).
This may well apply to some of the other gems as well.
Add:
pry-rails
yard
jekyll serve --incremental --host 0.0.0.0
doesn't see the file changes made on the host, so it's useless.
Need to install UTF-8 locales in the base box so that Postgres uses the right character set for Rails.
As of Ubuntu 20.04, Multipass is standard. It's also supported on Mac and Windows. It looks like a lot smoother way to manage multiple local dev instances.
Big question: If we're going to move away from the Vagrant platform, is Multipass the right way to do it? What about Docker? (I don't like what I'm hearing about Docker, but Mulitpass is new so it's likely to have its haters in a few years, too.)
Make the terminal window a non-default colour so it's easier to see which window you're in. This benefits Ubuntu users mostly, because I assume the Mac will look different anyway.
I'm unable to connect to MS SQL Server on the new box (mid-August, 2019). It appears that MS SQL Server is broken with the current openssl version. See: https://stackoverflow.com/questions/57265913/error-tcp-provider-error-code-0x2746-during-the-sql-setup-in-linux-through-te
Change to build to install a working version. Need to remove the versioning in the future.
I was getting a message when trying to run test cases to look at this page: https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers. If this becomes a common issue, I should just fix the base box.
Need a box for Rails 5.1. It sounds like there are sufficient changes with 5.1 that I should create a new base box on Atlas.
Testing with headless Chrome is broken, until you do sudo apt update && sudo apt upgrade
. The boxes should be upgraded to a newer version of Chrome.
Increasing the RAM on the machine to 1 GB made tests run more reliably on one project. If this shows up for other people, make the base box have 1 GB RAM.
You have to comment out one line and put another near the end of config/environments/development.rb
for each Rails project you do in the Vagrant machine:
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.file_watcher = ActiveSupport::FileUpdateChecker
I don't get the port forwarding in the base box. Steps to reproduce:
vagrant init jadesystems/rails5
vagrant up
Observe that no port forwarding was set up.
Hi,
The host is win7 with the latest virtualbox and vagrant (also tested on win10). Simply running the commands:
vagrant init jadesystems/rails-jade-18-04-pg
vagrant up
results in:
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
File provisioner:
* File source must be specified.
* File upload source file C:/Users/<USER NAME HERE>/.gem/credentials must exist
Can't figure out why but the older box works as expected (rails-5-2).
Thanks!
For people who are deploying to shared servers, they still need to version their Ruby. So this box should come with rbenv
and the latest Ruby, but allow users to install previous Rubies.
This brings up a few questions:
rbenv
probably does thatbundle exec
in front of everything?We're going with rbenv
rather than rvm
because rbenv
is less intrusive, and Bundler provides what rvm
provides that rbenv
doesn't.
To adjust the NTP server on a server running timedatectl
, edit /etc/systemd/timesyncd.conf
.
Hi,
First of all I don't know if this is a bug or not. Until now I've been using this command in rails development.rb environment config so the box detects changes on my files:
config.reload_classes_only_on_change = false
But now, with Rails 5.2 and Active Storage that command makes the server a lot slower, and the images takes from 10 to 40sec to load.
Is it a bug? There is another way to make the vagrant/rails detect changes on my files without making me reload the server every time I change something?
Hope you can help me!
Best regards
v0.2.0 is 1.5 GB. Supposedly if you zero all the free space after you install and then clean up, you can get better compression of the box. It's not clear to me whether Packer does this for you.
Investigate, and implement myself if it isn't done.
The upgrade or (more likely) dist-upgrade at the end of the build gives these messages:
virtualbox-iso: Unpacking linux-headers-4.4.0-77 (4.4.0-77.98) ...
virtualbox-iso: E: Sub-process /usr/bin/dpkg exited unexpectedly
virtualbox-iso: E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.
virtualbox-iso: Successfully installed i18n-0.8.1
Then any attempt to install software fails, and you have to do:
sudo dpkg --configure -a
sudo apt-get install -f
When attempting to use Webpacker (typically with Rails 6), if the Virtualbox host is Windows, Webpacker (actually Webpack) will fail with: EPROTO: protocol error, symlink...
. This happens for all new projects created by Rails 6, and probably happens for other projects that use Webpacker.
Daily builds are out, so I could start working on the Ubuntu 20.04 version of this build.
User reported "Error: SSL certificate problem: unable to get local issuer certificate" when bringing up a box. http://stackoverflow.com/questions/32937994/vagrant-up-not-working-on-windows describes one possible cause and a couple of fixes.
There are a number of reports of this symptom on the Internet. It seems like people's certificate authorities/chains/whatever change often enough that people run into grief with the fact that vagrant downloads stuff over HTTPS.
Hi,
I'm getting a problem with a new project that I created using your box. I follow your instructions but when I start my rails server and I go to my browser at: localhost:3000
there is no "Welcome Aboard" page. It seems that the Puma won't start, I think.
I'll tell you what I did step by step and I hope you can help me:
Vagrant.configure("2") do |config|
config.vm.box = "jadesystems/rails-5-2"
config.vm.box_check_update = true
config.vm.provider "virtualbox" do |v|
v.linked_clone= true
v.cpus= "1"
v.memory = "2048"
end
end
vagrant up
vagrant ssh
cd /vagrant
rails new . --database=postgresql --skip-coffee
vagrant@rails-5-2:/vagrant$ rails server
=> Booting Puma
=> Rails 5.2.3 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.1 (ruby 2.5.1-p57), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
It seems everything ok but when I go to my browser and I put localhost:3000
it tells me that this site can't be reached.
I tried also to start the server like you have, but it gives me an error:
vagrant@rails-5-2:/vagrant$ rails server --bind 0.0.0.0
Traceback (most recent call last):
28: from bin/rails:3:in `<main>'
27: from bin/rails:3:in `load'
26: from /vagrant/bin/spring:15:in `<top (required)>'
25: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:70:in `require'
24: from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:70:in `require'
23: from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
22: from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
21: from /var/lib/gems/2.5.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
20: from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
19: from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
18: from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
17: from /var/lib/gems/2.5.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
16: from /vagrant/bin/rails:9:in `<top (required)>'
15: from /var/lib/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
14: from /var/lib/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
13: from /var/lib/gems/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
12: from /var/lib/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
11: from /var/lib/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
10: from /var/lib/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
9: from /var/lib/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
8: from /var/lib/gems/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
7: from /var/lib/gems/2.5.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>'
6: from /var/lib/gems/2.5.0/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
5: from /var/lib/gems/2.5.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
4: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
3: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
2: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:20:in `run'
1: from /var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:34:in `rescue in run'
/var/lib/gems/2.5.0/gems/thor-0.20.3/lib/thor/base.rb:506:in `handle_argument_error': ERROR: "rails server" was called with arguments ["0.0.0.0"] (Thor::Invoc
ationError)
Usage: "rails server [puma, thin etc] [options]"
I hope you can help me. Thank you in advance.
Redis only needs to start before the Rails app starts, and only if the particular Rails app needs Redis. It might reduce the load on the server a bit if we only start Redis when needed.
sudo apt-get install sendmail
in base box.
Chandler requires your GitHub credentials in ~/.netrc
. One thing might be to provision the box's ~
with .netrc
that contains /^machine +api\.github\.com/,//+2
from the host. Another possibility: figure out how to capture the credentials the first time, and store them in ~/.netrc
.
It would be nice to have a VMware and Qemu/KVM builder at least.
Some of the challenges:
The version of nodejs
from the Ubuntu distro is too old for Webpacker at this point. Try installing Nodejs 10.x from a PPA.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.