I'm using a windows 10 machine. I'm also running a docker container that is running a rails application. Whenever I make a change to any server side code (i.e controllers or models) I'm required to do a docker restart app.
However my friend is using the same container on his apple machine but when he makes changes to any server side code he does not have to restart his app.
Why is this?
Rails has a configuration option (config.cache_classes) that specifies whether or not your application code should be cached in memory between requests. Having this option set to true will require you to restart your app if you make changes; having it set to false reloads your code on every request, so you don't have to restart.
It is recommended to set this to false in the development environment only, because Rails works faster if it doesn't have to reload your code every time it starts processing a request. In production, you should leave it set to true.
Related
I would like to enable caching in ArangoDB, automatically when my app start.
I'm using docker-compose to start the whole thing but apparently there's no simple parameter to enable caching in ArangoDB official image.
According to the doc, all the files in /docker-entrypoint-initdb.d/ are executed at container start. So I added a js file with that code:
require('#arangodb/aql/cache').properties({mode: 'on'});
It is indeed executed but caching doesn't seem to be enabled (from what I see with arangosh within the container).
My app is a JS app using arangojs, so if I can do it this way, I'd be happy too.
Thanks!
According to the performance and server config docs, you can enable caching in several ways.
Your method of adding require("#arangodb/aql/cache").properties({ mode: "on" }); to a .js file in the /docker-entrypoint-initdb.d/ directory should work, but keep an eye on the logs. You may need to redirect log output with a different driver (journals, syslog, etc.) to see what's going on. Make sure to run the command via arangosh to see if it works.
If that's a bust, you might want to see if there is a way to pass parameters at runtime (such as --query.cache-mode on). Unfortunately, I don't use Docker Compose, so I can't give you direct advice here, but try something like -e QUERY.CACHE-MODE=ON
If there isn't a way to pass params, then you could modify the config file: /etc/arangodb3/arangod.conf.
And don't forget about the REST API methods for system management. You can access AQL configuration (view and alter) in the Web UI by clicking on the Support -> Rest API -> AQL.
One thing to keep in mind - I'm not sure if the caching settings are global or tied to a specific database. View the configuration on multiple databases (including _system) to test the settings.
Is start (Dart server side framework) auto-refresh when one of our source code changed (just like PHP)?
Is bulls_eye, bloodless and express too?
or if they are not, is there any Dart server side framework that able to do that (edit code, then test on the browser, without needing to restart the dart/server program)?
Currently this is not yet possible in Dart. If you change the code you have to restart the app.
I wouldn't expect this to work anytime soon.
A main feature to make this possible is to manipulate the code at runtime. This is planned but as far as I know not yet started.
EDIT
The above mentioned feature is necessary when you want code to be updated without loosing the current state of the application but that is usually not so important on the server because it should be (mostly) stateless anyway.
In Dart there's no need to restart the server app when only the client part changes.
If you really just want to restart the entire server when the code changes you should be able to do that by yourself. Create a console app that loads the server app into an isolate (spawnUri) and watch the source directory for file changes. In the case of a file change shutdown the server-app-isolate and create a new one.
I am trying to use New Relic to investigate a performance issue with my Rails 4 app. On my development machine, I run the app using Thin, and can successfully use the New Relic console by accessing http://localhost:3000/newrelic.
However, in production my app runs at a different base URL (http://server/app) and is being served with Nginx and Passenger. When I try to access the New Relic console by visiting http://server/app/newrelic, I do get a response - but the console page is blank, with no data. Looking at the source of the page, I can see that it references resources at http://server/newrelic, WITHOUT the necessary base URL suffix of /app.
Can I configure New Relic to use the correct base URL?
The Ruby agent's "developer mode" feature should never be used in a production environment. The memory and CPU overhead of developer mode is significantly higher than the production monitoring performed by the agent, and it contains no mechanism for restricting access to the information it gathers, because it is only intended to be run locally.
In production, you should use the regular monitor_mode instead (configurable in your newrelic.yml), and view the graphs at your New Relic dashboard (rpm.newrelic.com/accounts/xxx/applications/xxx).
Ok, I did work around the problem by adding this to nginx.conf on the production server:
location /newrelic/ {
proxy_pass http://127.0.0.1/app/newrelic;
}
But this is only good for one application, so the original question still stands.
Probably a dumb question:
Right now, to see changes made in development, I run rails s and see the changes on the local version of my site. To see how changes look on my phone, I currently commit to Git (no matter how small the changes) and then push to heroku. This takes some time and results in lots of commits and deployments for minor changes (i.e. CSS stuff).
What is a more efficient way to test changes for rails web apps on mobile?
NOTE: I am aware I can shrink my browser but it never fails I get different outcomes on my phone.
Any help is appreciated.
RELATED: how do i run a development rails app / website on an ipod
You can also use Nitrous.io which is a cloud development environment. I like it because not only can I view my work on mobile, but since it's a hosted URL, I can share it with others while my server is running.
1) connect your phone to the same network that your local server is running on and point it to http://[your server's ip]:3000
2) use the XCode iOS Simulator and/or the Android Emulator
you can also use ngrok
https://ngrok.com/
which gives you a way to make an external tunnel to the outside world (for free) so you can use it outside of your local network
I have the following setup:
Code on my local machine (OS X) shared as a Samba share
A Ubuntu VM running within Parallels, mounts the share
Running Rails 2.1 (either via Mongrel, WEBrick or passenger) in development mode, if I make changes to my views they don't update without me having to kick the server. I've tried switching to an NFS share instead but I get the same problem. I would assume it was some sort of Samba cache issue but autotest picks up the changes to files instantly.
Note:
This is not render caching or template caching and config.action_view.cache_template_loading is not defined in the development config.
Checking out the codebase direct to the VM doesn't display the same issue (but I'd prefer not to do this)
Editing the view file direct on the VM does not resolve this issue.
Touching the view file after alterations does cause the changes to appear in the browser.
I also noticed that the clock in the VM was an hour fast, changing that to the correct time made no difference.
I had the exact same problem while developing on andLinux.
My andLinux's clock was about three hours ahead of the host Windows, and setting the correct time (actually, a minute or so behind) has solved the problem.
Actually, setting the correct date & time in the VM does seem to have solved the problem (after I restarted mongrel) -- going to do a little more digging.