Wasabi is a real-time, 100% API driven, A/B Testing platform. The platform offers companies and individuals the opportunity to perform experiments on the web, mobile and desktop for back-end and front-end, products and marketing.
We need to deploy a VPC, with two private subnets and two public subnets, along with a NAT gateway and Internet Gateway.
Clone OBytes Wasabi project:
Deploying Wasabi data tier
We are going to deploy a Cassandra cluster on AWS, using Terraform. We are going to use this Medium article: First experience deploying Cassandra on AWS as a guide to deploy our Cassandra cluster, and reuse most of the code. Many thanks to Bohdan Kalytka for publishing it along with source code used!
Our Cassandra cluster will be formed of 6 instances, of type
, with EBS volumes (SSD type GP2) of 200GB each. Resources assignment for Cassandra clusters is a fuzzy topic. Nonetheless, most of the checked sources agreed on SSD volumes should be used, and
instance types (2 vCPU, 8GB RAM, memory-optimized) are the smallest type suitable for production clusters.
We are going to deploy this cluster on
region, in 2 different AZ:
. We will have 2 seed nodes, and 4 non-seed nodes, distributed between both AZ.
First of all, we need to generate Cassandra custom AMI. We are going to use Packer for this, and Ansible for provisioning the AMI.
Set environment variables for Terraform and Packer — AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGION.
and add your public
(public subnet). Then run
to generate your custom AMI with Cassandra installed.
Copy AMI code generated and change the value of
Now, you should be able to connect to your Cassandra cluster using cqlsh:
You can change the password using this command:
Note: If the load balancer show some Cassandra instances out of service, SSH into the instance and restart Cassandra service:
sudo service cassandra restart
Deploying Wasabi app
Generating a custom AMI
For Wasabi, we have to generate an AMI with custom configuration. We will use Wasabi version
, since there's a bug after this version still unresolved: https://github.com/intuit/wasabi/issues/265.
We will create a
instance via AWS console, based on Ubuntu 16.04 AMI (
). We create it on the VPC we previously created using terraform and on a public subnet. We will attach an EBS volume to this instance.
Creating SG and role for the instance
We are going to use terraform to create a SG and role/policy/profile for our instance. We are going to target the creation of these resources.
SSH to the instance we have just created, clone Wasabi repository and checkout version
Then, bootstrap Wasabi:
And reboot the instance:
Now, let's edit
file and add remote URL for Cassandra/MySQL and config them.
Change the following lines.
We set up
to 3. Explaining these values go beyond the scope of this article.
Apply Cassandra migrations
Now, we need to apply migrations to Cassandra DB. For this, we need to follow these steps.
Apply MySQL migrations
This step shouldn't be necessary, but Wasabi doesn't generate migrations properly when we are using an external MySQL DB. After finishing the installation, it shows this error: https://github.com/intuit/wasabi/issues/348
As a workaround, we installed Wasabi on Docker containers and created a dump of MySQL database. After that, we restored that dump and it worked. You can find the dump on this gist
Install MySQL client:
Restore the file on your MySQL DB using this command.
Build and start Wasabi
After all these steps, everything should be OK. So, the only steps left are build Wasabi app and start it! We need to build & run without unit tests, otherwise, the build fails.
Creating an AMI based on this instance
Now, we need to create an AMI based on this instance we've just configured. We can do this via AWS console: https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/tkv-create-ami-from-instance.html
Then, we copy the AMI ID and change
Deploying Wasabi app
We will deploy an ALB for Wasabi and 2x instances on 2x different AZ.
All set! 🎉 You can reach Wasabi UI on the ELB endpoint and start to use it!