Devops and Release Engineering

Discuss and learn knowledge, tips and tricks from picking a cloud hosting company to configuring and optimizing a server infrastructure to run Anahita ™. #Cloud #Server #Optimization #DevOps #ReleaseEngineering #Hosting

Stories

Rastin Mehr

Rastin Mehr published a new Article

Scaling Up Anahita

Scaling Up Anahita

People have asked us about how to scale up Anahita for hundreds of thousands or more users, also about a micro-services version of Anahita. No cloud application can by default scale up to a large n...

Read More

People have asked us about how to scale up Anahita for hundreds of thousands or more users, also about a micro-services version of Anahita. No cloud application can by default scale up to a large number of users. Traditionally, Software-as-a-service or SAAS projects achieved this by throwing hardware and computing power at their production server. Today they use a dev-ops and release engineering infrastructure.  

Reimagining Anahita as a microservices architecture

Two common technologies that we can use today are Docker and Kubernetes. Docker allows us to run Anahita, MySql Database, and other parts of a setup in individual containers. A group of Docker containers that communicate with each other is a cluster of containers. At the moment, Anahita is a monolith application. We want to move towards a micro-services architecture. In this article, I want to outline the first few changes that could make this leap happen.

A Client-Server Architecture

Moving towards a client-services architecture is happening as we speak. The work on Anahita React app is part of this goal. A client-server architecture isn't a particularly a micro-services concept, but it will remove some significant barriers. The idea is to remove all the code in Anahita that is responsible for constructing and rendering user interfaces and only provide RESTful APIs.  Right now some of the processing power in the server side goes into reconstructing user interface elements and template layouts in every request. Our current codebase is about 11MB, and by reducing the codebase to a RESTful API, we can probably reduce the size to half and increase the speed too. 

Then build Client applications using technologies such as React JS, Vue JS, Electron JS, and ios/Android SDKs. This way we can have web, mobile, and desktop apps that communicate with the same back-end.  

Storing sessions in Redis

Right now, Anahita reads and writes sessions in a table in the MySQL database. It works well for an Anahita installation with tens of thousands of users. We can, however, add an adapter to make the session management with the Redis database.

Redis is a NoSQL database that stores data as key-value pairs, and it runs in the RAM. That makes it quite fast and efficient. Anahita reads and writes sessions in every request. If we could read them from a Redis database, it would increase the performance and efficiency of the system for hundreds and thousands of users, or perhaps more. 

Building a notification worker

Anahita creates a lot of notifications and sends out a lot of email notifications. It doesn't have too. In a lot of scenarios, users may not appreciate receiving constant email notifications. Also,  we have the option of sending out notifications via different channels such as mobile and browser push notifications.

A micro-services approach would be developing a worker cloud application with RESTful APIs that receives a notification from Anahita and the list of recipients. Then compose all the notification messages and send them out via notification services for email, browser, or mobile.

Building a Docker and Kubernetes cluster

Now that we have Anahita, MySQL, Redis, and notifications worker, we can build Docker packages for them. Fortunately, there are already docker images for MySql and Redis on DockerHub. All we need is Docker images for Anahita and the notifications worker. Then we can use a cluster technology such as Swarm from Docker or Kubernetes from Google to orchestrate these containers for a cloud environment. Most cloud service providers support Docker and Kubernetes or DK8 technologies, so this will make it quite simple to deploy an Anahita cluster on those cloud services. 

So how do we scale up using a cluster technology such as Kubernetes? We can have one or multiple instances of  Anahita, MySQL, Redis, or the notification worker in this cluster. 

We can even configure the Anahita DK8 cluster to create additional pods from these containers whenever traffic goes up or kill them whenever the traffic is slow. Cloud providers such as Amazon AWS provide APIs that let you monitor the operation cost of your cluster, so you can configure it to keep the number of pods within your price range. 

Building a more granular microservices architecture

Anahita can be further broken down to individual containers that perform specialized tasks. For example, a Docker container for the story feed alone, one for the notifications feed, and one for identity management and authentication.  Each development requires time and funding. You need to be mindful whether your project requires this level of scalability.

Making Anahita available as a DK8 cluster is on our road map, and we would want to make it happen this year. In fact once the Anahita React app is ready and the Anahita back-end is reduced to APIs only, we would want to make Anahita as a DK8 deployment. Using a cluster technology would make it easier for you to develop Anahita apps and deploy it to the cloud by building a Continuous Integration (CI) and Continuous Deployment (CD) workflow.

Resources:

  1. Docker: https://www.docker.com
  2. DockerHub: https://hub.docker.com
  3. Kubernetes: https://kubernetes.io
  4. Redis: https://redis.io
  5. Microservices Architecture https://en.wikipedia.org/wiki/Microservices

#Anahita #Docker #Kubernetes #MicroServices #ReactJS #ClientServerArchitecture #CloudArchitecture #DevOps #ReleaseEngineering #AWS #RedisIO

Photo by Snapwire from Pexels

Read Less
Amazon Lightsail is looking very tempting. I wonder how the performance is: https://aws.amazon.com/lightsail/pricing/ #AWS #Lightsail
For anyone who use nginx, make sure to not to fall into any of the these pitfalls http://wiki.nginx.org/Pitfalls
2 people liked this
Just realized that Rackspace offers Cloud Database. It seems like an option high performance database service. We should give that a try

http://www.rackspace.com/cloud/cloud_hosting_products/data... Read More
Just realized that Rackspace offers Cloud Database. It seems like an option high performance database service. We should give that a try

http://www.rackspace.com/cloud/cloud_hosting_products/databases/ Read Less
2 people liked this

Suhosin

I added Suhosin to my stack and made a fresh install of Anahita - wget from server worked fine, and site installed perfectly. But the n i got the message that i have Suhosin and need to apply a fix...

Read More

I added Suhosin to my stack and made a fresh install of Anahita - wget from server worked fine, and site installed perfectly. But the n i got the message that i have Suhosin and need to apply a fix.

I followed the instructions ( http://www.assembla.com/wiki/show/nooku-framework/Known_Issues) and added the line to php.ini. I wasn't sure how - my php.ini is in ../php5/etc not in the root (/var/www)...

It is isn't clear to me ;-) should I merely create a php.ini with that one line (suhosin.executor.include.whitelist = tmpl://, file://) in /var/www and /var/www/administrator?

This didn't change the result - I only see the first page 9front end and backend - but still shows the suhosin notice)

thanks

Read Less
Yes, I followed the instructions in the link, and eventually I sorted it. Probably was needing to restart nginx, php5-fpm
Thanks Aleks :)

Suhosin

I added Suhosin to my stack and made a fresh install of Anahita - wget from server worked fine, and site installed perfectly. But the n i got the message that i have Suhosin and need to apply a fix...

Read More

I added Suhosin to my stack and made a fresh install of Anahita - wget from server worked fine, and site installed perfectly. But the n i got the message that i have Suhosin and need to apply a fix.

I followed the instructions ( http://www.assembla.com/wiki/show/nooku-framework/Known_Issues) and added the line to php.ini. I wasn't sure how - my php.ini is in ../php5/etc not in the root (/var/www)...

It is isn't clear to me ;-) should I merely create a php.ini with that one line (suhosin.executor.include.whitelist = tmpl://, file://) in /var/www and /var/www/administrator?

This didn't change the result - I only see the first page 9front end and backend - but still shows the suhosin notice)

thanks

Read Less
Hi Alex, did you manage to white list Anahita in suhosin so it is working even if suhosin is installed?
Aleks Blumentals liked this
Umesh

Umesh commented on the topic

Our NGINX Configuration

Here's a snippet for our nginx configuration that does the SEF rewrite similar to .htaccess

server {

listen 80; server_name www.anahitapolis.com;

access_log /var/log/nginx/anahitapolis...

Read More

Here's a snippet for our nginx configuration that does the SEF rewrite similar to .htaccess

server {

listen 80; server_name www.anahitapolis.com;

access_log /var/log/nginx/anahitapolis.com-access.log; error_log /var/log/nginx/anahitapolis.com-error.log;

large_client_header_buffers 4 8k; # prevent some 400 errors

root /var/www/anahitapolis.com; index index.php index.html; fastcgi_index index.php;

client_max_body_size 40m;

if ( !-e $request_filename ) { rewrite (/|\.json|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ /index.php last; break; }

location ~ /logs/* { deny all; break; }

#Static Files location ~ \.(jpg|jpeg|gif|css|png|js|ico)$ { access_log off; expires modified 30d; }

# PHP location ~ \.php { include /etc/nginx/fastcgi_params; keepalive_timeout 0; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; } }

Read Less
Rastin Mehr liked this
Umesh
Umesh
March 05 2012 Permalink
Hi Arash,

How did you manage to get a clean URL without index.php?

I'm getting /community/index.php/component/pages/page/40?alias=my test page

whereas anahitapolis.com gets a nice and clean URL as

/component/pag... Read More
Hi Arash,

How did you manage to get a clean URL without index.php?

I'm getting /community/index.php/component/pages/page/40?alias=my test page

whereas anahitapolis.com gets a nice and clean URL as

/component/pages/page/56580?alias=february-2012-hangout-schedule 

Could you please point me to specific nginx configuration entries? Read Less

Our NGINX Configuration

Here's a snippet for our nginx configuration that does the SEF rewrite similar to .htaccess

server {

listen 80; server_name www.anahitapolis.com;

access_log /var/log/nginx/anahitapolis...

Read More

Here's a snippet for our nginx configuration that does the SEF rewrite similar to .htaccess

server {

listen 80; server_name www.anahitapolis.com;

access_log /var/log/nginx/anahitapolis.com-access.log; error_log /var/log/nginx/anahitapolis.com-error.log;

large_client_header_buffers 4 8k; # prevent some 400 errors

root /var/www/anahitapolis.com; index index.php index.html; fastcgi_index index.php;

client_max_body_size 40m;

if ( !-e $request_filename ) { rewrite (/|\.json|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$ /index.php last; break; }

location ~ /logs/* { deny all; break; }

#Static Files location ~ \.(jpg|jpeg|gif|css|png|js|ico)$ { access_log off; expires modified 30d; }

# PHP location ~ \.php { include /etc/nginx/fastcgi_params; keepalive_timeout 0; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; } }

Read Less
Rastin Mehr liked this
Aleks, you may want to review your ownership permissions, chances are you are not able to write to the parent directory path

Amazon S3 backup?

Curious what thoughts are out there regarding backup solutions for Amazon S3 storage?

I've been able to transfer /assets to S3 - very simple - now thinking through the "what if" scenarios...  has ...

Read More

Curious what thoughts are out there regarding backup solutions for Amazon S3 storage?

I've been able to transfer /assets to S3 - very simple - now thinking through the "what if" scenarios...  has anyone else come across a worthwhile solution?

Read Less
Try also Transmit
Rastin Mehr liked this
Magnus Larsson

Magnus Larsson commented on the topic

Looking for server admin

Hi guys, I am looking for someone who is interested in setting up a gentoo LEMP stack and merge my old Anahita installation from another LEMP stack on Rackspace. The one I have now is suffering fr...

Read More

Hi guys, I am looking for someone who is interested in setting up a gentoo LEMP stack and merge my old Anahita installation from another LEMP stack on Rackspace. The one I have now is suffering from several malconfigurations and I need a clean setup. The setup needs to be highly secured, have great performance and be scalable. I would like to run it on Rackspace and connect it to my amazon S3 account.

Sounds interesting? Just let me know.

Read Less
Magnus Larsson
Magnus Larsson
January 27 2012 Permalink
I belive at this stage in the process where I am building a proof-of-concept site and everything is comming from my own pocket that the first approach is more suitable for me. As soon as I have a signed project, and a... Read More
I belive at this stage in the process where I am building a proof-of-concept site and everything is comming from my own pocket that the first approach is more suitable for me. As soon as I have a signed project, and also funding, and the number of users increases I'll move to the second approach. How does that sound to you. Could you just give me a proposal for the first one and some comparison to the second one on certain interesting parts and some pros and cons for the two that would be excellent. Thanks. Read Less

Looking for server admin

Hi guys, I am looking for someone who is interested in setting up a gentoo LEMP stack and merge my old Anahita installation from another LEMP stack on Rackspace. The one I have now is suffering fr...

Read More

Hi guys, I am looking for someone who is interested in setting up a gentoo LEMP stack and merge my old Anahita installation from another LEMP stack on Rackspace. The one I have now is suffering from several malconfigurations and I need a clean setup. The setup needs to be highly secured, have great performance and be scalable. I would like to run it on Rackspace and connect it to my amazon S3 account.

Sounds interesting? Just let me know.

Read Less
Magnus Larsson
Magnus Larsson
January 26 2012 Permalink
@Dale-Kurt, I would like to get started planning for the installation of a new server and the  migration of data from current distribution to the new to be isntalled. How soon can you be available for work?
@Magnus I can be ready within a 1-2 weeks
Magnus Larsson
Magnus Larsson
January 26 2012 Permalink
@Dale-Kurt, that works fine for me. As you know I have an account on Racksoace where I would like the new server to be set up. Could you please make a list of the things you would like to, as well as have to, implemen... Read More
@Dale-Kurt, that works fine for me. As you know I have an account on Racksoace where I would like the new server to be set up. Could you please make a list of the things you would like to, as well as have to, implement to secure the machine, make it robust yet flexible for future needs. Furthermore, I saw a service called SendGrid that I would like to be implemented as well. It deals with the email SMTP so the web server does not have to. Have you heard any pros or cons with that service? So, if you could just send me a list with what you have to do and what access you need to what services together with a time estimate that would be great. I also need your help merging the data from my old server to the new one. That is migrate from 1.5.19 Birth to 1.6 Embryo. Read Less
There are two ways of implementing an infrastructure for you.

1. Manually configure the infrastructure with two or more servers pending on what it is you which to achieve. This is good for early startups with very lo... Read More
There are two ways of implementing an infrastructure for you.

1. Manually configure the infrastructure with two or more servers pending on what it is you which to achieve. This is good for early startups with very low budgets.

2. An automated infrastrucutre with auto scaling and provisioning. This is good for early startup and enterprise with investor funding.

As it related to SendGrid, I am familiar with it. I can configure your server to send mail using postfix or sendmail through the SendGrid service.

I can provide you with a proposal for either of the two kinds of infrastructure I have outlined for you, just let me know which you are comfortable with Read Less
Arash Sanieyan

Arash Sanieyan commented on the topic

VPS server configuration suggestions

Understanding the base approach to be "buy the pair of shoes that fit", can anyone provide estimates of how much memory usage would correlate to a number of users in an "active" community?

I'll be...

Read More

Understanding the base approach to be "buy the pair of shoes that fit", can anyone provide estimates of how much memory usage would correlate to a number of users in an "active" community?

I'll be moving to a VPS solution with my hosting provider tonight and see they offer a range of options for RAM (300MB to 4GB) with unlimited bandwidth, storage, etc., no matter what RAM you select.  So really my only variable here is RAM (which of course correlates positively to cost).

For week 1 they provide you the full 4GB of RAM and then scale back ater the first week to what meets your existing needs.  However, since I'll be starting with a small community that i hope to grow, I really don't have any estimate as to what RAM setting might make sense with NN users.

The operative word being "active", would 300MB be enough to support and active community of 500 members?  1500?  Or can this even be estimated?

Read Less
Arash Sanieyan
Arash Sanieyan
January 14 2012 Permalink
Understanding the base approach to be "buy the pair of shoes that fit", can anyone provide estimates of how much memory usage would correlate to a number of users in an "active" community?

I think the folks at Facebo... Read More
Understanding the base approach to be "buy the pair of shoes that fit", can anyone provide estimates of how much memory usage would correlate to a number of users in an "active" community?

I think the folks at Facebook should be able to give you a good stats :). They usually blog about these type of stats. But what I can tell you is that for Anahtiapolis we are using only 512 MB of memory. Later we will upgrade that to 1GB but I think the range of 512 MB and 1G should be plenty enough for few thousands users.

RAM is usually the most expensive component of a server hosting so I would start with minimal configuration and add more RAM overtime as needed. However you need to make sure that your hosting is flexible enough that allows to add more RAMs to an existing server configuration. Both Rackspace and Amazon EC2 provides flexible cloud systems that allows adding or removing RAM from a server.

The operative word being "active", would 300MB be enough to support and active community of 500 members? 1500? Or can this even be estimated?

Again, I can't tell you exactly how much RAM you would need but based on our own experience on Anahitapolis, 300 MB should sounds reasonable for 500 members and as your community grows over a thousand then you can upgrade to 512 MB.

Also there are server configuration practices that can have an effect on the performance, for example op-code caching using APC or memcache or MySQL caching can also make a huge impact.

Cheers Read Less
Arash Sanieyan

Arash Sanieyan commented on the topic

Amazon S3 backup?

Curious what thoughts are out there regarding backup solutions for Amazon S3 storage?

I've been able to transfer /assets to S3 - very simple - now thinking through the "what if" scenarios...  has ...

Read More

Curious what thoughts are out there regarding backup solutions for Amazon S3 storage?

I've been able to transfer /assets to S3 - very simple - now thinking through the "what if" scenarios...  has anyone else come across a worthwhile solution?

Read Less
Arash Sanieyan
Arash Sanieyan
January 14 2012 Permalink
I used to think S3 back up was redudant until last year where amazon servers crashed and people lost of their data. Who would have thought ? Having said I haven't figured out what's the best approach in this scenario ... Read More
I used to think S3 back up was redudant until last year where amazon servers crashed and people lost of their data. Who would have thought ? Having said I haven't figured out what's the best approach in this scenario and I haven't seen any solution for that. Usually amazon S3 is the final destination to back up data offsite. Read Less

Looking for server admin

Hi guys, I am looking for someone who is interested in setting up a gentoo LEMP stack and merge my old Anahita installation from another LEMP stack on Rackspace. The one I have now is suffering fr...

Read More

Hi guys, I am looking for someone who is interested in setting up a gentoo LEMP stack and merge my old Anahita installation from another LEMP stack on Rackspace. The one I have now is suffering from several malconfigurations and I need a clean setup. The setup needs to be highly secured, have great performance and be scalable. I would like to run it on Rackspace and connect it to my amazon S3 account.

Sounds interesting? Just let me know.

Read Less
@Magnus Yes, I am interested.

I have Gentoo for sometime, however I always come back to Debian and as recently Ubuntu for any concerns. I use Debian/Ubuntu for production environment for clients without issue, as we... Read More
@Magnus Yes, I am interested.

I have Gentoo for sometime, however I always come back to Debian and as recently Ubuntu for any concerns. I use Debian/Ubuntu for production environment for clients without issue, as well as for my own personal projects. Read Less
Magnus Larsson
Magnus Larsson
January 14 2012 Permalink
Excellent. Btw. I will have to migrate data from the 1.5 version from another server on my Rackspace account at the same time. Could you please give me some price indication and scope?
Are both server installed and configured for the migration or should I also take the install and configuration into consideration? I'm also available on Skype (dalekurt) if you wish to discuss this further.

My rate i... Read More
Are both server installed and configured for the migration or should I also take the install and configuration into consideration? I'm also available on Skype (dalekurt) if you wish to discuss this further.

My rate is discounted to USD$25/hr for Linux in the cloud jobs Read Less
Magnus Larsson
Magnus Larsson
January 14 2012 Permalink
I already have a server up and running with a 1.5 instance on a Gentoo LEMP stack. However, when the 1.6 Birth is released I would like to migrate the site to a new LEMP stack. SEtting up the new stack with APC and al... Read More
I already have a server up and running with a 1.5 instance on a Gentoo LEMP stack. However, when the 1.6 Birth is released I would like to migrate the site to a new LEMP stack. SEtting up the new stack with APC and all that and then migrating it is something I am not good at. This is where I would need your help. I am not sure when the 1.6 Birth will be released so I am affraid I cannot give you any date when I would need to get this done. I will add you on Skype so we can discuss this further. Read Less
Magnus Larsson

Magnus Larsson commented on the topic

Looking for server admin

Hi guys, I am looking for someone who is interested in setting up a gentoo LEMP stack and merge my old Anahita installation from another LEMP stack on Rackspace. The one I have now is suffering fr...

Read More

Hi guys, I am looking for someone who is interested in setting up a gentoo LEMP stack and merge my old Anahita installation from another LEMP stack on Rackspace. The one I have now is suffering from several malconfigurations and I need a clean setup. The setup needs to be highly secured, have great performance and be scalable. I would like to run it on Rackspace and connect it to my amazon S3 account.

Sounds interesting? Just let me know.

Read Less
Magnus Larsson
Magnus Larsson
January 12 2012 Permalink
@Dale-Kurt, I am planning on setting up a completely new LEMP stack on my Rackspace account when the 1.6 Birth is released. Do you think you would be interested in helping me out with the setup and configuration?
Rastin Mehr

Rastin Mehr commented on the topic

SSL provider

I plan on setting up my site to use SSL, my question is which provider to go with, any ideas as to what I should be looking for?

Currently I am looking at Verisign EV (or one from Thwate) and one ...

Read More

I plan on setting up my site to use SSL, my question is which provider to go with, any ideas as to what I should be looking for?

Currently I am looking at Verisign EV (or one from Thwate) and one from Geotrust, any  preferance of one over the other (besides cost)?

Chaim

#ssl

Read Less
Rastin Mehr
Rastin Mehr
January 09 2012 Permalink
Hi @chaim, are you required to have a SSL certificate that is authorized by a well known third party or do you simply want to have secure the connection?

Photos View All

Articles View All

Topics View All

Powered by Anahita