fabiochiu/medium-articles huggingface dataset:
Deploying React Application in Github Pages
Tags: React, Deployment, Deploy, Github, Github Pages

Photo by Richy Great on Unsplash

As developers we’ve been struggling with deploying low budget applications and private projects because of the cost of Deployment and Domain Name. So, Github has introduced a cost effective way of deploying static web applications (web pages) with a public repository which called Github Pages. Github Pages will let to deploy static content in it’s server with a customizable Domain Name . In this article let’s dive in and checkout how to deploy a simple React App using Github Pages.

First Let’s create a simple React Application using create-react-app

npx create-react-app sample-app

Now let’s create a new Repository in our Github Account

Remember that you have make the repository public repository in order to serve the application in Github server.

Then let’s initialize an empty git repository

git init

Then after, link the remote Github repository to the local repository.

git remote add origin https://github.com/ username/repo.git

Next let’s install github pages command in your application as a dev dependency

npm i gh-pages --save-dev

Now we have to do same changes with the package.json. You have to add following lines of code inside the package.json under scripts

"predeploy": "npm run build", "deploy": "gh-pages -d build"

Meantime you have define the default Domain Name for your application for that you have to add homepage into the top-level of the package.json in following format.

"homepage":"http://yourgithubusername.github.io/your-repo-name"

Now your package.json would look like this.

{ "homepage":"http://sankalpafernando.github.io/sample-app", "name": "sample-app", "version": "0.1.0", "private": true, "dependencies": { "react": "^17.0.1", "react-dom": "^17.0.1", "react-scripts": "4.0.1", }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "predeploy": "npm run build", "deploy": "gh-pages -d build" }, "devDependencies": { "gh-pages": "^3.1.0" } }

It’s time to deploy, let’s run the deployment command

npm run deploy

After executing the command you would have wait for a while and then after you can see a Success message in the terminal. Now you can view your application through the URL defined in homepage.

What the above command does is it would create a separate branch called gh-pages and create a production build of the application in folder called build. Then after it will push that folder into the Github repository and then on Github starts to serve the static files in that folder through it’s server.

Github Page is a new and cost-effective way of deploying frontend static application but this method is not recommend for production or commercial build since you have make your repository publicly visible in the Github.
Kubernetes: Replica Scaling
By: Karan Gupta
Tags: Deployment, Scaling, Kubernetes

The above is a basic representation of how scaling works with Kubernetes. When a person executes the scale command, they are essentially updating a deployment spec. Then the deployment controller updates it’s replica set spec. And the replica set changes it pod count to 2 — (it created the new pod). This triggers and control plane now decides which nodes the pods (both the new and the existing one) need to exist in.
How to Perform an Elastic Beanstalk Deployment from Your Local Machine
By: Jake Jones
Tags: Deployment, Development, DevOps, Elastic Beanstalk, AWS

A quick guide for first timers trying to deploy from your local machine to elastic beanstalk.

Photo by SpaceX on Unsplash

Install the CLI

First, you need to install the eb cli.

pip install awsebcli --upgrade --user

or

bre install awsebcli

Next, you need to modify your PATH.

Linux:

export PATH=~/.local/bin:$PATH

Mac OS:

export PATH=~/Library/Python/3.7/bin:$PATH

You may want to close and reopen your CLI at this point to source.

Configure Your CLI

Now you will want to run the below command in the directory that your code is in.

eb init

You will want to input your region and if you do not have access keys you will want to create them in your AWS account and enter them here.

The rest of the settings are going to be based on your preference, but if you need more help you can find the AWS documentation here.

Setup Your config.yml

In the directory you are going to push to elastic beanstalk create a new folder called .elasticbeanstalk. You might have to use your cli in order to do this.

mkdir .elasticbeanstalk

Change to that directory

cd .elasticbeanstalk

Create a file called config.yml

touch config.yml

Inside of this config file you will be creating the configuration for your elastic beanstalk environment. Here is an example.

Deploy Your Code

Let’s get our code deployed. To be safe let's run another init.

eb init

Now a deploy.

eb deploy

This will get our code pushed up to our elastic beanstalk environment! You will see output that looks something like this:

Creating application version archive "SOME VERSION".

Uploading: [##################################################] 100% Done...

2020-11-04 19:52:08 INFO Environment update is starting.

2020-11-04 19:52:15 INFO Deploying new version to instance(s).

2020-11-04 19:52:57 INFO New application version was deployed to running EC2 instances.

2020-11-04 19:52:57 INFO Environment update completed successfully.

Doing this does not at all guarantee that all of the settings you need in place are there or that your particular app will be running, but it will get you deployed. Making sure that your application runs as expected and has all of the necessary requirements is up to you!

Conclusion

I hope this helped you get your first elastic beanstalk deployment performed locally. Once you understand the process I would highly suggest you set up a pipeline and use proper collaborative coding processes.

If you are interested in learning to deploy your AWS architecture with Terraform I have a Free Terraform Course for getting started and a course to help you study for your HashiCorp Certified: Terraform Associate. Check them out!

Happy learning!

👋 Join FAUN today and receive similar stories each week in your inbox! ️ Get your weekly dose of the must-read tech stories, news, and tutorials.

Follow us on Twitter 🐦 and Facebook 👥 and Instagram 📷 and join our Facebook and Linkedin Groups 💬
End-to-End CNN using TensorFlow
Tags: Deployment, TensorFlow, Heroku, Deep Learning, Machine Learning

2. Data gathering

A big part of your machine learning engineer workflow will be data gathering, cleaning, and formatting data. Lucky if your data is already clean & kudos to all data engineers for making that happen.

Our data is gathered from Kaggle.

After download and extract, we can see that data is in the below structure.

|-test

| |-image1

| |-image2

|

|-train

| |-Cat

| |-image1

| |-image2

| |-Dog

| |-image1

| |-image2

Here we see that data is well-formatted.

Before we jump into Jupyter notebook we have to make our data ready.

If you want to use this structure you can use TensorFlow image_dataset_from_directory.

image_dataset_from_directory. The second option is to read a CSV file. But here CSV file is not included, so we have to make one. For that, let’s make a function to rename all images and then move all images into a single folder. After that, we create a CSV file with filename and labels.

create a label list

label = [] for filename in os.listdir('path-to/train/'):

label.append(filename)

This function is to take the folder name from that path we provide and append it to the label list. The label looks like this [ ‘cat’, ‘dog’].

A rename function

The rename_image function takes the path and name that you want to change.

os.listdir make a list of all files from that folder.

src is used for the source file and dst the destination file.

Here we add a unique name and then file extension. Now loop goes through all images and changes the name that you give in the function argument.

file_name function is to call our previous rename function and applies to the subfolder as we gave the folder name also.

Now you can see that all images are renamed. let’s move all images into a new folder with the help of the python os.replace function.

move files

move_files takes an old and new path then moves a file from old to new.

For change files from more than one folder, we provide all folder names (our folder names stored in the label list) to file_change after that function call that move_file function and move images from subfolders also.

Now all our images are in one folder let’s make CSV file from that. Before that, we have to convert data into DataFrame then save it to a CSV file.

create CSV file

create pandas DataFrame from lists

In the above code, we have 2 lists called categories and filename. Now let’s make Pandas DataFrame and then, we save that DataFrame into CSV file with the Pandas to_csv function.

Our CSV file is ready with Filename and label accordingly. Now let’s build the CNN model.
Why vim for editing yaml k8s files ?
By: Taha Alami Idrissi
Tags: Deployment, Vim, Kubernetes, DevOps, Yaml

just wanting to share with you the fact that, using vim for editing (deployments, services, replicaSets..) is the best way to do so ! Why … ?

Well let me show you what a Deployment looks like :

apiVersion: apps/v1

kind: Deployment

metadata:

name: some-controller

namespace: default

spec:

replicas: 1

selector:

matchLabels:

app:

template:

metadata:

labels:

app: some-controller

spec:

containers:

- name: name

image: nginx

imagePullPolicy: Always

resources:

requests:

cpu: 100m

memory: 200Mi

ports:

- containerPort: 8080

Unless having a great memory(thing that i can’t afford).. memorizing all off this repetitive terms is kind off impossible and not the best way to proceed ..

think of the emotional intelligence principes ;)

Well using this vim plugin saved me hours …

I present to you

Plug 'andrewstuart/vim-kubernetes'

Quick and easy add the following Plug to your .vimrc

and then

:source %

:PlugInstall

And that’s it, you’re good to go.

That was quick & short, just wanting to share with you this plugin that saved me some hours and some brain ressources ;) Peace on you !
UK task group links up with Italian aircraft carrier in final exercise of Royal Navy’s Mediterranean deployment
By: Ministry Of Defence
Tags: Deployment, Military, Exercise, UK, Nato

UK task group links up with Italian aircraft carrier in final exercise of Royal Navy’s Mediterranean deployment

UK flagship HMS Albion and supporting ship Royal Fleet Auxiliary (RFA) Lyme Bay joined forces with Italian aircraft carrier Giuseppe Garibaldi in the final exercise of their Mediterranean deployment Ministry of Defence Follow Dec 3, 2020 · 3 min read

HMS Albion and RFA Lyme Bay have formed the core of the UK’s Littoral Response Group which has spent the autumn completing trials and exercises to help shape the amphibious forces and Royal Marines of the future.

The Littoral Strike Group (Experimentation) (LRG(X)) featured the deployment of the Royal Navy’s high readiness Littoral Strike forces on a three-month deployment to the Mediterranean and Black Sea region. During the deployment, the Royal Navy has tested innovative tactics and kit for the Future Commando Force (FCF) — the evolution of the Royal Marines as a hi-tech raiding and strike force.

After participation in NATO’s Mediterranean maritime security mission, Operation Sea Guardian, the British ships began the long journey home to the UK, which brought them into contact with the Italian Navy for some combined training.
From competition to call centre in five months: Zimnat sets a new record for putting Zindi models into practice
Tags: Zimnat, Deployment, Zindi, Data Science, Machine Learning

The Zimnat Insurance Assurance Challenge on Zindi attracted just under 300 Zindi users from all over the world, and in 60 hours in May produced winning solutions from users in Nigeria, Tunisia and India. Just five months later, Zulu and his team had deployed their customer care agents’ dashboard using those models.

In providing their agents with direction on who may churn and possible interventions to help prevent that, the machine learning solution produced by Zindi has had a rapid and direct impact on Zimnat’s core business — providing great insurance products to Zimbabweans.

Digital transformation in Africa

Zimnat is one of Zimbabwe’s leading insurance companies. Despite being founded in 1946, their eyes are fixed firmly on the future as they undergo a major digital transformation drive, and it is here that Zindi comes in.

“It’s clear to us that transformation on the digital side will be a key enabler of our business, and the level of talent that we can get through Zindi is unmatched,” says Mustafa Sachak, Group Chief Executive Officer for Zimnat. “Digitilisation has accelerated tremendously during the pandemic, and we need to make sure that we on the continent are following the same path.”

He also emphasises the value of partnerships (one of Zimnat’s core values) in this space.

“Zindi has given us access to data scientist talent across the continent — something we would never be able to achieve as one company. We’ve had some great solutions come out of our competitions with Zindi — solutions for churn prediction, a recommendation engine, and estimating loan defaults for our microfinance business.”

Growing partnership in data science

While the story of Zimnat and Zindi started with a #ZindiWeekendz weekend hackathon, it has blossomed into much more. Zindi and Zimnat have run a further two competitions since — the Zimnat Insurance Recommendation Challenge (a three-month challenge with a US$5000 prize pot), and UmojaHack Zimababwe: Zimnat Loan Default Prediction (a machine learning hackathon for Zimbabwean university students).

With similarly rapid turnaround times, winning models for both challenges are already being put into production by Zimnat’s digital team, and Zulu hopes that these products will be live in the first quarter of 2021. He is particularly excited about the loan default prediction model.

“Most of our customers don’t have a formal credit rating,” he explains. “The models we received from Zindi allow us to look at certain aspects of the customer based on the data we have, and say ‘this person qualifies for this amount of credit’. It will change how we deliver our microfinance products.”

For us at Zindi, seeing winning machine learning models from all over Africa being implemented so quickly, with a directly impact on business outcomes for our clients, gets us excited and makes our hard work worthwhile. We’re proud of our partnership with Zimnat, and look forward to a long and fruitful relationship together.
Predictive Analytics Market Worth $23.9 Billion By 2025
By: Gaurav Shah
Tags: Deployment, Consulting, Installation, Training, Technology

The global predictive analytics market size is expected to be valued at USD 23.9 billion by 2025, registering a CAGR of 23.2% over the forecast period, according to a study conducted by Grand View Research, Inc. Massive data dependence and adoption of advanced technologies such as AI, machine learning, and big data is expected to drive the demand for predictive analytics solutions over the forecast period. These solutions transform collected data into insights; for instance, they detect patterns to determine a suitable course of action. They have also been instrumental in the development of search advertising and recommendation engines. Growing awareness about the importance of available data and its analysis for predicting the future scenario is offering a competitive edge to end users, thereby driving the demand for these solutions.

Key factors driving the demand for predictive analytics solutions are enhanced product usability, adoption of new technologies, massive data deluge, and newer levers of differentiators. In addition, growing need for database management, data warehouses, forecasting, data mining, smart logistics, CRM, and data visualization in dashboards is supporting the growth of the market. These solutions help map the various stages of the buyer journey, which would help organizations adopt suitable marketing campaigns, subsequently leading to higher sales and customer retention. Increasing demand for these solutions from organizations to equip their business functions with analytical capabilities are also expected to drive the growth of the market over the forecast period.

Techniques for implementing predictive analytics include machine learning, deep learning, regression, regression modeling, mathematical, text mining, neural nets, genetic algorithms, clustering, decision trees, and data exploration techniques to gain insights from historical and present data. These techniques are increasingly being adopted by organizations for various applications such as CRM, direct marketing, risk management, portfolio management, fraud detection, underwriting, and credit scoring. These solutions therefore help organizations decide future strategies based on predicted outcomes for enhancing the overall performance in the coming years.

These solutions find applications in various end-use industries such as BFSI, healthcare, retail, manufacturing, government, sports, transportation and travel, IT, energy and utilities, and entertainment. These solutions help manage diversified applications across the aforementioned verticals. For instance, in the manufacturing industry, these solutions can be used for equipment maintenance management, workforce management, and cross-selling and up-selling. Moreover, the IT and telecom industry can adopt these solutions in sales, marketing, and CRM by implementing churn and pricing optimization.

Click the link below:

https://www.grandviewresearch.com/industry-analysis/predictive-analytics-market

Further key findings from the study suggest:
WP Owls #9
By: Wp Owls
Tags: Deployment, Handbook, Gutenberg, WordPress, PHP

Guest Editor

Greg Ziółkowski

I live in Oleśnica and am a dedicated developer & open source software contributor. I work at Automattic where I code in JavaScript & develop block editor in WordPress core. When I’m not coding, I prefer to spend my time with my family travelling and discovering new places (not in the middle of pandemic though). I’m a big basketball fan and I still like to play with my friends.

My choices are inevitably connected with Gutenberg block editor that I have been incessantly working on for over 3 years now courtesy of Automattic. I assume that a great part of the community got used to creating content with blocks and some can’t imagine going back to a classic editor. In the nearest future it will get even better as first themes based entirely on the new approach to whole site management have already appeared.
Pointing your Heroku app to a Custom Domain, what a nightmare at first!
By: Charlie K
Tags: Deployment, DNS, Heroku, Nodejs, Domains

Step 1: Purchase a domain

Anyone can buy a domain. To do so visit a domain Truehost, HostGator or GoDaddy and key in the domain you want to buy. Incase that domain isn’t already registered to another person or business, you will be able to pay a fee which is to be renewed annually. Make sure to buy something catchy for your particular need. Take advantage of Black Friday sales!🛒

After buying the domain you will be redirected to your portal. For my case I used Truehost.

Your domain will be something like — www.yourdomain.co.ke

Step 2: Add domain to Heroku

If u haven’t created an app already create on one Heroku. Navigate to the app dashboard settings and add your custom domain

You will need to add both — yourdomain.co.ke and www.yourdomain.co.ke as Domain names. These are to be replaced with the domain you purchased above.

Step 3: Install PointDNS add-on

To point the root of your domain to Heroku, you will need to install the PointDNS add-on. The add-on is free but you will need to add credit card details to Heroku to verify your identity.

To install this add-on, navigate to your app on Heroku and click on the resources link.

Heroku add-ons

After installing the PointDNS add-on, click on the add-on to redirect to the PointDNS dashboard

Navigate to your domains where you will find the settings below already preconfigured.

PointDNS Records

Step 4: Change Name Servers on your Domain portal

Login to your domain provider(Truehost) in our case and change the name servers to match the information provided by PointDNS.

In my case I navigated to Olitt where I added my CNAME as the Heroku app URL.

Consult with your DNS provider for specific instructions to create CNAME and NS records.

DNS Records

On Truehost portal I changed my name servers to reflect PointDNS.

Truehost portal

Step 5: Step back and wait

Finally, the hard part. Depending on Domain provider the changes might take from a few hours to around 48 hours. It would be a good idea to just give the it the rest of the day and check up tomorrow.

After a not so long of a wait your Heroku application will now be available on www.yourdomain.co.ke

My biggest take, be patient😎😂
Docker and Kubernetes
By: Kamran Ghyan
Tags: Deployment, Pods, Kubernetes Cluster, Node

In the last article I’ve discussed why Kubernetes. Now I’ll explain why Docker and Kubernetes are so nice together.

first we’re gonna take a look at following diagram.

Product source code and Docker file creating image of Products

In above diagram we’ve got some products files or essentially our product service source code. We took all those files and a docker file and we fed them more or less into Docker and now with that came an image for our product service.

We can now create as many instances of this image or containers as we call them as you wish. The image is really the blueprint for how to create a post container.

Now of course we’re going to actually create an instance of this product image. There we go so we’ve got our image all created

Whenever we want to use Kubernetes we have to have a set of images that are ready to go.

Now we’ve image ready and we’re going to deploy it into Kubernetes cluster.

In the following diagram right here I’m showing three separate nodes and remember a node is a virtual machine.

Node is essentially a computer that’s going to run number of containers for us.

So to create a container out of image or something out of the product image, first we’ve to create a configuration file in this configuration file we’re going to list out some very explicit directions for Kubernestes is going to say please create two copies of the product image for us make containers and host them somewhere on these nodes.

Let me show in diagram

In order to manage these two pods Kubernestes is also going to create something called a deployment, So this deployment is going to be in charge of managing both these pods if anything ever goes wrong with these pods.

So if it crashes for some reason or if it just stops running or whatever else might possibly happen. This deployment right here is going to make sure that that pod automatically gets recreate it.

So the deployment is in charge of making sure that we’ve always got the right number of pods and that these pods are running successfully.

You can better idea from following diagram.

So that is overview of Kubernetes, Now at this point this is running little long I can take a quick pause in next article will come with Kubernestes vocabulary.
How to deploy a PyTorch model in minutes
By: Marcin Laskowski
Tags: Deployment, Pytorch, Tutorial, Flask, Docker

How to deploy a PyTorch model in minutes

I’ve trained my model. What’s next?

Have you ever wanted to deploy a Machine Learning model in order to run it on a website or some mobile app?

In the past, I was exactly in your situation trying different tools, resources. Hundreds of hours spent on building a simple one-page demo app that takes an image as an input and returns one word: Cat. I’ve experienced that the main focus of most Machine Learning Deployment tutorials ends up with building a simple flask app, creating a docker, and setting up the cloud infrastructure. However, it is still time-consuming and difficult. There are many problems with ai model deployment.

Since that time I’ve managed to find a way to solve that problem in just three easy steps.

Let’s have a look and deploy a PyTorch model (Check also How to deploy Keras model).

Step 1: Develop

In the first step, we need to have a trained model. For this purpose, we will use a pre-trained PyTorch YoloV5.

For those who don’t know what Yolo is a real-time object detection framework and stands for You Only Look Once, which means that the image passes only once through the Fully Convolutional Neural Network. Comparing to previous versions the V5 is much faster and much smaller (only 27Mb).

In order to run the algorithm locally, you can copy and paste a script from PyTorch Hub. The script will automatically download a pre-trained model and sample images to inference a model.

import cv2

import torch

from PIL import Image # Model

model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True).fuse().autoshape() # for PIL/cv2/np inputs and NMS # Images

for f in ['zidane.jpg', 'bus.jpg']: # download 2 images

print(f'Downloading {f}...')

torch.hub.download_url_to_file('https://github.com/ultralytics/yolov5/releases/download/v1.0/' + f, f)

img1 = Image.open('zidane.jpg') # PIL image

img2 = cv2.imread('bus.jpg')[:, :, ::-1] # OpenCV image (BGR to RGB)

imgs = [img1, img2] # batched list of images # Inference

results = model(imgs, size=640) # includes NMS # Results

results.show() # .show() results, .save() jpgs, or .print() to screen

Follow the full tutorial on deploy a pytorch model.
Deploy your React.Js application on AWS Amplify.
By: Shubham Waje
Tags: Deployment, Reactjs, DevOps, AWS, Aws Amplify

In this article, we are going to see how to deploy your React.Js web application on AWS Amplify.

WHY AWS AMPLIFY?

AWS Amplify Console is a web hosting service that accelerates your application release cycle by providing a simple CI/CD workflow for building and deploying web applications. Simply connect your application’s code repository in the console, and changes to your frontend are deployed in a single workflow on every code commit.

If you haven’t created your AWS account, go to AWS Console — Signup (amazon.com) and Sign Up there.

SET UP REACT APPLICATION:

Initialize a react project using create-react-app (In your case, you might be having your existing react application, therefore you can skip this part):

> mkdir react_aws_amplify

> cd react_aws_amplify

> npx create-react-app react_app

> cd react_app

> npm start

If you already have your project repository on GitHub, please go to the “DEPLOY THE PROJECT ON AWS AMPLIFY:” section.

Now initialize a git repository in your project directory by running the following command (make sure that the git is installed in your machine):

> git init

Now go to your GitHub account and create a new GitHub repository to hold our project:

Go to your project directory and run following commands to push your code to the GitHub repository:

> git add .

> git commit -m "first commit"

> git remote add origin <your repository url>.git

> git push -u origin master

DEPLOY THE PROJECT ON AWS AMPLIFY:

Login to your AWS console and search for AWS Amplify in Services as shown below:

Choose your provider. In my case, I’m using GitHub. Select the GitHub option and click continue as shown below:

AWS Amplify will ask for read-only access to your repositories, go ahead and connect your GitHub account by entering your GitHub password.

Now select the repository you want to deploy and keep the master branch as default and click next. In this case, I want to deploy the first repository.

Now AWS Amplify will automatically detect your app’s build settings. No need to do anything on the “Configure build settings” page, so go ahead and click on next.

Click on Save and Deploy

You’ve successfully deployed your React app on AWS Amplify!

As soon as you push your modified code to the master branch AWS Amplify will automatically start the deployment process again.

Thanks for reading. I hope this post will help you in your journey. Keep learning!

My LinkedIn, Instagram and GitHub.
How to setup Grafana on Kubernetes cluster using helm chart
By: Shubham Khairnar
Tags: Deployment, Charts, Kubernetes, Helm, Grafana

Let’s get started:

Step-1:

Clone the below repositories:

Repo1: git clone https://github.com/helm/charts.git

Repo2: git clone https://github.com/ShubhamKhairnar/monitoring.git

Step-2:

After cloning Repo1; move to charts/stable/grafana folder

Step-3:

After cloning Repo2; Copy grafana.yaml and values.yaml to charts/stable/grafana folder.

Step-4:

Note: Please make necessary changes to grafana.yaml for datasource and values.yaml, if required.

Step-5:

Let’s deploy the work! 🤩

Create namespace named grafana:

kubectl create namespace grafana

Step-6:

Then, move to /charts/stable/ folder, and fire below command:

helm install grafana — values grafana/values.yaml \ — namespace grafana \ — set persistence.storageClassName=”gp2" \ — set persistence.enabled=true \ — set adminPassword=’PASSWORD’ \ — values grafana/grafana.yaml \ — set service.type=LoadBalancer \ grafana/

Woooh!! Deployment is done!! isn’t it the simplest method to deploy?😎

I KNOW , it is! 😛

Step-7:

Check if everything is working fine by:

kubectl get all -n grafana

you would see something similar to following:

Grafana using Helm chart

Step-8:

Grab the external IP and shoot it over the browser and voilaa!! 🥳🥳

you have your brand new Grafana UI showing up!

Grafana UI

Step-9:

Login with admin credentials for the start, Username as admin and Password as which you had set in while shooting command.
How to setup Prometheus and Alertmanager monitoring on kubernetes cluster
By: Shubham Khairnar
Tags: Deployment, Prometheus, Cluster, Kubernetes, Alertmanager

Let’s get started with the setup.

Setup:

Step-1) Cloning:

All the configuration files I’ve mentioned in this article are available on GitHub. please don’t hesitate to contribute to the repo for adding features.

You can use the config files from the GitHub repo or create the files on the go as mentioned in the steps.

You can clone the repo using the following command.

git clone https://github.com/ShubhamKhairnar/monitoring.git

Step-2) Create a namespace:

We will create a Kubernetes namespace for all our monitoring components.

Execute the following command to create a namespace named “monitoring”:

kubectl create namespace monitoring

Step-3) Create cluster role:

kubectl apply -f clusterrole_bindings.yml

Step-4) Create ConfigMaps:

Prometheus:

Create a config map with all the prometheus scrape config and alerting rules, which will be mounted to the Prometheus container in /etc/prometheus as prometheus.yaml and prometheus.rules.

The prometheus.yaml contains the configuration to dynamically discover pods and services running in the Kubernetes cluster.

We have the following scrape jobs:

a) kubernetes-apiservers: All the metrics from the API servers.

b) kubernetes-nodes: Kubernetes node metrics

c) kubernetes-pods: Pod metrics (Pod metadata should be annoted as: prometheus.io/scrape andprometheus.io/port)

d) kubernetes-cadvisor: Collects all cAdvisor metrics.

e) kubernetes-service-endpoints: All the Service endpoints (service metadata is annotated with prometheus.io/scrape andprometheus.io/port)

f) database-exporter: All the database metrics from the database (Optional)

g) prometheus.rules: All the alert rules for sending alerts to alert manager using an email.

Alertmanager:

Alert Manager reads its configuration from a config.yaml file. It contains the configuration of alert template path, email and other alert receiving configuration.

In this setup, we are using email receivers. we have added some infrastructure rules and email-alerts, you can fill your email details and we are good to go. 😎

kubectl apply -f configmap.yml

Step-5) Create prometheus and alertmanager deployment:

kubectl apply -f deployment.yml

It uses the official Prometheus image from the docker hub.

Step-6) Exposing Prometheus and alertmanager as a Service:

To access the Prometheus dashboard over a IP or a DNS name, you need to expose it as Kubernetes service.

kubectl apply -f service.yml

If you are on AWS or Google Cloud, you can use LoadBalancer as a type, which will create a load balancer and points it to the service.

To do that, edit your service and change type to LoadBalancer and aws/gcp will assign loadbalancer to your service.

Step-7) Configuration check:

Check whether all the pods and services are running using following command:

kubectl get all -n monitoring
Netlify: Custom Domains with GoDaddy
By: Matthew Sedlacek
Tags: Deployment, Godaddy, Custom Domain, Netlify, Web Development

Photo by NASA on Unsplash

If you have deployed your app on Netlify but would prefer to use a domain you purchased on GoDaddy, this is the blog for you.

This guide will walk you through the necessary steps to use your custom GoDaddy domain while continuing to use Netlify and all of its useful deployment features.

Prework

This blog assumes that you have already created a Netlify account and purchased a GoDaddy domain. If you have not done so, you can Sign-up/purchase here (Netlify & GoDaddy).

** Please note that Netlify now allows users to purchase domains direct **

For a tutorial on how to deploy a GitHub Repository to Netlify, please see my blog posted here.

Netlify: Getting Started

To get started, we first want to identify our default subdomain. We will need to provide GoDaddy with this information later on. To find the default subdomain click on the Domain settings button in the Site overview tab of your Netlify Site.

Site Overview Tab Netlify

Your default subdomain will be the first item in the Custom domains section.

Default Subdomain from Netlify

GoDaddy: DNS Management

Login to your GoDaddy account and select All Domains from the Domains dropdown.

GoDaddy Landing Page

Click on the custom domain you would like to use for your Netlify Site.

List of Domains from GoDaddy

Scroll down to additional settings and click on Manage DNS. This will populate the custom domains Records.

The records should be pre-populated with all the required fields you need. The only two fields that you need to update are the value fields for Type A and CName. Type A is the IP Address for the Netlify servers and will be the same for all domains and users, 104.198.14.52. The CName is the Netlify default subdomain we identified earlier. Updating this field allows GoDaddy to send the custom domain to the correct Netlify subdomain.

GoDaddy DNS Management Records

Netlify: Custom Domain Verification

Now back in Netlify, we are able to add our custom domain. Click on the Add custom domain button.

Add Custom Domain

Next, type in your custom domain, starting with “www.” and click verify.

If your verification is successful, you should see something similar to what is shown below. Your custom domains should include a default subdomain, primary domain (i.e., www.matthewsedlacek.com), and redirect for when users don’t type www (i.e., matthewsedlacek.com).

Now it’s time to celebrate; you can now share your custom domain with the world!

Resources

TopTechNow. “How to connect Netlify to Godaddy (Custom Domain).”YouTube, uploaded by TopTechNow, 18 January 2018, https://www.youtube.com/watch?v=qbChXHDAK4s.
Set up custom domain with HTTPS and add global cache
By: Bill Chen
Tags: Cloudfront, Deploy Static Websites, Route 53, Deployments

Origin Path: Leave it empty if your index.html sits in the root folder of your Bucket. Otherwise, type in the path starting from the root of your Bucket.

Restrict Bucket Access: Set to Yes

Origin Access Identity: Select Create a New Identity and for the Comment type in Identity for s3 demo site. You can later view all origin access identities you have under CloudFront -> Security -> Origin access identity.

Grant Read Permissions on Bucket: Select Yes, Update Bucket Policy. This will automatically update Bucket Policy for you, so that only CloudFront can access your Bucket and no longer the public.

Default Root Object: Set it to index.html

Leave everything the same then click on Create Distribution. We will come back to Distribution Settings later to set custom domain and HTTPS.

You will see your distribution is being created In Progress. When it’s done, the status will change to Deployed.
Host your own video service app using Jitsi
By: Shailesh Kumar Sahu
Tags: Deployment, Video Call App, Apps, Hosting, Jitsi

Ready to do something new? Want to host your own video service app? Great. I will show you how to do it quickly. In this article, we will be learning how to host your own Jitsi app. I am assuming that you people are already knowing how to create a virtual space like AWS’s EC2 instance or Azure’s VM. We will be hosting our code in Ubuntu Machine of 4 GB Ram, 2 CPUs, and 30 GB storage.

Get your VM’s access

Connect to your instance or virtual machine using SSH.

ssh -i <your-permission-file.pem> <user-name>@<server'-IP>

eg: ssh -i test.pem azureuser@13.76.157.xxx

Setup Domain Name

Go to you domain name provider

Enter DNS Management.

Add a new A Record pointing to Virtual Server’s Public IP.

let’s say you have a domain name that is “myvideoapp.com”. You can add a new subdomain called “meet” by adding a new A-record. So, your new meet domain name will “meet.myvideoapp.com”

We will be using this domain name for further steps.

Pre-Configuration

get root access as all commands will require sudo. sudo su -

as all commands will require sudo. check iptables. Here you would find iptables to be empty.

iptables -L -n

check firewall status. You will find that firewall is disabled

ufw status

Enable Firewall ufw enable .

. Allow Firewall for given ports.

ufw allow in ssh

ufw allow in 80/tcp

ufw allow in 443/tcp

ufw allow in 10000:20000/udp

ufw allow in ssh , ufw allow in 80/tcp , ufw allow in 443/tcp , ufw allow in 10000:20000/udp

, , , check firewall status. ufw status

Add Jitsi Repo

curl https://download.jitsi.org/jitsi-key.gpg.key | sudo sh -c 'gpg --dearmor > /usr/share/keyrings/jitsi-keyring.gpg' echo 'deb [signed-by=/usr/share/keyrings/jitsi-keyring.gpg] https://download.jitsi.org stable/' | sudo tee /etc/apt/sources.list.d/jitsi-stable.list > /dev/null

Install

nginx apt install nginx

jitsi-meet apt install jitsi-meet

Enter your domain name. eg: “meet.myvideoapp.com”

Select the “Install self-signed certificate” option for the SSL certificate.

Run the script to install SSL cert

/usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh

Extras

If you want to create your own SSL certificate then this is a good place to go.

https://certbot.eff.org/lets-encrypt/ubuntubionic-webproduct

This is currently written to quickly host your app. I will update this to a more read-friendly one if someone wants it.
How I managed to encounter and recover from Computer Science’s Two Hardest Problems
By: Dustin Goodman
Tags: Deployment, Bugs, Cache, Naming Conventions, PHP

Problem 1: Naming Things

Naming Issue 1

As previously stated, this returns only 1 element if only a single value for relation A is passed in as an argument. According to PHP docs, reset “set[s] the internal pointer of an array to its first element”. The gotcha is its return value. According to the doc, it “returns the value of the first array element, or FALSE if the array is empty.” So in PHP, anytime you see $x = reset($arr); or return reset($arr); , it’s actually behaving like a first method or return $arr[0]; .

Without knowing this, when I went to update this function to work from cache, I also removed the reset and ended up with the following:

As a result of leaving out the reset , the function started returning an array in the case that previously expected a single value. This caused some issues upstream. The fix we decided on was to convert the final return statement to read return _::first($result); which was our replacement for reset to help clarify the intended behavior.

There are 2 main takeaways from this problem:

Having a fully functioning testing suite would have been ideal as this problem would have been caught by CI and any future issues would have been caught. Using clearly named functions is important. reset and first have different meanings to me, but to a seasoned PHP developer, these are synonymous. Regardless, to make entry into a codebase easier, comments on lines with ambiguously named functions is a must.

Naming Issue 2

There was another issue around naming that wasn’t super obvious and we didn’t catch it until the previous naming fix had been shipped. Relation B and C are being filtered by variables $relationBId and $relationCId . Reading these variables, I thought they were always integer values. However, reading the function’s doc comment, these values can actually be an integer, an array of integers, or null. All the null cases were handled already and were easily identified, but how was this working before with arrays?

The answer lies in how PDO (PHP Data Objects) works. PDO’s where method allows for an integer, a string, or an array to be passed in, and it determines whether to translate this to a SQL = or IN clause under the hood. So when I translated:

$query = $query->where('relationBId', $relationBId);

to:

$result = _::filter($result, function ($item) use ($relationBId) {

return $item->relationBId === $relationBId;

});

I changed the underlying behavior of the filtering which caused a second bug I needed to run a rollback. The fix for this issue was to force the ID(s) variables to always be arrays before filtering and use a _::contains checker instead. The final result looks like:
Interesting article which learnt me something: maybe avoid deploying to Heroku 😊
By: Eric Pascual
Tags: Deployment, Debugging

Interesting article which learnt me something: maybe avoid deploying to Heroku 😊

Jokes apart I’ve never encountered the kind of differences in behavior used to illustrate the article in Kubernetes based hostings.

There are for sure differences even when testing locally with minikube or alike. And this doesn’t come without some preliminary investment. But it works like a breeze for deploying standard applications interacting with databases (Django applications for instance) and even “not so standard” one.

Anyway this was not the point of the article, which is nicely written. Thanks.
How to deploy a react app in seconds using Vercel
By: Gustavo Pinheiro
Tags: Deployment, JavaScript, Vercel, Reactjs

You must already tried make deploy of an application and it’s spent a lot of time or needed a lot of complicated settings. But, deploy an application don’t need be hard because we are in 21st century. So, i will show for you how to deploy a react app easily using vercel.

So, what hell is vercel?

Vercel is a plataform focused in hosting website very simple and fast way. It’s next.js framework founder. NextJS is a framework for reactJS.

Creating a react app

Knowing that we have npm installed in our pc, let’s just run this command:

npx create-react-app clean-space

Creating an account in Vercel

So, now we have to create an account, opening this link we will be redirected to sign up vercel page. We can see three options to choose:

vercel sign up page

I chose “Continue with github”, you can choose any option.

Next, just login and allow the options.

Deploying app

Now, we will install vercel-cli using this command:

npm i -g vercel

After that, go to a react-app folder and run:

vercel login

So, enter your email by cli and check email that vercel sent to you. After checked, let’s run this command to deploy:

vercel

You will see some questions in cli, just awnser them. If you have doubts see documentation.

Deployed 🙏

Now, our app is deploying in vercel, and we can follow it on vercel platform

As you can see has two links, one for environment tests and other for production. To make a production deployment, use the command:

vercel --prod

Conclusion

Well, was so easy, right? Without a lot of settings and really fast. Vercel is a good platform to deploy react app, but we also can deploy angular, vue and other frameworks.

Thank you, see you later 👊.
Deploy your first Ionic Application to iOS and Android Devices
By: Hizir Cagin Bektas
Tags: Deployment, Ionic, Mobile App Development, iOS, Android

If you wrote your first Ionic Application, it is a good time to deploy it to real devices to test in the most convenient way. Couple of days ago, I jumped into the Ionic world for spending some time like a hobby (Covid-19 goals). I had some configuring issues since I am brand new with this area. But I believe I am still alive. I deployed my application to both real iOS and Android devices. I thought it might be good to share my limited/very beginner level experience. (I experienced with MacOS and I will describe with MacOS only and with the standards of 21.11.2020. But I believe main things will be same for every platforms)

Prerequisites (software installments):

Android Studio

Xcode

I will stop talking and start describing the deployment journey. Here, I am assuming that, you have a healthy, working application, running with <ionic serve> command, now it is the time to stop it with control+c.

First things first we need to build the project to create some necessary directories and files before deployment. To build the project;

ionic build

Then you’re good to go with the deployment steps one by one. Here I flipped a coin (really) and Android won it. I will start describing the steps with Android.

ionic cap add android npx capacitor sync android npx capacitor update android npx cap open android

hit the commands in this order. Last command will trigger the Android Studio and will open your ionic, /android directory in Android Studio.

Now, plug your Android phone to your computer, you need to prepare it for Android Studio usage, follow here: https://javatutorial.net/connect-android-device-android-studio

If you see your phone just before/next to the Run button, we are ready to go! Hit the Run. If your phone asks you to trust your computer for deployment, shout YESSS!

After a loading process, possibly you will see this error/something similar to this error, but maybe not any error about the licences. Incase you need;

You have not accepted the license agreements of the following SDK components: [Android SDK Build-Tools 24, Android SDK Platform 24]. Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager. Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

The solution, use this command in your Terminal,

yes | sudo ~/Library/Android/sdk/tools/bin/sdkmanager --licenses

Then hit the Run again, here it is, your brand new Android Application deployed to your Android device. Feels good, ha?