Hello, everyone! In this tutorial, we will deploy OpenDAX3 - an open-source cloud-native platform on the AWS cloud.
Apr 19 2021 | TutorialOpenDAX™ stands for Open-Source Digital Assets Exchange is open-source software that allows users to build a fully-featured exchange service to facilitate the trading of digital assets and cryptocurrencies.
Amazon Web Services(AWS) is a cloud infrastructure provider which will host the OpenDAX platform on its servers.
So, let us get started.
Visit aws.amazon.com. Click Signup.
If you already have an account, sign in with your email as a root user.
After signing up, set up the payment methods. Amazon will charge your credit/debit card for a small amount(for security purposes). After providing the necessary details, your account will be activated and automatically qualify for a free tier to gain free, hands-on experience with the AWS products and services. Know more about AWS free tier here
After activation, to create a project. AWS provide a management console to use AWS services .Here we will create a new VM for the OpenDAX project using AWS EC2 service. In all services pane, you will see EC2. Click on it.
You will see a dialog box to create a new instance. Click on the orange launch instance button, which will bring you to the configuration page for VM's
After clicking on the launch instance, there is an option to search for a distribution/AMI for your OpenDAX platform.
We are using Debian 10 Linux distro for this tutorial.
We have chosen the c4 family instance type for this tutorial which has 4vCPU's,7.5GiB ram, but the recommended requirements for OpenDAX are 12GiB and 8 vCPU's,
We don't need any advanced VM configuration, so leave it to default and move to the next step
We are attaching 200GB standard storage to the VM for handling large OpenDAX project files.
Leave steps 5 and 6 to default for right now and review VM configuration for launching.
Authentication will be done using SSH key pairs. Users who have already used AWS services already have a key pair. New users have to create a new one.
We are creating a new pair named opendax for this tutorial. Download the key pair; it will be in the format .pem.
Save the pair on the local computer project folder and click on launch instances.
Now the Instance/VM would be running and would have a public IP assigned(This one has 3.133.134.172)
To make the OpenDAX platform available to users. The AWS EC2 instance has to be mapped to a domain (www.example.com) which users will reach. There are many domain registrars available like GoDaddy, NameCheap, Hostgator, which provide domain names at easy rates. We are choosing Namecheap for this tutorial.
Setting up a domain is easy with NameCheap search for the desired domain name and buy. The domain will be activated just after the payment is made.
We have bought an OpenDAX testing domain called www.testopendax.xyz, which is active and running.
For connecting the domain to AWS, we have to create elastic IPs and hosted zone.
Creating an Elastic IP
Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/. In the navigation pane, choose Network & Security, Elastic IPs.
Creating a Hosted Zone
Open the Route 53 console at https://console.aws.amazon.com/route53/ with your signed-in AWS account, and in the navigation pane, choose Hosted zones and create a hosted zone.
It will redirect to a dialog where it will require a registered domain name and type. We will enter the domain we bought, and the public hosted zone as a type.
Once the hosted zone is created, AWS will automatically create NS(Nameservers) and SOA records by default. In the below screenshot NS record in the value pane contains four nameservers which we will add to Namecheap Domain settings for routing. But before that, we have to add an A-type DNS record for connecting the Namecheap Domain to Elastic IP associated with the EC2 instance.
To create a new A-type DNS record, click on the orange create record button on the upper right. See the screenshot below.
Clicking the create record button will require you to enter the record name here; we are adding www to the existing domain name. For value, we will be entering the Elastic IP associated with the EC2 instance. All other settings stay default.
For connecting the domain to the AWS, we have to add the AWS name servers as a custom DNS* in the Namecheap domain settings. For instructions, follow this guide from Namecheap.
Here is a screenshot of adding AWS nameservers in Namecheap domain settings.
*Changes might take 24-48 hrs to reflect.
Once the droplet is set up, and the domain is connected to the instance. We have to start the deployment of OpenDAX on the instance.
For accessing the Amazon EC2 instance, we are using an SSH tool called Putty client. Download the latest version here and follow this guide to securely SSH into AWS EC2 instance. Once you are successfully done connecting SSH keys and open an SSH client session using Putty
You will see a console window asking you to login with a Debian user name. By default, the user name is determined by the AMI that was specified when you launched the instance.
ec2-user
.centos
.admin
.ec2-user
or fedora
.ec2-user
or root
ec2-user
or root
.ubuntu
.Since we are using Debian, we will log in as admin
For installing OpenDAX components on the Debian distribution, we require root access.AWS does not allow
root access by default, as shown in the screenshot below.
We will first login as admin and enable SSH as root on AWS Debian using this small guide here. The guide works on all Linux distributions.
Once you have successfully logged in to the EC2 instance with the root user directly, you will see a console window indicating root access like the below screenshot.
We highly recommend installing using docker and docker-compose from the below links if you are using a different Linux distribution.
Docker Installation instructions
Docker Compose Installation Instructions
But If you are using Debian, execute these commands in order.
1. Update the `apt` package index and install packages to allow `apt` to use a repository over HTTPS:
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
2. Add Docker’s official GPG key:
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
3. Command to set up the stable repository.
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
4. Update the `apt` package index, and install the *latest version* of Docker Engine and containerd,
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io
Once all the above commands are successfully executed. Run this command to check if docker is properly installed.
docker ps
You should see the following result.
1. Run this command to download the current stable release of Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.28.5/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
2. Apply executable permissions to the binary:
sudo chmod +x /usr/local/bin/docker-compose
For example:
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
3. Test the installation.
$ docker-compose --version
docker-compose version 1.28.5, build 1110ad01
Here is the output of all commands
OpenDAX is build using Ruby programming language, which has to be installed before cloning the OpenDAX repository.
Instructions
1. Dirmngr package has to be installed to add Ruby's GPG key
sudo apt-get install dirmngr
2. Add Ruby's GPG Key
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
3. Get Ruby Version Manager(RVM) using the below command
curl -sSL https://get.rvm.io | bash -s stable
Clone the OpenDAX repository using the following command
git clone https://github.com/openware/opendax.git
After successful cloning, The output would be -
1. Close and restart the terminal window for Ruby Installation to take effect.SSH into instance and navigate into Opendax directory using the command-
cd opendax
Once you navigate to the opendax directory, It will ask you to install ruby version 2.6.6,
2. Install Ruby 2.6.6 and Bundler 2.1.4 package for installing OpenDAX ruby packages.
Command for Ruby
rvm install "ruby-2.6.6"
Command for Bundler
gem install bundler:2.1.4
Console Summary -
1. Make sure you are in the OpenDAX directory to install OpenDAX dependencies using the following command
bundle install
1. In the opendax directory, navigate to the config folder using
cd config
and edit the app.yml using
nano app.yml
2. app.yml will look something like this
There are many variables to configure here, such as images,finex, and KYC, for better functionality, but for this tutorial, we will only configure the essential ones to get the platform started.
Fields such as the domain, subdomain, and SSL has to be configured for this tutorial.
domain: testopendax.xyz (your domain name)
subdomain: www
ssl
enabled: true
Make changes to the file by hitting CTRL+X, typing y, and clicking enter.
Now OpenDAX components are ready to start with defined configuration.
Before starting the OpenDAX components, Allow AWS EC2 Instance to accept all incoming connections through security groups so we can visit the frontend of OpenDAX from the internet.
1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/. In the navigation pane, choose Network & Security, Security Groups
2. Click on the security group name associated with the EC2 instance.
3. Click on edit inbound rules; by default, SSH at port 22 is allowed. Add new rule of type all traffic, source anywhere, and click on save rules.
Now, Navigate back to the Opendax directory using the command.
cd -
Fire all the OpenDAX dependencies using
rake service:all
This will take up to a minute or two.
After completion of the command, the terminal output would look something like this.
To open the OpenDAX UI. Enter the registered domain(www.testopendax.xyz) in the browser.OpenDAX platform would be fully functional and accessible.
Login with the given email and password or use the following default users for the demo.
Email: [email protected], password: 0lDHd9ufs9t@
Email: [email protected], password: Am8icnzEI3d!