For Flutter newbie, who confuses about the template, libraries should use for an initial project

I use this template to set up the initial project. It uses necessary dependencies to start and something you should consider:

  • The app icon had been checked for distribution to stores.
  • Application clean structure
  • I18n had been set up and sample
  • App env approach tested with CI
  • Compatible with appcenter.ms, bitrise.io (just use appcenter/bitrise for ci, it’ll recognize automatically)
  • Example of how to use rest API
  • Example of how to use provider
  • Example…


Preparing source

  • Clone pancake-swap-core
git clone git@github.com:pancakeswap/pancake-swap-core.git
cd pancake-swap-core
git checkout -b factory 3b214306770e86bc3a64e67c2b5bdb566b4e94a7
yarn install
yarn compile
git clone git@github.com:pancakeswap/pancake-swap-periphery.git
cd pancake-swap-periphery
git checkout -b router d769a6d136b74fde82502ec2f9334acc1afc0732
yarn install
yarn add @uniswap/v2-core@"file:../pancake-swap-core"
yarn compile
git clone git@github.com:pancakeswap/pancake-swap-interface-v1.git
cd pancake-swap-interface-v1
git checkout -b v1 0257017f2daaae2f67c24ded70b5829f74a01b3c
yarn install

Setup

Install contract merger: https://www.npmjs.com/package/sol-merger

npm install sol-merger -g

Prepare PancakeFactory and PancakeRouter

sol-merger pancake-swap-core/contracts/PancakeFactory.sol ./build
sol-merger pancake-swap-core/contracts/PancakePair.sol ./build
sol-merger pancake-swap-periphery/contracts/PancakeRouter01.sol ./build
sol-merger pancake-swap-periphery/contracts/PancakeRouter.sol ./build


Config Server

nano /etc/zabbix/zabbix_server.conf===>Update DB information
nano /etc/zabbix/web/zabbix.conf.php
===>
# Update DB information, must be matched with server config above
....
# Integrate with server
ZBX_SERVER = '**your zabbix ip address or name**';
ZBX_SERVER_PORT = '10051';
ZBX_SERVER_NAME = '**your zabbix hostname**';
Example
$ZBX_SERVER = 'localhost';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'zabbix.nhancv.com';
sudo systemctl restart zabbix-server
sudo systemctl status zabbix-server
ps -ef | grep zabbix

Setup Agent

  • Access to vps agent -> Install zabbix-agent
wget https://repo.zabbix.com/zabbix/5.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.4-1+ubuntu20.04_all.deb
dpkg -i zabbix-release_5.4-1+ubuntu20.04_all.deb
apt update
apt install zabbix-agent
# If you enable firewall -> open ufw port…

  • There are 2 limits to practicality: gas costs and the block gas limit.

Example

Create 5k5 players, read one time

https://testnet.bscscan.com/address/0x721ff9e58831b698efd26b9ac744cf8f0aaecbc2#readContract

Max Gas Limit is 28,500,000 at May 12, 2021 = 0.22BNB ~ $145

  • [READ] Can not get all 5600 players (1600 is ok)
call to TestPlayerRead.getPlayers
call to TestPlayerRead.getPlayers errored: Error: Internal JSON-RPC error. { "code": -32000, "message": "out of gas" }

Setup MongoDB


* Check linux version: lsb_release -a
sudo apt install wget
wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -

* https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/
* Debian 10 "Buster"
echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

* https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
* Ubuntu 20.04 (Focal)
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

sudo apt update
sudo apt install -y build-essential
sudo apt install -y mongodb-org
sudo systemctl enable mongod
sudo service mongod start
- Start: sudo service mongod start
- Verify status: sudo cat /var/log/mongodb/mongod.log …

Make sure your application is stateless: share database/cache, cronjob

Create ecosystem.config.js at root

// https://pm2.keymetrics.io/docs/usage/application-declaration/
// # Start all applications
// pm2 start ecosystem.config.js
//
// # Stop all
// pm2 stop ecosystem.config.js
//
// # Restart all
// pm2 restart ecosystem.config.js
//
// # Reload all
// pm2 reload ecosystem.config.js
//
// # Delete all
// pm2 delete ecosystem.config.js
module.exports = {
apps: [{
name: "nestjs-prod",
script: "./dist/main.js",

Config:

Simple config: nginx.conf

sudo nano /etc/nginx/sites-available/api.nhancv.com

# start of file
# http {
upstream ncluster {
server 127.0.0.1:3000 weight=3;
server 127.0.0.1:3001;
}

server {
listen…

Download

https://jmeter.apache.org/download_jmeter.cgi

Get started

https://jmeter.apache.org/usermanual/get-started.html

INSTRUCTION

Download jmeter -> extract

PREPARE TEST PLAN

  • open terminal run GUI ./bin/jmeter
  • Create new Test Plan
  • Right click on “Test Plan” -> Add -> Threads -> Thread Group -> Update Thread Properties
  • Right click on “Thread Group” -> Add -> Sampler -> HTTP request -> Update web server and request info
  • Right click on “Thread Group” -> Add -> Assertions -> Response Assertion -> Add 200 as Response code to Patterns to Test
  • Right click on “Thread Group” -> Add -> Listener -> View Results in Table
  • Save config
  • Click green play button

RUN STRESS TEST

  • After prepared Test Plan, we got .jmx file
  • Run command line…

STOP APPLICATION

BACKUP DATABASE

mongodump --username DB_USERNAME --password DB_PASSWORD --db DB_NAME --out /var/backups/mongobackups/`date +"%m-%d-%y"`

UNINSTALL OLD DATABASE

sudo systemctl stop mongodb
sudo apt-get purge mongodb-*

INSTALL NEW ONE

wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo systemctl start mongod
sudo systemctl status mongod

VERIFY INSTALLATION

ubuntu@ip-172-31-1-68:~/myubi-wallet-service$ mongod --version
db version v4.4.4
Build Info: {
"version": "4.4.4",
"gitVersion": "8db30a63db1a9d84bdcad0c83369623f708e0397",
"openSSLVersion": "OpenSSL 1.1.1 11 Sep 2018",
"modules": [],
"allocator": "tcmalloc",
"environment": {
"distmod": "ubuntu1804",
"distarch": "x86_64",
"target_arch": "x86_64"
}
}

Add user role

ubuntu:~$ mongo
> use admin;
> db.createUser({
user: "admin"…

The Stack event begins with fixed pool size and stacking time. How to deal with fairy things?
- (1) The reward should be fixed at stacking time and maybe grow…

Nhan Cao

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store