Skip to content

Toro Cloud Dev Center


Production environment

A production environment refers to a deployment where your organization's services are finally made available to your intended clients. Typically, the transition to a production environment does not occur until your code is ready and deemed stable to avoid unwanted and unexpected behavior.

As with most applications, high availability and scalability is desired in production instances of Martini. There are plenty of setup implementations that can help you achieve these properties, like the three tier network design featuring high availability. However this page will discuss an alternative three-tier network architecture on AWS, illustrated below, that could work for organizations looking for a slightly easier and more budget-friendly approach.

A diagram of the production environment implementation

The purpose of going over an actual implementation is to help you get an overview of the resources often required in a production environment so you can further understand and conceptualize the production environment you would want for your very own Martini instance(s).

Get creative!

You may substitute, scale, or change the recommended concepts and ideas as you see fit.

Implementation

A three-tier network architecture is suitable for production as this design makes it possible to modularize components; hence making it easy to replace or update parts without compromising the entire system.

AWS, for its popularity, hefty community support, and reasonable options for scalability has been chosen as the cloud provider for this implementation.

In this set-up, the infrastructure will be hosted in a specific AWS region and contained in a virtual private cloud (VPC). A VPC is an isolated section in AWS where you can define resources and configurations for your network. The architecture will be divided into two availability zones (AZ): availability zone B and availability zone C. In each of these AZs are three tiers; namely, the web tier, application tier, and the database tier. When configured correctly, this setup will ensure reliability, availability, scalability, and security.

Tier Name Number of Resources AWS Service and Instance Type Purpose
Tier 1 Web tier 2 EC2, t2.medium This tier is where web servers are located. Instances in this tier are in charge of distributing traffic using NGINX, which acts as a load-balancer and a reverse proxy. It also serves as the first line of defense or a demilitarized zone (DMZ) in the network.
Tier 2 Application tier 2 EC2, m4.xlarge This is the layer where the applications are deployed. In this production configuration scenario, there are two application servers for Martini. In addition to these, other additional application servers such as a standalone Solr server may be configured.
Tier 3 Database tier 2 RDS, r4.large This is the tier that includes the database servers. It includes a master (writer) and a slave (reader) database. This relationship ensures that in the case that the master goes down, the slave will automatically be promoted as the main database server.

Tier 1

The first tier includes two instances for NGINX, featuring redundancy and fail-over capabilities. NGINX will serve as a reverse proxy and a load-balancer for Martini.

It will be used to proxy requests from the client to the application servers. This adds a layer of security as it prevents users from directly accessing the actual application servers.

How do I run Martini with NGINX?

Check out this step-by-step guide on how to configure a Martini instance to work with NGINX and TLS.

Tier 2

The second tier includes two application servers which both run Martini. This tier was configured this way for the same reasons as the resources on tier 1 – redundancy and fail-over capabilities.

Non-embedded Solr

For production environments, it is recommended to use a standalone Solr or SolrCloud instance. Having an independent instance is particularly useful when you have multiple Martini instances connected to a single instance of Solr.

Tier 3

The third tier includes the database instances that your Martini instances will connect to. This tier is composed of two AWS RDS instances that have a master-slave relationship, which also feature fail-over capabilities.

File systems

A network file share (NFS) will be required in this setup so that application configuration files and Martini packages can be shared. In this example, we'll be using the AWS Elastic File System (EFS) service. There will be a common data source or mount for the servers to refer to. During an unexpected downtime in any of servers, the backup server which will be taking over seamlessly – still having access to the same files used by clients, users, and applications.