logo

Frequently Asked Questions

1) How to remove existing infrastructure?


WARNING! AVOID REMOVING INFRASTRUCTURE USING GOOGLE CLOUD CONSOLE, BECAUSE IT WILL CORRUPT TERRAFORM STATE

In order to remove existing deployed infrastructure you can simply run the following command kite t destroy

This will result in a similar looking screen:

Destroy Process

This command will attempt to remove all the existing infra. It won't be applied unless you type yes

Please note there's also a possibility to destroy a separate module instead of destroying the whole infrastructure. To be able to achieve this you need to run the following command:

kite t destroy -target module.*module_you_want_to_destroy*

List of available modules for a destroy can be found by running the command:

kite t show

WARNING! ANY OF THIS OPERATIONS ARE PERFORMED AT YOUR OWN RISK AND CAN LEAD TO PLATFORM'S DOWNTIME!

2) How to install a separate Terraform module?


The process of applying a certain infrastructure module is similar to destroying a separate module In order to do so run the following command:

kite t apply -target module.*module_to_apply*

This will only create the module you've specified and any required dependencies for the module. For example: kite t apply -target module.mysql-db will create a CloudSQL instance and any required dependencies.

3) How to customize email templates ?


Email templates are defined in postmaster container. The default templates can be found here: https://github.com/openware/postmaster/blob/master/config/postmaster.yml

In order to modify them you just need to mount the modified file to your container. In docker-compose file this would look like this:

Postmaster Email Template

4) How to trigger emails on different events ?


In order to trigger emails on different emails you need to change postmaster configuration and add templates for those emails to postmaster: https://github.com/openware/postmaster/blob/master/config/postmaster.yml Using this example:

Postmaster Config Example

You can create your own email template and trigger mail sending on any of the events available on the links down below.

https://github.com/rubykube/barong/blob/master/docs/event_api.md https://github.com/rubykube/peatio/blob/master/docs/api/event_api.md

5) How to send an authorized API request ?


The simpliest way to send authorized requests is using HTTPie.

Here is an example on how to use HTTPie in few steps:

  1. First of all you need to login:

    http --session test_session POST https://www.example.com/api/v2/barong/identity/sessions email=*YOUR_EMAIL* password=*YOUR_PASSWORD*
    
  2. After that your session will be stored in test_session.

  3. You can do any request to your Peatio/Barong APIs:

    http --session test_session https://www.example.com/api/v2/peatio/account/balances
    
    http --session test_session https://www.example.com/api/v2/barong/resource/users/me
    

cURL can also be used.

Here is an example on how to use cURL in few steps:

  1. First of all you need to get _session_id and _barong_session, by running the following command:

    curl -i 'https://www.example.com/api/v2/barong/identity/sessions' -H 'Origin: https://www.example.com' -H 'Content-Type: application/json' --data-binary '{"email":"*YOUR_EMAIL*","password":"*YOUR_PASSWORD*"}'
    
  2. Find the headers set-cookie in the output and put values from those headers to your request as follows:

    -H 'Cookie: _session_id=*YOUR_SESSION_ID*;_barong_session=*YOUR_BARONG_SESSION*'
    
  3. You can do any request to your Peatio/Barong APIs:

    curl -i 'https://www.example.com/api/v2/peatio/account/balances' -H 'Origin: https://www.example.com' -H 'Cookie: _session_id=*YOUR_SESSION_ID*;_barong_session=*YOUR_BARONG_SESSION*' -H 'Content-Type: application/json'
    

6) How to safely clean Redis and can I do it since my project is in production?

If the deployment is made on Kubernetes and it's a production like environment, you can't really clean certain data in Redis, but you can reinstall it from scratch to purge all the data. To reinstall from scratch, please follow these steps:

  1. Find the release name of Redis by running helm ls
  2. Delete the current Redis release: helm delete --purge *release_name*
  3. Check if there aren't any PersistentVolumes left after the purge
kubectl get pv -n *backend_namespace*
  1. Reinstall Redis using the OPEX executable: bin/opex deps install redis