LINUX
SSH KEY
JENKINS
DOCKER
# Create a Python virtual environment and activate it:
python3 -m venv env
source env/bin/activateGATEWAY
KAFKA
GIT COMMAND
-------------------------------------------------------------
-------- ELASTIC INSTALLATION ----------------
-------------------------------------------------------------
---------------------------------------
-------- For Windows 10 --------
---------------------------------------
I. PreInstall requirement
1. Install python 3
Download: https://www.python.org/ftp/python/3.6.4/python-3.6.4-amd64.exe
2. Install mongo-connector
Run following command in CMD:
-> pip3 install mongo-connector
3. Install doc-manager
Run following command in CMD as Adminmaster:
-> pip3 install 'elastic2-doc-manager[elastic5]'
4. Create Mongo replica set
- Stop mongoservice
- Run following command in CMD as ADminmaster: mongod --replSet myDevReplSet --dbpath C://data//db --port 27017 --bind_ip localhost
- Open another CMD an run the following commands:
-> mongod
-> rs.initiate()
Attention: if "rs.initiate()" fail then run "rs.initiate({ _id: 'myDevReplSet', version: 1, members: [{ _id: 1, host: '127.0.0.1:27017', priority: 10 }] })"
5. Install JAVA 8:
Link download (Windows x64 Offline): http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
II. Install Elasticsearch
1. Download and install Elasticsearch client:
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.5.msi
Attention: During Installation process, in plugin screen, choose "X-Pack"
III. Run Elasticsearch
1. Start product service and navigate to "http://localhost:9763/api/elastic/index/product"
2. Start mongo-connector by run following command in CMD:
-> mongo-connector -m localhost:27017 -t elastic:changeme@127.0.0.1:9200 -d elastic2_doc_manager -n Product.product
Done!!
---------------------------------------
---------------------------------------
-------- For Ubuntu 16.04 ------
---------------------------------------
I. PreInstall requirement
1. Install python 3
-> sudo apt install python-3
2. Install mongo-connector
-> pip3 install mongo-connector
3. Install doc-manager
Run following command in CMD as Adminmaster:
-> pip3 install 'elastic2-doc-manager[elastic5]'
4. Create Mongo replica set
-> sudo service mongod stop
-> sudo mongod --replSet myDevReplSet --dbpath /var/lib/mongodb --port 27017 --bind_ip localhost
- Open another terminal an run following commands:
-> mongo
-> rs.initiate()
Attention: if "rs.initiate()" fail then run "rs.initiate({ _id: 'myDevReplSet', version: 1, members: [{ _id: 1, host: '127.0.0.1:27017', priority: 10 }] })"
5. Install JAVA 8:
-> sudo add-apt-repository ppa:webupd8team/java
-> sudo apt-get update
-> sudo apt-get install oracle-java8-installer
II. Install Elasticsearch
1. Download and install Elasticsearch client:
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.5.tar.gz
2. Unzip
-> sudo tar -xvf elasticsearch-5.6.5.tar.gz
3. Install X-pack
-> cd elasticsearch-5.6.5
-> ./bin/elasticsearch-plugin install x-pack
III. Run Elasticsearch
1. Start elasticsearch service
-> ./bin/elasticsearch &
2. Start product service and navigate to "http://localhost:9763/api/elastic/index/product"
3. Start mongo-connector by run following command in CMD:
-> mongo-connector -m localhost:27017 -t elastic:changeme@127.0.0.1:9200 -d elastic2_doc_manager -n Product.product
Done!!
-------------------------------------------------------------
-------- REMMINA remote Ubuntu ------------
-------------------------------------------------------------
sudo apt-add-repository ppa:remmina-ppa-team/remmina-next
sudo apt update
sudo apt install remmina remmina-plugin-rdp remmina-plugin-secret-- # Cant access google.com
# configuration
$ sudo vim /etc/resolv.conf
# add preferred DNS server
nameserver 208.67.222.222
-- # allow remote access to mysql
# Navigate to bind-address, and change to 0.0.0.0
$ sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
$ sudo systemctl restart mysql
$ sudo mysql
# rename use
sql> RENAME USER 'devmy'@'localhost' TO 'devmy'@'remote_server_ip';
# or create user
sql> CREATE USER 'sammy'@'remote_server_ip' IDENTIFIED BY 'password';
# grant permission
sql> GRANT CREATE, ALTER, DROP, INSERT, UPDATE, DELETE, SELECT, REFERENCES, RELOAD on *.* TO 'sammy'@'remote_server_ip' WITH GRANT OPTION;
# free up
sql> FLUSH PRIVILEGES;
# Sometime you have the issue which related to registry on Nodejs
``sh
npm get registrynpm set registry https://registry.npmjs.org/```III. AWS
# Create a Config Profile > aws configure --profile profile_name
- Terraform VPC AWS
 - Networking, sub-net, nat (single, multiple), security group, subnet,…
 - Route 53, firewall (WAF),
 - Terraform EC2
 - Terraform EKS, RDS, S3
 - Sonaqube
 - Install ?-> can be able to deploy it via K8S
 - ELK is required?
 - Need Postgres only
 - K8S (AKS) should prefer course
 - POD, Deployment, Service, Ingress, load balancer (Isito), Network of policy
 - Helm
 - Certificate to add ssl
 - Auto scaling
 - Monitoring (
 - Grafana, Prometheus
 - Storing data -> sdd, s3
 - Argo CD
 
-------------------------------------------------------------
-------- PRODUCTS DB PATTERN ------------
-------------------------------------------------------------
| PRODUCTS |-----< PRODUCT_VARIANTS |
+---------------+ +-------------------+
| #product_id | | #product_id |
| product_name | | #variant_id |
+---------------+ | sku_id |
| +-------------------+
| |
+--------^--------+ +--------^--------+
| PRODUCT_OPTIONS |-----< VARIANT_VALUES |
+-----------------+ +-----------------+
| #product_id | | #product_id |
| #option_id | | #variant_id |
+--------v--------+ | #option_id |
| | value_id |
+-----------------+ +--------v--------+
| OPTIONS | |
+-----------------+ |
| #option_id | |
| option_name | |
+-----------------+ |
| |
+-------^-------+ |
| OPTION_VALUES |---------------+
+---------------+
| #option_id |
| #value_id |
| value_name |
+---------------+
PRODUCTS
========
product_id product_name
---------- ------------
1          Widget 1
2          Widget 2
3          Widget 3
 
OPTIONS
=======
option_id option_name
--------- -----------
1         Size SL
2         Color
3         Size SM
4         Class
5         Size ML
 
OPTION_VALUES
=============
option_id value_id value_name
--------- -------- ------------
1         1        Small        (Size SL)
1         2        Large        (Size SL)
2         1        White        (Color)
2         2        Black        (Color)
3         1        Small        (Size SM)
3         2        Medium       (Size SM)
4         1        Amateur      (Class)
4         2        Professional (Class)
5         1        Medium       (Size ML)
5         2        Large        (Size ML)
 
PRODUCT_OPTIONS
===============
product_id option_id
---------- ---------
1          1         (Widget 1; Size SL)
1          2         (Widget 1; Color)
2          3         (Widget 2; Size SM)
3          4         (Widget 3; Class)
3          5         (Widget 4; Size ML)
 
PRODUCT_VARIANTS
================
product_id variant_id sku_id
---------- ---------- ------
1          1          W1SSCW (Widget 1)
1          2          W1SSCB (Widget 1)
1          3          W1SLCW (Widget 1)
1          4          W1SLCB (Widget 1)
2          1          W2SS   (Widget 2)
2          2          W2SM   (Widget 2)
3          1          W3CASM (Widget 3)
3          2          W3CASL (Widget 3)
3          3          W3CPSM (Widget 3)
3          4          W3CPSL (Widget 3)
 
VARIANT_VALUES
==============
product_id variant_id option_id value_id
---------- ---------- --------- --------
1          1          1         1        (W1SSCW; Size SL; Small)
1          1          2         1        (W1SSCW; Color; White)
1          2          1         1        (W1SSCB; Size SL; Small)
1          2          2         2        (W1SSCB; Color; Black)
1          3          1         2        (W1SLCW; Size SL; Large)
1          3          2         1        (W1SLCW; Color; White)
1          4          1         2        (W1SLCB; Size SL; Large)
1          4          2         2        (W1SLCB; Color; Black)
2          1          3         1        (W2SS; Size SM; Small)
2          2          3         2        (W2SM; Size SM; Medium)
3          1          4         1        (W3CASM; Class; Amateur)
3          1          5         1        (W3CASM; Size ML; Medium)
3          2          4         1        (W3CASL; Class; Amateur)
3          2          5         2        (W3CASL; Size ML; Large)
3          3          4         2        (W3CPSM; Class; Professional)
3          3          5         1        (W3CPSM; Size ML; Medium)
3          4          4         2        (W3CPSL; Class; Professional)
3          4          5         2        (W3CPSL; Size ML; Large)
======================================
K8S what you will need is
AWS account 
virtual machine 
putty or any ssh client
##TERRAFORM INSTALLATION
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
wget -O- https://apt.releases.hashicorp.com/gpg | \
    gpg --dearmor | \
    sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg
gpg --no-default-keyring \
    --keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \
    --fingerprint
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \
    https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \
    sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update
sudo apt-get install terraform
#AWS CLI
apt install unzip
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update
aws configure
git clone https://github.com/hashicorp/learn-terraform-provision-eks-cluster
cd learn-terraform-provision-eks-cluster
#comment cloud configuration in terrform.tf
terraform init
terraform apply
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
snap install kubectl --classic
kubectl version --client
aws eks --region $(terraform output -raw region) update-kubeconfig \
    --name $(terraform output -raw cluster_name)
kubectl cluster-info
kubectl get nodes
kubectl create namespace argocd
   kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath="{.data.password}" | base64 -d; echo
kubectl delete -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
kubectl delete namespace argocd
terraform destroy --auto-approve