I don't know if the correct title for this is hot deploy.
I am modifying controllers and views and I have to restart the server to view those changes.
Why? I think that it didn't worked like this.
I am using webrick server. Environment is development.
I am using Rails 3.1
Go to your config/environments/development.rb and make sure you have:
Railsapp::Application.configure do
config.cache_classes = false
# ...
end
In mine, it comes with this explanatory comment:
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
Related
This is surely a gap in my understanding so I am hoping someone could help clarify.
Over here in the phoenix docs, it says:
# If you are doing OTP releases, you need to instruct Phoenix
# to start the server for all endpoints:
#
config :phoenix, :serve_endpoints, true
I am not quite sure, what effect this has on a simple app, but actually not setting this also seems to work. In fact, enabling this is causing the below error:
"phoenix cookie store expects conn.secret_key_base to be set"
What is this setting for and why is it needed? If it is not enabled, everything seems to work ok.
Phoenix docs are outdated.
As I can see you'v forgot your prod.secret.exs while compiling.
In case you are building that for test purpose and it's not recommended to be in production but could be set like that:
# Configures the endpoint
config :hello_phoenix, HelloPhoenix.Endpoint,
secret_key_base: "SECRET_KEY"
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!
I am trying to get codesleeve asset-pipeline to work on my site. After wasting a full day, I finally got it working yesterday on my local development server. I have now uploaded the project to see if everything works on the live server. Guess what- it doesn't. I am guessing the problem is to do with the environment setting, ie:
$env = $app->detectEnvironment(array(
'local' => array('your-machine-name'),
));
So, I have changed that to my machine name when on my local server, which, as I say, I have working. So on the live server, what should this be? "localhost"? I have tried adding another array key for 'live' with my live server's IP address and domain name, as per this answer: http://tinyurl.com/pg6hwum Nothing works.
Also, according to the tutorials I am following:
When you are in the local environment, you will notice that all of your asset files will be included individually ... Once you are in the production environment, all of your assets will be concatenated into one.
That doesn't seem to be the case for me either, as pipeline seems to be half-working, ie. it is concatenating my js and css files, but somehow messing them up.
I'd really appreciate some pointers, as I have wasted a colossal amount of time with this thing now. Thanks.
First set your environment settings on your bootstrap/start.php file into something like this:
$env = $app->detectEnvironment(array(
'local' => array('http://localhost', '*.local', 'http://local.sitename'),
'development' => array('http://dev.sitename.com'),
'production' => array('http://www.sitename.com', 'http://sitename.com'),
));
Second you need to check what enviroment does your laravel is running to check if your environment setup is working properly. By doing this:
App::environment()
So by doing that..you should have idea now what is causing the problem on codesleeve asset-pipeline.
note: see the documentation about environment for more details here
Asset pipeline will out of the box behave differently when on production compared to another environment (like local). I have put in a proposal to document some of these pain points and troubleshooting for new comers.
If you are using the most current version then there are two big behavior changes when switching environments:
caching - production assets are cached. This means once you load a page you will be stuck with those assets until you do
$> php artisan assets:clean
This is why you should set your environment to local when developing.
minification - assets are minified on production only. This can cause issues though because the minifiers sometimes break on code. There are some workarounds you can do to fix this. Something I normally do when having issues with a certain file (say Twitter Bootstrap) is use the .min.css extension which is then skipped by the minifier and written out as-is.
Note that this behavior is out of the box and can easily be modified by editing your configuration.
$> php artisan config:publish codesleeve/asset-pipeline
Then edit your file app/config/packages/codesleeve/asset-pipeline/config.php. For more information on these options visit the documentation here.
Hope this helps.
I am trying to develop a Facebook Application using the Ruby Heroku pack provided. I have experimented with this before but just created a new app to develop. I am having an issue where I am unable to log in with the app. I click on a button to log in, but after the redirects, I find that nothing has happened. Once in every 20 or so attempts though, it will log me in correctly.
For those who've never used the Heroku hosting for Facebook, here is the template that gets installed. The only changes I have made were to modularize the app.
The relevant routing is as follows:
get "/auth/facebook" do
session[:access_token] = nil
redirect authenticator.url_for_oauth_code(:permissions => FACEBOOK_SCOPE)
end
get '/auth/facebook/callback' do
session[:access_token] = authenticator.get_access_token(params[:code])
redirect '/'
end
Has anyone ever experienced this before? If one would like to try themselves, this is the location of the app. I have a similar one running that doesn't exhibit this problem, so I really can't figure it out.
EDIT: I think I found the problem. I had set Unicorn preload_app to false, following this piece of information from New Relic. Setting preload_app to true has since fixed the problem. Unfortunately, I cannot remember why I set it to false in the first place (I have adapted some configuration stuff from a previous app). Maybe someone has better knowledge than myself.
I'm missing something with the asset pipeline functionality. Things work fine in development and I move to run in production environment and all hell breaks loose!
So I have an image in app/assets/images named "logo.png"
I precompile (RAILS_ENV=production rake assets:precompile) and I can verify that in public/assets there now exists both a logo.png and logo-5fa60e416f495e562c56a5087fe696dc.png
I then run in production rails s thin -e production
But I get a broken image
GET http://localhost:3000/assets/logo-5fa60e416f495e562c56a5087fe696dc.png 404 (Not Found)
What is going on?
I also notice that when I switch to production I also starting getting javascript errors like "JQuery is not found" for jquery tools EVEN THOUGH no problems in development AND I specify in my application.js that jquery should be loaded first before any other javascript files.
The solution is simple (finding it was not).
Simply update your config/production.rb to reflect the following:
config.serve_static_assets = true
Though this is set to false by default, only when you set it to true will you be able to properly run your rails 3.1.x application locally (via webbrick or in my case thin) in the production environment. You'll probably want to set it back to false before you deploy to your actual production server.