How to publish code to local phusion passenger install from development folder? - ruby-on-rails

On my local dev machine I am coding on (ubuntu), I am using the built in rails server (webrick):
rails s
I want to sometimes test things out on a local copy of phusion passenger that I am going to install.
How can I automate pushing the files to my phusion passenger server?
Would a simple script that copies the contents of the folder suffice?
Is it easier to setup capistrano?

Copying the folder would suffice (assuming all of your environment details are the same).
Personally I would just clone my git repository (not sure if you are using source control) into the appropriate folder.

Related

docker, vagrant sandboxes in php development

I have a missunderstanding and i want to find the best approach of a development sandbox environment for a PHP project.
I have a github repo that will host the code , .php, .js (will using webpack with babel), .scss files and different machines for development (windows, mac, ubuntu) .
I want to be able to pull the code from git hub , run a command (like vagrant up) and start a VM / container / sandbox with apache2 , php, nodejs that will run to parse .scss files and .js files into one and then be able to start the server on every platform without having to run gulp locally on developers PC, and then have the XAMPP installed with the correct path for apache2 http folder.
What would be the best approach ? To use vagrant VM with a file config on the repo or docker containers ?
I just want to simplify the development experience and to have this automated tools that start a server, compile sass and babel js.
Thank you
While I am a big Docker fan, it isn't always the right tool for the job. Docker has principals like immutability and single-service-per-container that probably won't work well for what you're looking to do without a learning curve.
There is a great open-source Vagrant tool called PuPHPet that make configuring a development environment straightforward.
https://puphpet.com/
From the PuPHPet web site you can configure an image with Apache2, PHP, and NodeJS via their wizard and it will generate a Vagrant file that you to run locally on your workstation. This way you can have all the software you need, without having to deal with installing/maintaining it yourself. It also supports installing databases, queues, and mail applications, should you need them.
For your scenario, I would clone the code from Github onto your workstation (not the VM) and mount it using Synced Folders against Vagrant, but still directly accessible by your IDE.

Setup Redmine & plugins on local machine then deploy to Linux server, possible?

I am new to Ruby on Rails. My questions is:
Is it possible to setup Redmine and install the plugins on my local machine (macOS Sierra), test the Redmine application on localhost, once everything has been done successfully, then only deploy it on a Linux server?
If it is possible, which part of the code should I modify in order to deploy it on Linux server successfully? (Both of my local machine and Linux server are running MySQL database)
Yes it is possible and you don't need to change any part of the Redmine code to do so. Deployment of Rails apps is often done with a tool called Capistrano (http://capistranorb.com/), which executes through ssh on your server, checks out the code and does any additional installation steps necessary. This approach requires you to have your app (Redmine and plugins in your case) in a git repository (or subversion etc). In the simplest case, fork redmine on github and add any plugins as git submodules.
As you're unfamiliar with the platform I'd suggest to start with a simple rails app that you create locally. once you have worked out deployment of that to a remote server, tackle Redmine.
Sounds like a lot of upfront effort but it's worth it since it enables you to work on your local machine, make changes and then deploy the changed code with a single command.
If the Redmine installation on your local host has the same installation path as on the production server, then you can just copy the installation files to the production server. You will also have to copy the database to the production server.
If the installation path is different on your local host and production server, then you will have to install the Redmine and plugin on your production server

Which folder should i put into filezilla for ROR?

I have the following directory structure:
Which files must I drag into remote site of Filezilla for this ROR project?
When deploying a ROR project you should must use a VPN server. Have you used git for your project? Try to deploy in heroku first. To test your site and have a good practice when deploying rails.
https://devcenter.heroku.com/articles/getting-started-with-rails4
The answer to the question would be: everything
But most likely, copying everything is not gonna make it run, here is why: Rails applications live in separate processes that have to be specifically maintained. On your dev machine, you do this with bundle exec rails server. This is a key difference to how the apache php module works for php apps: There the php interpreter is embedded within the apache process and therefore shares its life cycle automatically.
If you have control over the server you are deploying to, I recommend to start with the Phusion passenger apache module. It takes care of starting your rails processes as needed. In case you are using ubuntu 14:04, I can't recommend to just apt-get install libapche2-mod-passenger because I had many problems with it.
If the server is maintained by somebody else, I'd ask this someone for a solution.
I hope this helps.

Can Rails be deployed locally? without using git

I have made an app with the use of Git and Heroku.
I'm curious if i can deploy Ruby on Rails locally without using Git.
If you aren't going to deploy to Heroku, you don't technically need Git at all. Just delete the .git folder. Given that Git is a great tool however, doing this is a bad idea.
You can deploy a Rails app locally, and the typical way to do this is with Apache and Passenger ( I'm assuming you are using a flavor of linux, OSX may have a host running already ).
It has been a while since I had done this, but this page seems to have the right idea:
https://nathanhoad.net/how-to-ruby-on-rails-ubuntu-apache-with-passenger
Rails s or rails server (in terminal) and you have localhost:3000. This is your local rails program and is incredibly convienent for development. Of course you need to be in the directory of your program to deploy it on localhost

How does Passenger, Capistrano & SVN work together

I'm planning to create a website on dreamhost using Ruby on Rails.
While reading through the wiki on dreamhost, I realized that I have to transfer my local files to the server using svn & capistrano. And Passenger is used by dreamhost to deploy my application.
Can anyone explain the workflow invovled in this?
More details:
As per the details on the dreamhost wiki page on svn, I created a subdomain for the svn repository at http://svn.mywebsite.com/project . I can commit my local changes to this location. But I'm not sure how the files at this directory are moved over to the main website .. i.e. http://www.mywebsite.com Is it done by Capistrano or Passenger?
Passenger is the module loaded by Apache to run and display your Rack based applications which include Rails. Capistrano is used to remotely run commands to checkout and deploy your application from svn. SVN is obviously used to store and version your application. The workflow is as follows:
Write code
Check-in to svn
Deploy with Capistrano
Capistrano checks code out of svn
into a folder which Passenger is
configured to watch.
Passenger notices the changes and
reloads your application.
Capistrano is the tool that does the deployment. It can checkout the files from svn either directly to where the deployment happens (if it has ssh access) or locally and then use ftp/sftp/scp to copy to the deployment area. Passenger is the Apache module that let Apache understand how to serve up your application once it's deployed.

Resources