Application variables issue - zend-framework

Have two instances of same application(as Dev/PROD) running under Virtual Hosts in a Dedicated server with two different domain names using Plesk Panel for management. I know it doesn't make sense Dev/PROD on one instance but DEV is used hardly 5-10% of time and we can't afford to have one more server. But the issue is Application variables used in PROD domain are being overridden by the variable in DEV. Is there any way to config webserver or Zend framework to see the two instances as separate spaces?

Here is a good solution that might be at help in your case.
Keep application.ini in version control without conflicting

Related

How to optimize deployment strategy for Tableau dashboards?

We have two environments (TEST and PROD) to publish dashboards to. Data for those envs resides on the same RDBMS server, 1 schema per env. And we want to publish 1 dashboard to 2 envs, so that 1 dashboard looks at TEST schema, and the other looks at PROD schema.
That's the approach we came up with, but it's not working as expected: we can not find a way how to deploy Tableau dashboard to 2 envs (and use 2 separate schemas) without actually maintaining 2 versions of the same dashboard (one for TEST and one for PROD).
So either we chose a bad deployment strategy for Tableau, or we're doing smth wrong with it. Could anybody please share your experience on how to deploy Tableau dashboards to separate envs without having to manually edit dashboard for every env? Or what's the problem with our approach?
You didn't specify your RDBMS in the question so my answer will make a broad statement that may not necessarily apply in your specific case.
I think you've chosen a poor approach for your testing and production database environments. Normally, test and prod are on completely separate database instances and in many cases, separate servers. Having them together on the same instance or server means you are using up production hardware resources during testing, with the possibility of locking up the server because of run away queries against the non-production schema. With a single instance, it would be very easy to bring your production instance down inadvertently or maliciously without even being logged into the production schema.
Your better approach is to have two separate database instances: one for test, one for prod. The two instances could be on the same server but are isolated db instances. Both instances have the same users and same schemas. Then you can easily point your Tableau data sources to the respective instances without needing to update your workbooks or keep two copies of each workbook. For example, if you are using Oracle, keep the TNS aliases the same on both Tableau servers but alter the connection details in tnsnames to point to either the test or prod db server.
Your situation sounds like mine. I need to publish exact same report to different environments using different server/database configuration. This is what I do:
Maintain single source of truth, which is production version.
Create an utility converting report to different environments. You can also do it manually as following:
Save your workbook (Tableau file) as .twb
Open twb file with any text editor. It is xml like. Tableau creates connection and renders graphic from this information.
Text search for username, server, port ... You will see all your configuration information here.
Replace those information by target environment information.
Save and open it again using Tableau Desktop and publish.
If you have automation tool like Jenkin, you can develop one click solution for deployment using Tableau commands.

How to share versioned data within a pod

We are currently serving around 140 webapps created by a bunch of different web agencies. The setup is the usual LEMP stack.
A 1.2 k8s cluster has been installed to migrate them as micro-services.
The problem we are facing is about serving static and dynamic content.
For this purpose we use, of course, two different containers (nginx and php-fpm) but we can't find an adequate solution to share data on both of them.
We hoped to be able to use versioned data containers but it is apparently not in the scope of k8s. Too bad.
gitRepo is not an option as we don't want to be dependent of a working git infra to instance pods. If it doesn't work we want to be autonomous and be able to serve traffic.
The other options (flocker, etc.) look heavy and complex in comparison to a simple data container. We also would like to be independent of data storage.
Is there an option I am not aware of? Does anyone have an advise on this?
Let me emphasise that we want to be able to version things in order to roll forward / backward easily.
Thank you for your time

Run multiple sites on the same GWT application

Can someone please point me to the right direction.
I need to be able to host my GWT application in a way that it allows multiple clients to use the same application which could be separated by url's but internally using the same application.
the different sites would probably be seperated by different configurations. eg. different database, different log path etc, etc,
any ideas.?
You could use the following way to arrange your projects :
- my.application.core.project : it holds all the business logic and views for the application except for the entry point
-my.application.customerX.project : it holds only the entry point and the property files used for having the connection to the db, probably customerX specific theme
-my.application.customerY.project : it holds only the entry point and the property files used for having the connection to the db, probably customerY specific theme
Such an organization of the projects would allow you to have a common core that is distributed to each of the customers and also the ability to build on top of the core customer-specific impelementations.
The url's per client can be done with URL rewriting. Be it with an apache server in front of your application and/or in combination with a Filter in your web application.
As for the configuration, logging, and/or database per client you want a solution that doesn't store a file per client on the file system next to your application. Preferable you store client specific settings in one database and have an admin interface to manage it. For the client's data you also don't want a separate database per client, because it doesn't scale well, and would be a maintenance mess if you need to upgrade your application and databases to a newer version. Look for a multitenant architecture.
I admit this is a vague answer, but without specific system and software descriptions it's kind of hard to give a concrete answer. Nevertheless I hope this answer does give you some direction.
I have successfully achieved this by setting up separate directories in tomcat for different clients and then creating soft-links to the main application within that folder. when it comes to database connection properties and other configuration properties, instead of pointing them to the main application I just created them separately.

Web development, protecting application code

I'm looking at some (PHP) Frameworks, and I just noticed this in the Laravel documentation:
Like most web-development frameworks, Laravel is designed to protect your application code, bundles, and local storage by placing only files that are necessarily public in the web server's DocumentRoot. This prevents some types of server misconfiguration from making your code (including database passwords and other configuration data) accessible through the web server. It's best to be safe.
I'm familiar with CodeIgniter and CakePHP, as far as I know, these two frameworks don't do this. Should you really split it up and place your core logic outside of the webroot? In my experience, most clients use shared hosting and are not able to change their VirtualHost settings.
What kind of misconfiguration could you possibly do that would output your passwords? When developing, should you really do this?
Yes, keeping only those files which should be publicly accessible in DocumentRoot is a best practice for web application security. Consider:
Every file which is private would need a rule configured with the web server to explicitly block it.
Anyone adding files to the project needs to consider web server security settings. Simply keeping the files in separate directories makes it obvious what's public. And developers don't need to change security configurations.
Separating executable code and static files is a good practice anyway.
Not blocking access to PHP scripts can cause unintended consequences. For example, you may have a script to update some DB records when run manually at the command line, so someone simply guessing a script name can run it over the internet.
Monitoring for and cleaning malicious code written to the public directory is much easier if the real application logic is elsewhere. See Wordpress breakins for an example.
CakePHP supports this - see deployment:
CakePHP applications should have the document root set to the
application’s app/webroot. This makes the application and
configuration files inaccessible through a URL.

How can I configure a Catalyst application for different servers?

I am planning a Catalyst application, that will be deployed over a number of servers. It will be used internally by support staff to control aspects of an operational system that runs on those servers.
The application will run much in the same way on each server, save for a limited amount of site specific behaviours. Some actions will only apply to some servers, and some actions will behave differently on other servers.
Are there any recognized design patterns/practices that enable site-specific customization of a Catalyst application?
I am currently thinking of deploying a site configuration file alongside the application, that will be used to determine what actions to enable, and set parameters that control other action's behaviour. Ideally this customization would happen when the application is loaded by mod_perl (Apache2) - but I am not sure if that would even be possible.
Any suggestions welcome!
Catalyst::Plugin::ConfigLoader has code to help you with site-specific configuration in the form of the MYAPP_CONFIG_LOCAL_SUFFIX environment variable. Since Controllers are Components and config is available at setup_components time, you can do whatever foolery you want with action registration when your controller is compiled. There's not much pre-rolled for it, because everyone's requirements are so different, but it's not exceptionally hard, and there's advice to be found on the mailing list.
You can set templates, or have conditional behaviour in the controllers based on the value of $c->req->host.
I always use the unique combination of $HOSTNAME and $USER to define the specific configuration file to be loaded, e.g.
conf => "my_app_${hostname}_${user}.conf"