# YaK Demo

dbi services makes free demo environments available to all, so that you can play with the YaK and deploy instances and components to Azure and AWS.\
The Yak Demo environment is hosted on one of dbi services AWS tenants and is automatically destroyed **after 4 hours**.

{% hint style="danger" %}
_The demo environment is not supposed to be used for production purpose (it’s just a demo and everything is scrubbed after 4 hours)_

_dbi services shall not be held liable for any data loss on this demo environment_
{% endhint %}

## Wanna give it a try?

To do so, simply connect to [https://yak4all.io/demo/](https://yak4all.io/demo/), fill in the form and you will receive a confirmation email from **no-reply@dbi-services.com**.

Please allow 5 to 10 minutes for the environment to be provisioned and the YaK to spin up. Once up and running you'll receive a second email from **no-reply@demo.yak4all.io** with the URL to connect to your YaK.

Check your inbox and junk mail to make sure you don't miss out on your YaK experience!

### Limitations

The demo environment we provision comes with the following restrictions (this will not be the case with a regular installation of YaK):\


AWS infrastructure:

* **Available shapes**: t3.micro, t3.small, t3.medium
* **Available disk types:** gp2, gp3
* **Disk sizes:** max 50gb
* **Available component:** PostgreSQL
* **AWS Region:** eu-west-1

Azure infrastructure:

* **Available shapes**: Standard\_B2s, Standard\_B2ms
* **Available disk types:** Standard\_LRS, StandardSSD\_LRS
* **Disk sizes:** max 64gb
* **Available component:** PostgreSQL



## YaK Login Page

Open the link received and log into the YaK.

* Login: admin
* Password: ABCdef1234@

<figure><img src="https://2436296891-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMGFsptWcTlGb6Djq7qsZ%2Fuploads%2Fgit-blob-b9dc83c9accd5b35765d2050064ef9091960a0dc%2FYaK_login_page.png?alt=media" alt="" width="375"><figcaption></figcaption></figure>

## Where to start?

Alright, you're all set, your environment is ready. Let's give it a try!

We have pre-provisioned the YaK with a few things for you so that you can almost immediately deploy your servers and components:

* 2 infrastructures have been pre-provisioned:
  * An AWS demo infrastructure: **"aws-demo-1"**
  * A Microsoft Azure demo infrastructure: **"azure-demo-1"**&#x20;
* Cloud providers secrets have been attached to these infrastructures
* A PostgreSQL component type is available to you

## What you need to do now

Well, we've thought of a scenario, but feel free to explore the YaK on your own if you prefer.

Our use case here is to deploy a server to AWS or to Azure and then deploy a PostgreSQL database instance on it.

### 1. Declare a SSH key

In order to connect securely to the Linux servers once created, a pair of SSH keys must be generated and the **private key** must be transferred to the servers.

1. Generate your SSH key:

SSH keys can be generated from any Linux-based machine running openSSH with the "ssh-keygen" command.

Example:

```bash
$ ssh-keygen -b 4096 -m PEM -t rsa -f my-ssh-key -q -N ""
```

{% hint style="info" %}
Windows users can generate SSH keys using the PuTTYgen utility (see [appendix](appendix/create-ssh-keys-with-puttygen))
{% endhint %}



2. Copy the content of the **private key** file:

```bash
$ cat my-ssh-key
##This is just an example, generate your own private key

-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABASDILVb1
MiZ78g848c6Dk6KYwkJZXloSIruLe+Sid0Xd+Lb1rAxbwzAhXWRMzzBT5k3WciXk2fMhUD
p4YSahpYvquZK950aXiZNDOJpKZP8wjf4g4nQyiJZ/0G0J9mIaI2h/fr8TA67KHYtu/Eyf
PN9bKJwII3aiGlu5/Viq2cgYT8jJ01AK8cY3tSqKdlrN2GyxllBFl42QplbxA2USPJ1E6v
VIjtbmJjdz[...........................................]qAc4HxP02t/N2ZN
q+dDNWeShfVz4zjApPQCzdiGqLAlzUy67KNxQgljhaOEaYTQgrLE8XNGsIFNZwGvsEo/xZ
XnN2p
-----END OPENSSH PRIVATE KEY-----
```

3. Feed the YaK with the SSH key:
   * From the menu, navigate to **Configuration** -> S**ecrets**
   * Click "**Declare**"
   * Give a name to your secret (my-ssh-key)
   * Select "**ssh key**" as secret type
4. Paste the entirety of the **private key** previously copied, into the corresponding field of the form
5. Click "**Save**"

### 2. Attach your SSH key to the infrastructure <a href="#id-2.-attach-your-ssh-secret" id="id-2.-attach-your-ssh-secret"></a>

* From the menu, navigate to "**Infrastructures**"
* Select the infrastructure you would like to deploy to in the list (**"aws-demo-1"** or **"azure-demo-1"**)
* Click the "**Action**" button
* Click "**Attach secret**"
* Select the SSH secret created in the previous step from the list
* Click "**Attach**"

### 3. Declare a server <a href="#id-3.-declare-a-server" id="id-3.-declare-a-server"></a>

* Navigate to the "**Servers**" menu
* Click "**Declare**"
* Give it a name
* Select the **Infrastructure** to deploy your server to (**"aws-demo-1"** or **"azure-demo-1"**)&#x20;
* Select an **Image** to install : let's take Debian 12 for example
* Select a server **Shape**
* Add custom tags as per your need (optional)
* Network section:
  * Mode: **automatic**
  * IP: **leave blank**
  * Scope: **public**
  * Tick the "Admin access" checkbox: this defines the IP address used to connect to the server for configuration purpose.
* Click **Save**

{% hint style="warning" %}
In Azure, VM names must be unique. Since we're all sharing the same demo environment, avoid instance names that are too obvious and could conflict with other users' machines, such as “srv01”, ‘server1’, “myserver”, etc.\
Be creative to avoid potential conflicts with other users 😉
{% endhint %}

### 4. Deploy your server <a href="#id-4.-deploy-server" id="id-4.-deploy-server"></a>

* Select your server in the list
* Click "**Deploy**" from the "**Actions**" menu
* Confirm "**Deploy**" in the pop up box
  * Follow the deployment steps from the Jobs menu to see what the YaK is doing behind the scene. If you've followed the steps it should succeed (if not you must have missed something :smile:)
* Wait until the job status is **"Successful"**
* Your server should be automatically started and is now in a **"running"** state
  * You should already be able to connect to it via SSH by selecting the server and retrieving the **public IP** from the server parameters. (see step "[connect to your server](#id-7.connect-to-server)")
  * But hold your horses! Let's deploy a component on it! (if you can't wait, skip the component deployment and come back to it later, that's OK)

### 5. Declare your component <a href="#id-5.-declare-component" id="id-5.-declare-component"></a>

* Navigate to the "**Components**" menu
* Click "**Declare**"
* Give it a name (ex: PG01)
* Select your component type (postgresql\_instance)
* Select your subcomponent type (standalone)
  * HA requires 3 servers be deployed, in this example we will consider a **standalone** setup as we have declared 1 server only
* Choose your Provider (here it will be **aws** or **azure**)
* Select the **PostgreSQL host** where you want to deploy your database instance (the server created previously)
* Fill in the **"Instance name"** field (ex: mypgdb)
* Navigate to the **"Storage"** tab and fill in the required fields.
  * Set **Max size of component disks** for the 3 file systems:
    * /u01 -> **40GB**
    * /u02 -> **20GB**
    * /u90 -> **20GB**
* Click "**Save**"

### 6. Deploy your component <a href="#id-6.-deploy-component" id="id-6.-deploy-component"></a>

* Your PostgreSQL database instance is configured, now let's deploy it:
  * Select the component you've just configured from the list
  * Click "**Actions**"
  * Then click **"Deploy a new PostgreSQL Standalone instance"**
  * Confirm your choice in the pop-up menu
  * Seat back, relax, follow the deployment steps from the **jobs** menu and wait until your component is successfully installed and configured.

### 7. Connect to your server and play around <a href="#id-7.connect-to-server" id="id-7.connect-to-server"></a>

* Open a SSH connection to the **public IP address** of your server:

```bash
DEMOUSER@demo$ ssh -i my-ssh-key <user>@<PUBLIC_IP>
```

* Your public IP address can be retrieved from **Servers** -> **Parameters**
* User:
  * **Azure** default user is **azureuser**
  * **AWS** default users:
    * The default user for debian based AMI is "**admin**", but this could be something else, based on the AMI you selected:&#x20;
      * For an Amazon Linux AMI, the username is `ec2-user`.
        * For a CentOS AMI, the username is `centos` or `ec2-user`.
          * For a Debian AMI, the username is `admin`.
          * For a Fedora AMI, the username is `fedora` or `ec2-user`.
          * For a RHEL AMI, the username is `ec2-user` or `root`.
          * For a SUSE AMI, the username is `ec2-user` or `root`.
          * For an Ubuntu AMI, the username is `ubuntu`.
          * For an Oracle AMI, the username is `ec2-user`.
          * For a Bitnami AMI, the username is `bitnami`.

{% hint style="info" %}
Reference : [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-users.html](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-users.html)
{% endhint %}

* Play with your PostgreSQL database instance!

```bash
admin@my-server1:~$ sudo su - postgres


 PostgreSQL Clusters up and running on this host:
 ----------------------------------------------------------------------------------------------
    mypgdb      ->  /u02/pgdata/17/mypgdb                                    ->  5432  ==> OPEN

 PostgreSQL Clusters NOT running on this host:
 ----------------------------------------------------------------------------------------------

16:39:13 postgres@my-server1:/home/postgres/ [pg17.2] psql -p 5432
psql (17.2 dbi services build)
Type "help" for help.

postgres=#
```
