Ruby on Rails development on Mac vs Vagrant [closed] - ruby-on-rails

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm developing several apps using Ruby on Rails on Mac OS X Yosemite. My main deploying OS is Debian 8 x64.
I heard a lot about Vagrant. Should I use it? What advantages it gives me? Will it speed up my workflow or worse: slow it down?
Can I use it as a staging server for deploying?

Vagrant creates a virtual machine and pretty much it's only advantage is that you can create virtual machine image, witch will speed up development environment setup (which might be handy if you are planning to hire a lot of developers in closest future). It will also create a completely isolated environment, so you can be sure that other application won't affect the one you're working on.
There are still quite a lot of issues (at least there was the last time I tried it) with file synchronization between host and VM, making development with Vagrant extremely slow (had to wait 20 seconds per page). It is not an easy task to create a vagrant file which would work on all OS of the host. Also it will consume much more of your machine resources.
It can be however a very good match for staging server, as it allows quick destruction and recreation of your VM and provides good isolation, so you can test your deployment scripts without any risk.

My experience with Ruby on Rails is limited but I am developing using Django and I run all of my apps on Vagrant. I believe that the idea of using Vagrant is the same regardless of technology.
The main reason that I use it is the fact that you can set up Vagrant to copy your deployment environment. This means that you can be (almost 100%) sure that your production code is going to work when deployed (because you are coding and testing in the same environment).
Additional benefit is the fact that the more apps you have the harder it becomes to keep track of all of the packages and dependencies needed. With Vagrant you can set your environment to meet the exact criteria for every project.
Regarding weather it will slow or speed up your work. I think this depends a bit on your coding style but Vagrant shares the folders of your project so any changes made in your code will be reflected in Vagrant. You will just need to forward the port of your app and you will almost fail to notice that Vagrant is between you and your project. That is if everything is set up correctly.
Hope my answer helps a bit.

Related

Is it good idea to deliver desktop app with docker? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I am interested in some good way to deliver desktop app to users.
The app is a web app made with LAMP, but I need and users to run it on desktop.
I want to choose some good cross platform solution for this.
I already have a docker image for this app.
Is there a practice to use docker to deliver apps to users? Like installation package that installs docker (if not installed yet) and than run a docker image.
Is there any experience with this?
Docker is not a good match for this use case. My recommendation would be to choose a widely available scripting language like Python or JavaScript for the implementation and use an embedded database like SQLite for the persistence layer; then your end users only need to install the language interpreter (which they may already have) and your application and they can use the browser they already have for the front-end.
Docker presents a number of challenges here; if you browse around other docker questions you can see people hitting some of them very routinely:
On non-Linux, Docker running Linux applications requires a Linux VM, which turns "lightweight container system" into "full-blown resource-hogging virtual machine".
On non-Linux, the set of host filesystem paths are accessible is limited. Your application won't work if it's trying to access user data on a Windows F: drive, to pick one recent question.
If your application manages some amount of "user" data, managing filesystem permissions is tricky and different on every OS.
If your application tries to present a GUI, and you're trying to build "one portable image", then you're forced onto the Linux X11 platform; and that requires a matching X server on the host (an extra software install!), plus several extra finicky bind mounts, environment variables, and host settings.
If your application tries to present a GUI, it can't by default access the user's non-Docker desktop preferences, and so it's likely to look and behave differently from a native application.
Docker requires some amount of escalated privileges to run at all, and so if you have a security issue (especially in the machinery to launch the container which handles all of the above) it's much more likely to compromise the whole system.
None of this is insurmountable, but it's also hard to see any particular benefits for the effort and extra complexity required.

Docker: Development environments [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I am coding in a few different languages/technologies. Actually to be honest, I am only messing around, playing with golang, node.js, ruby on rails, etc.
But now I want to jump on the Docker bandwagon as well, but I am not sure what the benefits would be and if I should put in the effort.
What is the best practise in using Docker for development environments? Do I set up a separate container for each language or technology I dabble with? Or are containers overkill and I should just set up one VM (Linux VM on Windows host) where I do all the development?
How do you guys use Docker for development work?
You should definitely go ahead and do that as is the best approach to follow, even if you share volumes between containers, and avoid setting up different VMs if you have the necessary hardware-power in your workstation and do not need to distribute your environment on different workstations.
At my current company, I'm the guy responsible for setting up all the development environments among other things. We have a few monolithic applications but we're quickly decoupling multiple functionalities into separate micro-services.
How we're starting to manage that is, every micro-service code repository has everything self-contained, that being docker-compose files, with a makefile for the automation, tests, etc.
Developers just have to install docker-toolbox on their Mac OS X, clone the repo and type make. That will start the docker compose with all the links between the containers and all the necessary bits and pieces (DBs, Caches, Queues).
Direct link to the Makefile: https://github.com/marclop/prometheus-demo/blob/master/Makefile.
Also if you want to avoid setting up all the containers there's a few alternatives out there, for example Phusion's one: https://github.com/phusion/baseimage-docker.
I hope this answers your questions.
You shouldn't use Docker for your development environments, use regular vm's like VirtualBox for that if you want complete separation.
Docker is more suited for delivering finished code somewhere, e.g. to a staging environment.
And the reason is that Docker containers are not ideal for persisted state unless you mess around with sharing volumes.
The answer to this is inherently subjective and tied to how you like to do development. It will also be tied to how you want to deploy these in a testing scenario.
Jonas is correct, the primary purpose of Docker is to provide finished code to a staging/production environment HOWEVER I have used it for development and indeed it may be preferable depending on your situation.
To whit - lets say you have a single virtual server, and you want to minimize the amount of space you are using for your environment. The entire purpose of Docker is to store a single copy of the Linux kernel (and base software) and re-use them in each docker instance. You can also minimize the RAM and CPU usage used for running the base Linux "pieces" by running the Docker container on top of Linux.
Probably the most compelling reason (in your case) to use Docker would be to make finding the base setup you want easier. There are plenty of pre-made docker containers that you can use to build your test/dev environment and deploying your code after you are finished to a different machine is WAY easier using Docker than VMWare or Virtual Box (yes, you can create an OVF and that would work, but Docker is IMHO much easier).
I personally used Project Photon when I was playing around with this, which provided a very easy way to setup the base Docker setup in a VMWare environment.
https://blogs.vmware.com/cloudnative/introducing-photon/
The last time I used Docker was for an assignment in one of my classes where I was having to play around with MongoDB on a local instance. Setting up MongoDB would have been trivial on either (or both) Windows or Linux, but I felt the opportunity to learn Docker was too much to pass up. In the end, I feel much more comfortable now with Docker :)
There are ways of backing up Containers, which can (as Jonas pointed out) get kind of messy, but it isn't outside the realm of a reasonably technical individual.
Good Luck either way you go! Again, either way will obviously work - and I don't see anything inherently wrong with either approach.

What is the purpose of putting Wordpress in a Docker container [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I viewed some video tutorials about Docker container.
Yet it's purpose is still not clear to me.
Would it make sense to use Docker for relatively little Wordpress projects as a normal Webdesigner?
When does it make sense to use it in conjunction with Rails?
There's a number of reasons I can think of
As a demo
Lots of people are familiar with Wordpress so it works well as an example of using Docker. You create the MySQL container and then the Wordpress container, which links to MySQL, and then you've got a simple application built from two pieces.
As a packaging system
You can think of Docker as an alternative way to install software. Rather than getting the right versions of PHP and MySQL installed and configuring plugins, you can just fetch a Wordpress image that's configured correctly.
In the context of a Rails app, the first part of getting the app working is to fetch a bunch of dependencies. This leads to the possibility that your app worked in development but some server is inaccessible and your app can't be deployed. Or you depended on some system tool without thinking about it, and the tool is only on your dev machine. Packaging your app in Docker means that you either have the image on the server (so everything's installed and working) or you don't (and it's obvious why your app isn't running).
For isolation and security
You can run multiple Wordpress instances in separate containers just like many providers do with VMs.
If someone's Wordpress server gets broken into, you've still got Docker isolating them from the other Wordpress instances and the hosting server. You can assign resource limits on containers so that nobody can hog the CPU or memory.
It's also trivial to run multiple versions of Wordpress side by side, even if they have incompatible dependencies.
As a development environment
(This doesn't really apply to Wordpress, unless you're involved in Wordpress development.)
One of my favorite uses of Docker is to take our production images, run them locally (giving me a personal copy of our production system) and then run destructive tests against my environment. When the tests are done, I restart all the containers and I'm right back to my starting state. And I can hunt for regressions by standing up a second complete system using last week's images and comparing the two systems' responses to the same requests.
Docker is useful for creating simple, binary-like building blocks for deploying complex applications. Personally, I use it for simple ones as well, as it reduces the number of things that you have to worry about and increases the repeatability of deployment tasks, but there are plenty of other tools (VMs, Chef, etc) that will help with that too, so YMMV.

Suggestions for the best Rails collaborative development stack? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 5 years ago.
Improve this question
Looking for some suggestions from the community for development stacks for collaborative environments. Could you share what you have and what has worked for you or your team?
The following is probably too verbose for some and an expression of just some rambling thoughts I've had about my particular scenario as I'm working with a hatchling dev group. SO, if you read it 1UP for you, otherwise, please just feel free to just share your thoughts re: the first question and what's worked for your team.
I have a situation where myself and a couple other developers are working together and I'd like to set up the "best" dev environment possible for Ruby on Rails development. At the moment I use git and some of the usually accepted best practices for development, however the other guys are new and not terribly familiar with the shell, git, etc. They're more from a php and monolithic environment.
I do have a central linux server that has been used hitherto for LAMP based dev for them. I can retool it to anything I'd like it to be as I'm quite adept and experienced at Unix system and network admin.
Could someone please suggest what may work well in this scenario? Again, ultimately we need to do collaborative development that has the lowest learning curve. I'll be the only one deploying to Heroku until I feel comfortable with their experience.
I would like to put something together that can get us all up to speed quickly in a matter of a day vs a longer learning curve and then allow them to grow into the shell and so forth over the next couple weeks.
What I was thinking was more of a shared SMB (mixed Windows and Mac workstations) and SFTP unified projects folder that has either apache virtual hosts for each project or thin rack. I'd continue to use my methods, but this could provide the flexibility for them to grow into this and be able to restart httpd or thin as per need.
Am I on the proverbial right track or has someone seen a better alternative? A lot of things have crossed my mind such as Gitorious (since we'll have a lot of small projects needing to be tracked and an enormous GitHub account is not feasible), Heroku, OpenShift and a lot of other things, but I have enough uncertainty that I'd like to get some input from the community as to the right mix for great collaborative agile development.
I have an answer but I think you have conflicting requirements: i.e. lowest learning curve vs low/free cost.
You say that GitHub is not feasible but it does offer unparalleled features for novice users. They can see commits on a website instead of on the commandline, can even edit files right in the browser (since yesterday, uses Ace) and gain insight into the branching/merging process.
Another paid option is http://cloud9ide.com/ which is also web-based.
I use my own development server as well but only use it for experienced people who need no hand-holding. If I were to let everyone on there the amount of support would consume my entire day.
It is my opinion that doing Rails development people should adopt the best practices in the field. See it like this: at least you won't burden them with learning Subversion or --eek-- CVS. Just seeing the commits on GitHub and having a discussion right after puzzling pieces of code is worth the money.

Setting up a Ruby development environment [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I am currently trying to set up a development environment for learning Ruby. The environment will primarily be for getting to grips with the language, but I will most probably move on to development with Rails after long. With web development a target, I would like to hear about preferred web servers and databases.
I plan on setting up the environment on a virtual machine, so I'm not worried about trashing the thing. Therefore, I am open to using a Linux distribution, OSX or Windows as the operating system.
I'm moving from C#, so I'd like to be forced into the Ruby way of thinking to a certain extent. Obviously, that's easier said than done.
What OS do most Ruby developers use?
What is the easiest IDE to get to
grips with coming from a background
of using Visual Studio?
Which
database is used most within the Ruby
community?
Which database is most
likely to be supported by most web
hosts?
Which web server is the
easiest to configure? To get up and
running in the shortest amount of
time.
Hopefully I have provided all the information needed and hopefully this will aid others in setting up their own environments.
Thanks
Edit:
Thanks guys. Some really good
suggestions so far, all of which I'll
take on board. I'm currently wading
through the copious articles surrounding
initial RoR setup on Linux, as I like to
understand how things work and are
tied together. Also, because it's all
free...
I'm currently putting together a
virtual machine (so I can break stuff)
using:
Ubuntu
SQLite
No webserver, I plan on using whatever development server comes with Rails out of the box, initially
Redcar Editor
Edit 2
I have setup a couple of environments
now.
I have the ubuntu setup running in a
Virtual Machine on Windows and decided
to try decking my Mac out for ruby
development too.
Overall, I'd have to say setup for the
mac was a lot less painful than the
linux setup. On the mac I'm running
with:
SQLite that comes with OSX out of the box(!)
TextMate (trial version, but loving it)
Mongrel web server
I've progressed from learning the ways
of Ruby to writing some simple
websites with Rails and am finding
development with Rails really simple
to use. I have also set up a GIT
repository on my working directory and
am currently trying out Heroku.
Thanks for the help, everyone.
If anyone would like any more information about setting up on either environment, I'd be happy to provide more detail.
What OS do most Ruby developers use?
Mac OS for most, but any Linux distro will do (Ubuntu/Fedora etc).
What is the easiest IDE to get to grips with coming from a background of using Visual Studio?
Textmate is quite popular if you're on Mac. Netbeans and Aptana are there if you need something similar to enterprise world. Emacs/Vim is ok too.
Which database is used most within the Ruby community?
So far most Ruby / RoR guys I know use open source databases. sqlite for local development while Mysql or Postgresql for production. My advice, sqlite is easy to learn, while give a try with Mysql or Postgresql, you might not know when your clients going to ask you to develop on them. Mysql is very popular. Postgresql I think has lot more features (personal preference).
Which database is most likely to be supported by most web hosts?
Mysql is most supported by shared hosting hence the M in LAMP (Linux/Apache/Mysql/Php). But Postgresql is getting more support too. Some hosting companies even support both but Rails developers usually prefer to use VPS (slicehost.com/linode.com) and manage all these themselves. Checkout heroku.com too for deploying your Rails app without needing much knowledge in sys admin stuffs.
Which web server is the easiest to configure? To get up and running in the shortest amount of time.
Developing with Rails you'll get webrick as a development server where you can test ur app locally. But for production I prefer modrails.com where you can choose between apache/nginx. I prefer to use apache since that is what I'm used to.
You'll want to look at RVM from the start, this takes away a lot of the pain of managing Ruby versions and gems.
Judging from the laptops I saw at Railsconf last June, Rails developers are about 90% OSX, 9.9% Linux, and there's like 1 or 2 guys on Windows.
Personally I use Textmate when I'm at home on OSX and gedit and redcar when I'm at work on Ubuntu Linux. I use sqlite for development mainly with mysql in production, but mongodb seems to be the new hotness, but I haven't done much more than some sample apps with it so I can learn it.
Virtual hosting providers will probably give you a choice of whatever database you want. Heroku is awesome and is used for deploying Rails applications via git, and uses postgres but has plugins to use mongodb if you want to go that way.
For what the community at large is doing, check out Thoughbot's survey results at: http://robots.thoughtbot.com/post/308239139/2009-ruby-survey-results
You might have a look at the Bitnami installer, which claims to create a full Ruby/Rails stack. There's also a VM version, so in theory you could just grab their VM and start coding your app. (YMMV -- personally I haven't tried it).
OS
Most ruby developers seem to gravitate towards Macs for some reason, with a few linux and some windows devs. That said, I use windows for all my ruby work and haven't really run into any huge roadblocks. Your safest option will probably be a Mac, if you want to be on the same side as most of the community.
IDE
You don't really need a full-blown IDE for ruby, as you would for something like C#. Most mac users seem to use textmate. I personally use redcar. It's not fully completed yet, but it can be used on Windows, Linux or Mac, and I've yet to run into a feature I need that isn't provided. It is written in ruby, can be extended through plugins, and supports textmate themes and snippets. To supplement redcar, I've actually written a shell in ruby for my own use. It's still in alpha stage, but I've got features like grep and ls working, and capabilities for working with and manipulating files. You can extend it with ruby, and actually use any ruby command inside the shell. It's hosted here, and is currently for use on windows. After I get some more features in, I might start looking at Mac or Linux ports.
Database
Open source options like sqlite and mysql are used widely. I don't have enough experience on them to really comment on the differences. For what it's worth, Heroku (which is great for hosting) uses Postgresql.
Server
You should use a lightweight server like Thin for development, to test your app. For production, have a look at modrails.com (as a few other answers have suggested).
Good luck with whatever you choose.
OS
80-20 Mac-Linux. I've seen one Windows ruby dev so far. If you use and debian (ubuntu is a debian), take a look at rvm, because debian cripples rubygems.
IDE
You can code ruby without an IDE, grab an editor of your choice. We've got emacs, vim, textmate, gedit here. If you really want an IDE, get rubymine.
Depends on how good your shell-fu is ;-)
DB
sqlite >:)
Server
For development, rails server should do. For production, my recommendation is unicorn, paired with nginx.
Further stuff:
http://github.com/edgecase/ruby_koans
And go for rails 3 beta.
Tutorials
ruby-lang.org/en/documentation/quickstart
Ruby community
ruby-lang.org/en/community/
I think Linux(Fedora) would be best for you
For data base mysql is very popular
most prefered web server
http://www.modrails.com/
http://github.com/fauna/mongrel
Ruby mine is good IDE
http://www.jetbrains.com/ruby/

Resources