Rails 4.2.0 + passenger + apache + Custom Engines - how to reload properly? - ruby

I'm deploying rails 4.2.0 app with passenger5 and apache2 on Ubuntu12.04 server.
When I pull the new version of the app from github I need to reload the app for changes to come into effect.
My custom Engines are 'required' in the Gemfile as proposed in the Rails Guide
gem 'CustomeEngine', path: "lib/engines/CustomeEngine"
Based on passenger Documentation we can reload the web server by creating this file:
touch ${MYAPP}/tmp/restart.txt
When I make changes in CustomeEngine's code Rails seems not to reload the CustomeEngine with the restart.txt methode.
Please help me understand how to reload rails properly.
Best answer for me would be how do I do this in 'one line' of bash. Pull changes from github and reload the App which is running inside of a passenger process.
Thank you in advance!

Related

How to disabled Phusion Passenger for hosting on Plesk? When I refresh web app in VueJS I always have error

My server has Plesk and I have mydomain.com with frontend in Vue and backend in api.mydomain.com with laravel. Before, when I went to mydomain.com/clients and tried to refresh the page, I got an error with Phusion Passenger. I have disabled Phusion Passenger on this domain but I don't remember how I did it.
Now, I have the same problem with the same front and back system. The only difference is that both domains are subdomains, that is, I have front.domain.es and api.domain.es.
If I refresh front.domain.com it works perfectly. If I navigate from the system menu it works fine. But, if I am in front.domain.com/clients for example and I try to refresh page, I get Pushion Passenger error.
Important comment that the system work perfectly, just when you try to refresh the page has this error. On the first example that I comment, now works perfecty without Passenger, I can refresh without problem, but I don't remember how I did it.
I want to disable Phusion Passenger for this hosting on plesk or domain or whatever, I hope you can help me!
Thank you very much!!
Log File:
[ E 2023-02-02 08:44:42.0486 476333/Tf age/Cor/App/Implementation.cpp:221 ]: Could not spawn process for application /var/www/vhosts/domain.com/front.domain.com: The application process exited prematurely.
Error ID: dbcc318c
Error details saved to: /tmp/passenger-error-BX09me.html
Go in Tools&Settings >> PHP Setting
In top of the page you should find this " Select the PHP handlers you want to make available. You can install additional handlers using the Plesk Installer. "
Follow the link and will take you to Plesk Installer, there you can enable/disable modules including fusion

Cant run some shopify commands due to an error about ruby version incompatibility

I am new to shopify CLI and trying to run shopify theme pull or shopify theme serve but cannot due to an error I keep on running into
PS C:\Users\Russell\shopify\shopifyApp\starter> shopify theme serve
Your environment Ruby version, 3.1.1, is outside of the range supported by the CLI, 2.6.6..<3.1.0, and might cause incompatibility issues.
X An unexpected error occured.
To submit an issue include the stack trace.
To print the stack trace, add the environment variable SHOPIFY_CLI_STACKTRACE=1.
ive tried to downgrage ruby to 3.1.1 using gem update --system 3.1.1 but get this in my cmd
C:\Users\Russell>gem update --system 3.1.1
ERROR: rubygems 3.1.1 is not supported on 3.1.1. The oldest version supported by this ruby is 3.3.3
im using windows 10 and ruby 3.3.3
Well I managed to get a solution and what I did was :
This happens because when you create a Development store, it won't properly link your Shopify Partners account to the new created store.
A partial solution was mentioned here #1309 (comment)
This is what I do to solve the problem on my side:
1.- Logout from the Development store admin dashboard
2.- Login again by visiting the direct URL. Example: https://[store-name].myshopify.com/admin
Here use your Shopify Partners account (the one that you used to create the development store). Don't worry if you see an error message or if you have to login again. Ideally you should see the admin dashboard again.
4.- Login to your Shopify account (not Partners). Go to: https://shopify.com/login
At this point you should see the new Development store listed. This means it is now linked to your account.
Go back to the CLI and try again. You may have to do shopify whoami and/or shopify logout shopify login
github solution to the problem

Rails 4 - ActiveAdmin - Redactor - Heroku -- has no method 'redactor' console error

I've been trying to tackle this all morning. Locally, this setup works just fine. I am not using the redactor-rails gem because this is a rails 4 app and it doesn't support it. I have moved the redactor.css and redactor.js calls from the active_admin initializer file to be required in my actice_admin.js.coffee and active_admin.css files because on Heroku, it could not find the path. Now, when firing up the page that should be displaying redactor, I get has no method 'redactor' in the console.
I'm at a loss. I've read up on precompiling assets and the how the pipeline works, but it doesn't seem like I'm doing anything out of the ordinary here.
So how can I deploy to Heroku without this error?
Ok, so I seemed to have disregarded an important task. After thinking about precompilation a bit more I remembered I had been told to run
RAILS_ENV=production bundle exec rake assets:precompile
before. After running that again, it precompiled the active_admin.css and active_admin.js.coffee files which had the new require's in it. Viola!
Hope this helps someone else in the future.

How to make Sinatra sessions persist across POSTs in tests?

In the following code from Learn Ruby the Hard Way : https://gist.github.com/1696733 the session seems to disappear after going through the 'post' in tests (run ruby test_gothonweb.rb to see what I mean). If I actually visit the site with my browser everything works correctly, but I would like to be able to test the site without visiting every page. What are the possible reasons for the sessions disappearing in tests?
There are a few questions coming close to this problem, but most of them are solved by not using shotgun. I am not using shotgun. I am just using regular ruby.
Versions:
ruby: 1.9.2
sinatra : 1.3.2
rack: 1.4.0 1.4.1
rack-test: 0.6.1
EDIT
I am also disabling the sessions while testing as per http://benprew.posterous.com/testing-sessions-with-sinatra - the first test using sessions with GET does work in that case (but not the POST one).
There is a known issue with rack 1.4.0. Update the gem to 1.4.1

twitter gem not working in heroku?

I'm working on a ruby app that updates a twitter account using 'twitter' gem. It's working fine locally (as usual :) ). But when I deploy it on heroku it seems the gem is not properly installed or something lile that as I got the following error:
NameError: uninitialized constant Twitter::OAuth
My code is very simple:
oauth = Twitter::OAuth.new(consumer_token, consumer_secret)
oauth.authorize_from_access(access_token, access_secret)
client = Twitter::Base.new(oauth)
client.update("Updating my status from twitter gem. GREAT!")
Is there a problem with this particular gem ?
Thanks a lot for your help.
Luc
Have you created a .gems file and put twitter in it?
Depending on which heroku 'stack' you are on, you may need to do that instead of a bundler Gemfile. You can change your stack for one that uses bundler by doing this:
heroku stack:migrate bamboo-ree-1.8.7
Which makes bundler available (I think).
That is a common message that usually implies that you have a discrepancy between your local gems and the gems in heroku. If you are not using Bundler yet, you should. You will end un writing a very simple Gemfile that will tell Heroku (or any other entity using your code) which gems and versions you require.
http://gembundler.com/
I would suggest that you should use the heroku addon called 'apigee', ut makes twitter on heroku simple:
http://addons.heroku.com/apigee
I just got a sinatra app talking to Twitter through Heroku/Apigee, my rate limit went from 300 calls per hour to 20,000 calls per hour. Here's a step by step on what to do:
http://geeks.aretotally.in/mind/2011/1/8/increasing-api-limits-on-a-sinatra-twitter-app-with-twitter_.html
I am really a Java developer just playing around with Sinatra but let me know if I can help in anything.
Felipe

Resources