Preview mails in staging server on rails 4 - ruby-on-rails-4

I have a staging server where I want the designers to be able to preview the email design.
I have used rails 4 feature and I am able to access the mailer preview in localhost on path
http://localhost:3000/rails/mailers
Can I do the same on the staging server ?

this is all about configuration
first thing that you should do is to environment for staging.
by default rails give you development, production, and test
then I would set up something like mailcatcher this way emails dont go out to real people that dont need to see them.
last step is to configure the server environment to be staging
You can also edit config vars on your app’s settings tab on Dashboard
Heroku manifests config vars as environment variables to the
application. These environment variables are persistent – they will
remain in place across deploys and app restarts – so unless you need
to change values, you only need to set them once. Whenever you set or
remove a config var, your app will be restarted.
but here is were you need to change production to staging
I hope that this helps

Related

Heroku constantly change url for my heroku-redis addon

Im using the heroku-redis addon as a message broker for my django app, which is hosted on a VPS. The problem is that Heroku constantly change de URL of the service, so my app keep crashing from time to time, when the url is changed.
Anyone knows a way to fix this? Is there a way of getting automatically the updated URL for my heroku-redis addon?
From heroku-redis provisioning docs
In order for Heroku to manage this add-on for you and respond to a variety of operational situations, the REDIS config vars may change at any time. Relying on the config var outside of your Heroku app may result in you having to re-copy the value if it changes.
Just use REDIS_URL env variable in your settings to always get correct URL

Reading environment variable from beanstalk for reactjs web app

I have a problem which seemed to be trivial at the beginning but now I am getting that it is very confusing.
So I am using reactjs for the front end of my application. I deploy my reactjs web app in a beanstalk in aws. In the beanstalk I define an environment variable called test and now I wanna read that and use it in my react application. But the problem is my react application is basically a client script in users browser so I cannot do something like this:
const config = {};
config.db = {
test: process.env.DB_DATABASE || 'my_db',
};
which is suggested in that link.
https://alexdisler.com/2016/03/26/nodejs-environment-variables-elastic-beanstalk-aws/
So I am doubting this is doable at all or it is something that is not possible.? any idea would be appreciated
Your react code will run in the browser, and will not be able to access the environment variables that have been set on the server.
The link you provided describes the process to set environment variables in a node.js environment that is hosted on an elastic beanstalk instance.
I suggest creating a config file in your react application that stores necessary parameters and initial settings you need to run your app.

Compile JSP & Java on browser refresh - Tomcat

Is there any way to setup Tomcat server so whenever I make changes to Java class or JSP page the change is visible on browser refresh.
I'm bored stopping and starting Tomcat. I want to configure Tomcat like the way WAMP works [where you can see the PHP code change upon browser refresh]
If it's for development mode that's ok. Don't use it for production stuff.
You don't have to restart the server. You can restart the app through the Tomcat Manager.
You can even do this directly as: http://[hostname]:[port]/manager/reload?path=[/path/to/your/webapp]
or
Define your context as reloadable
Be careful: It is NOT recommended to place elements directly in the server.xml file
Check out the Tomcat configuration guide
For java classes: reloadable
Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. You can use the Manager web application, however, to trigger reloads of deployed applications on demand.
NOTE - The value for this property will be inherited from the reloadable attribute you set on the surrounding Context component, and any value you explicitly set here will be replaced.
(http://tomcat.apache.org/tomcat-7.0-doc/config/loader.html)
For JSP: development ($CATALINA_BASE/conf/web.xml)
development - Is Jasper used in development mode? If true, the frequency at which JSPs are checked for modification may be specified via the modificationTestInterval parameter.true or false, default true.
Hope this helps

Set up an existing Django app on another server

This must, must, must be a duplicate but I can't find the answer either here or on Google.
I have an existing Django app and I want to deploy it on another server.
What are the steps I need to go through to get it running elsewhere, in words of one syllable?
At a minimum, presumably:
create a project on the new server
copy over all my app's files into that project
edit localsettings.py or equivalent with local database settings etc
run python manage.py syncdb to create my database
load fixtures
run tests
Is that it? Are there any unofficial or official instructions for copying an app elsewhere?
Thanks.
The most basic, easy way to do it is:
Set up the server environment so that it matches the current environment as closely as possible. The most important thing is that you're using the same version of Django (obviously). You can run a different database, but it makes porting from the old server to the new server a little more involved. Otherwise, you will just have to adjust your settings to match the new server, if they can't be duplicated (ie, user names, etc).
Copy over your code
Dump your old database structure and data into the new database
Running startproject isn't strictly necessary. Your web server just needs to be configured correctly, to run django with the appropriate settings.py file -- and Django takes it from there.

Yet another elmah problem ... works everywhere but production

I have elmah setup to use SqlErrorLog and this is running fine on both my local using the developer webserver, and my integration environment under IIS. On my production box elmah is able to log exceptions with XmlFileErrorLog writting to the app_data directory. When I switch back to SqlErrorLog I get nadda. I have ensured that the database exists has the required table and three procedures. I have tested the connectionstring. I have compared the web.configs from my local to prod and the only differences are the database server name in the connection strings.
Any thoughts as to what else can be blocking in a production installation?
~-=Mike=-~
Have you properly setup the permissions on the database for ELMAH? Depending on if you are you using impersonation with your web application, you may have to grant privileges to additional users to the stored procedures/tables.