Drabkirn Logo Header

Drabkirn

Docs

Welcome to our docs. Whether you want to use our APIs, know the inner workings of our applications, or just anything, you've come to the right place. Let's learn and improve together.


Table of contents


  1. Introduction
    1. About Us
  2. Desityle
    1. Usage
    2. Development Installation
  3. Feedka
    1. Usage
    2. Development Install - Server
    3. Development Install - Docker
    4. Production Install - Server
    5. Production Install - Docker


Introduction

About us

Create the world out of the things that you build. We build those things and will set them free. We also write thoughts and much more.

Our mission is to connect and build a free, open, and privacy-respected open-source world that can improve humans life and beyond. We believe in our saying, Human’s power is their power, and not the brand’s power.“


Our vision is to empower every person on this planet (and beyond) to use free, open and privacy-respected solutions, and we intend to connect with them to spread happiness.


We know our motto, mission, and vision are vague, but hey, does that even matter? Let’s dive in straight on what we’ve got for you:


Desityle

Desityle is a sleek and straightforward DIY CSS framework built from scratch with DIY(Do It Yourself) concept in mind.

Usage

You’ve made an excellent decision to give desityle a try. It’s super-duper easy to integrate desityle in your websites.


  1. Using CDN:

    • Just include our CSS and JS CDN files in your index.html(or any other .html file):

      html<link rel="stylesheet" href="https://unpkg.com/desityle@1.1.5/build/css/desityle.min.css" />
      
      <script src="https://unpkg.com/desityle@1.1.5/build/js/desityle.min.js"></script>
      


  2. Using in React or other JS Libraries/Frameworks:

    • First, install desityle using NPM or Yarn:

      bash$ yarn add desityle@1.1.5
        # or
      $ npm install desityle@1.1.5 --save
      
    • Then Import in your libraries:

      javascriptimport 'desityle/build/css/desityle.min.css';
      
    • Currently, there is no way to import JS using libraries/framework; we’re actively working on it.


Development Installation

You can contribute to this project, but first, you’ll need to set up your machine.


  1. Clone this repo and cd into it:

    bash$ git clone https://github.com/drabkirn/desityle.git
    $ cd desityle
    
  2. Install all dependencies:

    bash$ yarn install --check-files
    
  3. All our source code is located in src/ folder.

    bash$ cd src/
    
  4. Make changes or tweak some bugs in this folder, meanwhile you can run a simple server to see your changes:

    bash# Example, to start on localhost:3002 or YOUR_IP:3002
    $ python -m SimpleHTTPServer 3002
    
  5. After making changes, you can look the final look of your changes by building the app. We use gulp under the hood. This is exactly what our production users will see:

    bash$ yarn build
      # or
    $ npm run build
    
  6. Serve you app from the build/ folder created by the above command.

    bash$ cd build
      # Example, to start on localhost:3002 or YOUR_IP:3002
    $ python -m SimpleHTTPServer 3002
    
  7. When you think eveything is right and working smooth and well, you can checkout our contributing guide to make a pull request.


Feedka

Feedka is an open-source web application that can serve as a platform to get authentic, kindful, and constructive feedback from your friends, family, and co-workers. We’re all on the same boat in just our own different ocean. Let us all get better together.

Usage

If you want to test the waters first, then you can visit the Feedka website and see it in working.


You get started by creating an account, you can then share your unique link with your friends, family, and co-workers. The bottom line points are:


  1. All the feedback you receive is completely anonymous. The person who gives you feedback doesn’t need to signup or submit any kind of identity. It will be just a form field for feedback.
  2. Whenever someone submits you the feedback, you won’t receive it right away. You’ll receive that feedback anytime within 10 minutes to 5 hours. This helps to keep the identity of the person anonymous.
  3. We use Azure Content Moderation to flag abuse and Personal Identifiable Information(PII) and block such feedbacks from reaching you.
  4. You’ll also be able to make feedbacks for the public to see if you want to.
  5. If the feedback is blocked, the person can even submit a report that there is something wrong with the system’s flag. These reports can be seen by the admin at /admin UI. If the admin finds it appropriate, then the admin can send the feedback to the respective user.
  6. All other reports that users submit can also be seen at /admin UI. All these other reports are assigned to the admin user only.
  7. For improved security, you can add Two Factor Authentication(2FA) from your settings, and all your feedbacks are server-side encrypted.


Development Install - Server

  1. For our entire tech stack, see our GitHub repository.
  2. You must have Ruby version 2.7.1 and Rails 6.0.2.2 installed. You can install them using GoRails Setup Guide.

    • You can install Rails 6.0.2.2 with:

      bash$ gem install rails -v 6.0.2
      
  3. We use MySQL as our database. You can install the same from DigitalOcean’s MySQL Setup Guide

  4. You’ll also need Redis, so you can install the same from their official website

  5. That’s it, all prerequisites are now installed. Next, clone the repository and install the dependencies.

    bash$ git clone https://github.com/drabkirn/feedka.git
    
    $ cd feedka
    
    $ bundle i
    $ yarn install --check-files
    
  6. Rails credentials re-setup:

    • There is a config/credentials.yml.enc file, but this repo doesn’t have the master.key, so delete this file:

      bash$ rm config/credentials.yml.enc
      
    • Now to create your new rails credentials:

      bash$ EDITOR=nano rails credentials:edit
      
    • Now, press ctrl + X, then press Y and then press Enter to exit the nano editor. You don’t have to change anything in your credentials, as we use figaro gem for our credentials. Rails credentials is only needed for secret_key_base.

  7. Setting up the environmental variables with Figaro:

    • Copy the config/application-sample.yml to config/application.yml

      bash$ cp config/application-sample.yml config/application.yml
      
    • Now, let’s work on each environmental variable in development: group of config/application.yml:

    • db_hostname, db_username, db_password, db_name: Your database credentials to connect the app with the database.

    • app_hostname: This should be only the domain of your app. The value could be "localhost" or "192.168.1.1" or "abc.com". Don’t add any Slashing trails.

    • app_port: If your app is hosted on a separate port, then mention it here. Or else leave it blank. This could be 3000.

    • app_base_domain: This is the base URL of the application, which includes protocol. This could be "http://localhost:3000" or https://abc.com. Don’t add any Slashing trails.

    • c_name: In long, company name. We use this name to refer to Company Name Feedka. This value could be "Drabkirn" or "ABC"

    • admin_username: For security purposes, we don’t make the first user signing up as admin. So put the username of the admin that you’ll have after deploying and creating your admin user. This value could be "admin".

    • mailer_from_address: Your email address that the devise mailer should use when sending the emails. This could be "admin@feedka.xyz".

    • devise_secret_key and devise_pepper_hash: This is a random secret that is used by devise to keep our data secure. We will generate this from securerandom. In your terminal, open irb and then run:

      bash$ irb
      
      ## In IRB
      require "securerandom"
      
      SecureRandom.hex(64)
      #=> "9f7b16e6c92f25184ef7e0698eecb295f04c1ea3bb96456d25a577eed3ba27eed831a41ae303cbc959fdf08b43fc1f43420689b0557ff95d57e53710c85cd891"
      
      SecureRandom.hex(64)
      #=> "9f7b16e6c92f25184ef7e0698eecb295f04c1ea3bb96456d25a577eed3ba27eed831a41ae303cbc959fdf08b43fc1f43420689b0557ff95d57e53710c85cd891"
      
      exit
      
    • Put the results of SecureRandom.hex(64) in each devise_secret_key and devise_pepper_hash

    • encrypt_key: This key is used to encrypt the feedback in the database. To generate this, open irb like above and then run SecureRandom.hex(16), then paste the result of this in encrypt_key value.

    • REDIS_URL: The value of this should be "redis://localhost:6379/1". This is by default on which redis will run. If you have another URL, then you can change this.

    • content_moderation_url: If you don’t want to use content moderation then leave this and next content_moderation_api_key as blank (Which is not recomended). To make it working, You’ll need to signup for a free Azure account, and Content moderation has a free tier. So go to Azure portal –> New Resource –> Search for “Content Moderation” in the marketplace –> Create –> Give it a unique name, choose the Central India region and choose your pricing tier –> Create. Wait for few seconds for the process to finish. Now this value should be "https://centralindia.api.cognitive.microsoft.com/contentmoderator/moderate/v1.0/ProcessText/Screen?autocorrect=true&PII=true&classify=True"

    • content_moderation_api_key: In the above created Azure resource, goto Keys tab from the left pane and then copy one of the keys and paste it here.

    • Finally, your config/application.yml file’s development section must look like this:

      yamldevelopment:
        db_hostname: "localhost"
        db_username: "root"
        db_password: "1234"
        db_name: "feedka_development"
      
        app_hostname: "localhost"
        app_port: "3000"
        app_base_domain: "http://localhost:3000"
        c_name: "ABC"
        admin_username: "abcd"
      
        mailer_from_address: "abcd@localhost.com"
      
        devise_secret_key: "9f7b16e6c92f25184ef7e0698eecb295f04c1ea3bb96456d25a577eed3ba27eed831a41ae303cbc959fdf08b43fc1f43420689b0557ff95d57e53710c85cd891"
        devise_pepper_hash: "9f7b16e6c92f25184ef7e0698eecb295f04c1ea3bb96456d25a577eed3ba27eed831a41ae303cbc959fdf08b43fc1f43420689b0557ff95d57e53710c85cd891"
      
        encrypt_key: "caa3f43897a1c31a87598a30f9ef04f0"
      
        REDIS_URL: "redis://localhost:6379/1"
      
        content_moderation_url: "https://centralindia.api.cognitive.microsoft.com/contentmoderator/moderate/v1.0/ProcessText/Screen?autocorrect=true&PII=true&classify=True"
        content_moderation_api_key: "YOUR KEY"
      
  8. Setup and migrate the database. In your terminal run:

    bash$ rails db:create
    $ rails db:migrate
    
  9. Running the services:

    • Open up a new terminal to run the redis(if it’s not already running), this will fireup the redis server on localhost.

      bash$ src/redis-server
      
    • We use foreman gem for running multiple services in just one terminal. To install it run:

      bash$ gem install foreman
      
    • Now we’ll fire up our rails server on port 3002, webpack dev server on port 3003 and sidekiq using:

      bash$ foreman start -f Procfile.dev
      
    • Now you can see your app running on http://localhost:3002 or http://YOUR_IP:PORT


Development Install - Docker

  1. For our entire tech stack, see our GitHub repository.
  2. To run the following setup, you must have docker and docker-compose install.
  3. First, clone our repository and then cd into it:

    bash$ git clone https://github.com/drabkirn/feedka.git
    
    $ cd feedka
    
  4. Setting up the environmental variables with Figaro:

    • Copy the config/application-sample.yml to config/application.yml

      bash$ cp config/application-sample.yml config/application.yml
      
    • To know the details of these environmental variables - See Above

    • Finally our config/application.yml file’s development section should look something like this (Make sure db_hostname is set to mysql):

      yamldevelopment:
        db_hostname: mysql
        db_username: root
        db_password: root
        db_name: feedka_development
      
        app_hostname: "localhost"
        app_port: "3000"
        app_base_domain: "http://localhost:3000"
        c_name: "ABC"
        admin_username: "abcd"
      
        mailer_from_address: "abcd@abcd.com"
      
        devise_secret_key: "340a68e75c7350a8cdfe7c107ce0cfda7390b7521680b2b8c6afa88f1df149eec77b4bd6700d30b814e34a3bb6362a2c5a7d4097dafada224f57d377511d483c"
        devise_pepper_hash: "2f908a14f1d8ec51fe79349fad8796a96c3321eae7ade3d5c4510250d82b45874ed7364758800a489ce503dc35e2f23dc04f560b56ed3b51d0c766770513c4f3"
      
        REDIS_URL: "redis://redis:6379/1"
      
        encrypt_key: "19c979eefc45bc4a712a6ca1e0dfacd5"
      
        content_moderation_url: "https://centralindia.api.cognitive.microsoft.com/contentmoderator/moderate/v1.0/ProcessText/Screen?autocorrect=true&PII=true&classify=True"
        content_moderation_api_key: "YOUR KEY"
      
  5. We have docker-compose.yml and corresponding Dockerfile in the repo which will configure gems, redis server, MYSQL DB and webpacker. All you’ve to do is just run few commands:

    bash$ docker-compose build
    
    $ docker-compose run web rails db:setup
    
    $ docker-compose run web rails db:migrate
    
    $ docker-compose run web bundle exec rake assets:precompile
    
    $ docker-compose up
    
    • If the docker-compose run web rails db:setup command fails, then wait for 30 seconds and retry. This happens because mysql image takes little time to load.
  6. Now you can see your app running on http://localhost:3000 or http://YOUR_IP:PORT

    • If you want to change the port, you can do so in docker-compose.yml file. But for this, you’ll need to do docker-compose down and then run docker-compose up -d to restart the servers.


Production Install - Server

  1. For our entire tech stack, see our GitHub repository.
  2. You must have Ruby version 2.7.1 and Rails 6.0.2.2 installed. You can install them using GoRails Setup Guide.

    • You can install Rails 6.0.2.2 with:

      bash$ gem install rails -v 6.0.2
      
  3. We use MySQL as our database. You can install the same from DigitalOcean’s MySQL Setup Guide

  4. You’ll also need Redis, so you can install the same from DigitalOcean’s Redis Setup Guide

  5. That’s it, all prerequisites are now installed. Next, clone the repository and install the dependencies.

    bash$ git clone https://github.com/drabkirn/feedka.git
    
    $ cd feedka
    
    $ RAILS_ENV=prodcution bundle i
    $ RAILS_ENV=prodcution yarn install --check-files
    
  6. Rails credentials re-setup:

    • There is a config/credentials.yml.enc file, but this repo doesn’t have the master.key, so delete this file:

      bash$ rm config/credentials.yml.enc
      
    • Now to create your new rails credentials:

      bash$ EDITOR=nano rails credentials:edit
      
    • Now, press ctrl + X, then press Y and then press Enter to exit the nano editor. You don’t have to change anything in your credentials, as we use figaro gem for our credentials. Rails credentials is only needed for secret_key_base.

  7. Setting up the environmental variables with Figaro:

    • Copy the config/application-sample.yml to config/application.yml

      bash$ cp config/application-sample.yml config/application.yml
      
    • To know the details of these environmental variables - See Above, but this time work on production: section of the application.yml file.

    • In addition to above environment variables, We’ll add Sendgrid to send emails in production for user authentications. For for sendgrid environment variables:

    • sendgrid_api_key: We use sendgrid to send emails. It’s free and allows upto 100 emails/day. So signup for an sendgrid account, Go to Settings –> API Keys –> Create a New Key –> Give a friendly name to your API –> Choose Restricted Access option –> Tick the Mail Send option from it(We will use sendgrid only to send mails) –> Create API. Now copy the API key and put it here. This value should be something like this "SG.xxxxx"

    • sendgrid_domain: You might have connected your domain with sendgrid to whitelist your email domain. You can use this guide to learn more. If you’ve not set it up, leave it blank. This value could be "abc.com"

    • That’s it, all your environmental variables are configured. Finally, your config/application.yml file’s development section must look something like this:

      yamlproduction:
        db_hostname: localhost
        db_username: root
        db_password: root
        db_name: feedka_development
      
        app_hostname: "localhost"
        app_port: "3000"
        app_base_domain: "http://localhost:3000"
        c_name: "ABC"
        admin_username: "abcd"
      
        mailer_from_address: "abcd@abcd.com"
      
        sendgrid_api_key: "SG.xxxx"
        sendgrid_domain: "abcd.com"
      
        devise_secret_key: "340a68e75c7350a8cdfe7c107ce0cfda7390b7521680b2b8c6afa88f1df149eec77b4bd6700d30b814e34a3bb6362a2c5a7d4097dafada224f57d377511d483c"
        devise_pepper_hash: "2f908a14f1d8ec51fe79349fad8796a96c3321eae7ade3d5c4510250d82b45874ed7364758800a489ce503dc35e2f23dc04f560b56ed3b51d0c766770513c4f3"
      
        REDIS_URL: "redis://localhost:6379/1"
      
        encrypt_key: "19c979eefc45bc4a712a6ca1e0dfacd5"
      
        content_moderation_url: "https://centralindia.api.cognitive.microsoft.com/contentmoderator/moderate/v1.0/ProcessText/Screen?autocorrect=true&PII=true&classify=True"
        content_moderation_api_key: "YOUR KEY"
      
  8. Setup and migrate the database. So run the following commands in your terminal:

    bash$ RAILS_ENV=production rails db:create
    $ RAILS_ENV=production rails db:migrate
    
  9. For production environment you should consider using something like Passenger for Ruby to handle your web app requests. You can Install and setup this app easily by following Passenger documentation.

  10. Also, consider getting an SSL certificate from Lets Encrypt. You can do this using DigitalOcean’s SSL Setup for Apache or SSL setup for Nginx guide.


Production Install - Docker

  1. For our entire tech stack, see our GitHub repository.
  2. To run the following setup, you must have docker and docker-compose install.
  3. First, clone our repository and then cd into it:

    bash$ git clone https://github.com/drabkirn/feedka.git
    
    $ cd feedka
    
  4. Setting up the environmental variables with Figaro:

    • Copy the config/application-sample.yml to config/application.yml

      bash$ cp config/application-sample.yml config/application.yml
      
    • To know the details of these environmental variables - See Above

    • Finally our config/application.yml file’s production: section should look something like this (Make sure db_hostname is set to mysql):

      yamlproduction:
        db_hostname: mysql
        db_username: root
        db_password: root
        db_name: feedka_development
      
        app_hostname: "localhost"
        app_port: "3000"
        app_base_domain: "http://localhost:3000"
        c_name: "ABC"
        admin_username: "abcd"
      
        mailer_from_address: "abcd@abcd.com"
      
        sendgrid_api_key: "SG.xxxx"
        sendgrid_domain: "abcd.com"
      
        devise_secret_key: "340a68e75c7350a8cdfe7c107ce0cfda7390b7521680b2b8c6afa88f1df149eec77b4bd6700d30b814e34a3bb6362a2c5a7d4097dafada224f57d377511d483c"
        devise_pepper_hash: "2f908a14f1d8ec51fe79349fad8796a96c3321eae7ade3d5c4510250d82b45874ed7364758800a489ce503dc35e2f23dc04f560b56ed3b51d0c766770513c4f3"
      
        REDIS_URL: "redis://redis:6379/1"
      
        encrypt_key: "19c979eefc45bc4a712a6ca1e0dfacd5"
      
        content_moderation_url: "https://centralindia.api.cognitive.microsoft.com/contentmoderator/moderate/v1.0/ProcessText/Screen?autocorrect=true&PII=true&classify=True"
        content_moderation_api_key: "YOUR KEY"
      
  5. We have docker-compose-production.yml and corresponding Dockerfile_production in the repo which will configure gems, redis server, MYSQL DB and webpacker. All you’ve to do is just run few commands:

    bash$ docker-compose build
    
    $ docker-compose run web rails db:setup
    
    $ docker-compose run web rails db:migrate
    
    $ docker-compose run web bundle exec rake assets:precompile
    
    $ docker-compose up
    
    • If the docker-compose run web rails db:setup command fails, then wait for 30 seconds and retry. This happens because mysql image takes little time to load.
  6. Now you can see your app running on http://localhost:3000 or http://YOUR_IP:PORT

    • If you want to change the port, you can do so in docker-compose.yml file. But for this, you’ll need to do docker-compose down and then run docker-compose up -d to restart the servers.

Back