Multi-tenant database architecture

For SaaS solution, we need to cater many customers database with a single code base application

There are several type of multi-tenant architecture for database.

  1. different database
  2. shared database server but different schemas (or “database”)
  3. shared database and shared schemas

Some further readings

  1. https://web.archive.org/web/20110311185417/http://msdn.microsoft.com/en-us/library/aa479086.aspx
  2. https://www.mysql.com/products/cluster/ -partition/shards

Sell Like Crazy Summary Notes

The money in business isn’t in your product or service, it’s in the selling of your product or service.

As a business owner, selling should be your number one priority – and you must act accordingly. This means spending the bulk of your time on marketing and sales-related activities.

The market doesn’t pay you to have the best products or service. It rewards you for solving problems.

Phase 1: Understand and identify your deam buyer

Phase 2: Create the perfect bait for your dream buyer

Offer valuable information – High Value Content Offer (HVCO) like free reports, e-books, videos, cheat sheets, info graphic etc. (119)

Write attention-grabing headline (122)

Phase 3: Capture leads and get contact details

The single purpose of the opt-in page is to get people give their contact in exchange for high value content offer (HVCO)

Checklist to create a killer opt-in page (138)

Phase 4: The Godfather strategy

17-steps secret selling system

Phase 5: Traffic

Calculate the cost-per-acquisition (CPA). Must be less than whatever we get for one customer.

Keep adding as many channels as you can to increase traffc and sales

Phase 6: The magic lantern technique

Provide sequence of content to build trust and to reduce skeptical. Prepare your audience to buy when the time is right

Phase 7: Sales conversion

Sales flow on the sales page (276)

Phase 8: Automate and multiply

Codeigniter bulk insert to database

If you are to insert hundreds or thousands of records, please use bulk insert. Avoid call insert query in loop.

$data = array(
   array(
      'title' => 'My title' ,
      'name' => 'My Name' ,
      'date' => 'My date'
   ),
   array(
      'title' => 'Another title' ,
      'name' => 'Another Name' ,
      'date' => 'Another date'
   )
);

$this->db->insert_batch('mytable', $data); 

There will be limit to how many records can be added at one go.

Some limitations

  1. Limit to 1000 records per insert statement
  2. Check the settings for max_allowed_packet, bulk_insert_buffer_size, key_buffer_size

Generate android bundle/apk for ionic mobile app

  1. open terminal
  2. go to project directory
  3. run – npm update
    1. to make sure all components imported added first
  4. run – ionic build
    1. this will build files in web directory (normally www)
  5. run – ionic cap add android
    1. android directory will be created in ionic project
  6. run – “ionic cap copy android” to copy to android native project. this to run everytime you run “ionic build” to copy latest files to native android project
  7. run – ionic cap open android
    1. will open android studio
    2. this will take quite some time for android to build
  8. in android studio. Go to Build > Build Bundle(s)/APK
  9. APK willl be generated. Click on Locate to show the apk file

Optional

  1. optional – run – ionic cap sync – if you download any plugin to be used in the app

Other notes

  1. I faced issue the “Build Bundle(s)/APK(s)” and “Generate signed Bundle/APK” did not appear in the menu.
  2. To settle this issue, go to Android Studio > Preferences > Appearance and Behavior > System Settings > Android SDK. Choose SDK Tools tab. Tick on SDK Build-Tools and Android SDK Command-line Tools. Then click Apply. Agree to the terms and proceed.

Reference:

  1. https://ionicframework.com/docs/angular/your-first-app/6-deploying-mobile
  2. https://ionicframework.com/docs/developing/android

Add slack notification on gitlab push

How to add slack notification everytime there is push or other activities on selected git repository

  1. Get slack incoming webhook url for a particular channel here
    https://yourslackorganization.slack.com/apps/A0F7XDUAZ-incoming-webhooks (or try search on google to get the page).
  2. Open any gitlab project. Choose settings > integrations. Choose slack notification. Paste the webhook URL and set username (name to send notification in channel)
  3. Click the test button to see if the integration works.
  4. That’s it

Git deploy on runcloud using gitlab

  1. On Runcloud – Get the deploy key in “Deployment Key” for user for the respective web app
  2. On Gitlab – Update deployment key in Settings > Repository > Deploy key
  3. On Runcloud – On the Web Application screen, click on Git to set Git service, repository and branch to clone/pull and click the button at the bottom
  4. Copy the webhook URL
  5. On Gitlab – Update webhook URL in Settings > Webhooks
  6. You are done!

Additional notes on what to change before can use this method (for codeigniter)

  1. Add checking server/localhost to set base_url in config/config.php
  2. Edit path for session files in config/config.php
  3. Add checking to set database to be used in config/database.php