Monday, June 24, 2019

MySQL 7.0+ install create user.

Use the following command to create user

sudo mysql --user=root mysql

Login to mysql, you will see mysql prompt

CREATE USER 'user'@'localhost' IDENTIFIED by 'some_pass';



GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION;

 FLUSH PRIVILEGES;

EXIT

Friday, March 29, 2019

moodle mysql config change


[client] default-character-set = utf8mb4 [mysqld] innodb_file_format = Barracuda innodb_file_per_table = 1 innodb_large_prefix character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci skip-character-set-client-handshake [mysql] default-character-set = utf8mb4

we need to change the default storage engine to innodb and change the default file format to Barracuda, this is a new setting compared to previous versions. You also need to set innodb_file_per_table in order for Barracuda to work properly. Ref: https://dev.mysql.com/doc/refman/5.6/en/innodb-compression-usage.html
  • You should not need to make innodb the default storage engine anymore, the latest version of Moodle will select it automatically during install. It is always a good idea to make it default anyway. You do however need to set the default file format!

for more details follow https://docs.moodle.org/36/en/Step-by-step_Installation_Guide_for_Ubuntu

Thursday, October 11, 2018

Electron App

creating first electron app

mkdir helloworld
cd helloworld
npm init
npm install electron --save-dev --verbose
vim main.js
vim package.json
npm start

Wednesday, September 26, 2018

API convention to follow while wrting API.

API Convention
While creating API and providing it to the user please take care of following.
  1. Create or Update the documentation for the API.
  2. While adding new API documentation make sure it covers the following. 
    1. Request URL. Ex.  https://api.abc.com/admin
    2. Method: (get/post/put/delete/patch)
    3. Input parameters Ex.  {'firstname': firstname, 'lastname': lastname, 'email': email,  'password' : password}
    4. Encoding details if application. For ex. for few APIs the input parameters are URL encoded.
    5. API response. This could be pasted in the same page if not too big. Else can be posted in the form of jsonblob url (https://jsonblob.com/).
  3. Please consider the API development as completed only once the API is documented with above details in respective technical documentation
  4. For live products you should use api.domain.com .

Tuesday, August 7, 2018

SSL setup with cloudfront for ec2 instance in AWS



Kindly follow the following steps to setup cloudfront for ec2 instance.

Prerequisite: We considered, You have already setup ec2 instance which serve your site on http://

  • Once login to aws. Go to Cloudfront distribution. click on "create distribution"
  • Press "Get Started" button under the Web section.
  • In "Origin Domain name" provide your ec2 public dns name over there it could be like "ec2-ip.us-east-2.compute.amazonaws.com" .
  • In "Origin Protocol Policy" keep selected "HTTP only".
  • In "Viewer protocol policy" select "Redirect HTTP to HTTPS"
  • In "Allowed HTTP Methods" select the required radio button, going to use in your site. 
  • In "Cached based on selected request headers" select "Whitelist" from drop down box.
          - Select atleast following "Whitelist headers"
    • Host
    • Origin
    • Referrer
    • Authorization
    • CloudFront-Forwarded-Proto
  • In "Forward Cookie" select "All" from drop down.
  • In "Query string forwarding and caching" select "All" from drop down.
  • In "Compress object Automatically" select "Yes"
  • In "Alternate Domain Names", Enter your domain name,
  • In "SSL Certificate", Select "Custom SSL certificate" Radio button, and from next drop down, select your site certificate which you have already create through ACM.
  • Press "Create Distribution" button. It will create your cloudfront distribution. It will give public cloudfront domain name like "xyz.cloudfront.net".
  • Use this cloudfront domain name as CNAME in your DNS.