Skip to content

Oziel-Silva/deploy-app-with-epinio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notify API

This API runs integrated with a Postgres!!

it have three methods:

POST - saves one message on the data-base

PUT - Updates the read flag on the data-base

GET - Get all messages from one destination

Step One!

Prepare your Environment with Minikube!

To install minikube use: minikube official docs

after install... Let's start k8s with the following commands:

$ minikube start --driver=docker
$ minikube addons enable metallb
$ minikube addons configure metallb

-- Enter Load Balancer Start IP: 192.168.49.100
-- Enter Load Balancer End IP: 192.168.49.120
     Using image metallb/speaker:v0.9.6
     Using image metallb/controller:v0.9.6
  metallb was successfully configured

Reference doc to start minikube.

Install epinio on minikube

The Epinio need two resources to works, first: one ingress-control and one cert-manager.

In order to install ingress-control use:

$ minikube addons enable ingress

read the official doc for more details.

For certManager:

$ kubectl create namespace cert-manager
$ helm repo add jetstack https://charts.jetstack.io
$ helm repo update
$ helm install cert-manager --namespace cert-manager jetstack/cert-manager \
        --set installCRDs=true \
        --set "extraArgs[0]=--enable-certificate-owner-ref=true"

After all steps above your cluster is ready to deploy epinio!!!

So let's use the helm to do it!!

$ helm repo add epinio https://epinio.github.io/helm-charts

Here! We have that to provide one global domain. As our env is a developer environment, no problem in use one magic-domain for it!

example:

192-168-49-100.sslip.io

So we set it.

$ helm install epinio -n epinio --create-namespace epinio/epinio --set global.domain=192-168-49-100.sslip.io

Good Job!! Now we need to install the epinio-cli! For it let's do:

$ curl -o epinio -L https://github.com/epinio/epinio/releases/download/v1.5.0/epinio-linux-x86_64
$ chmod +x epinio
$ sudo mv ./epinio /usr/local/bin/epinio

In order to test, use:

> epinio version
Epinio Version: v1.5.0
Go Version: go1.18

That's great!!!

Due we use one magic-domain we need modify our /etc/hosts , but no worries this step is very simple!!

sudo echo "192.168.49.2  'https://epinio.192-168-49-100.sslip.io" >> /etc/hosts

Now let's do the last command, this step able to use epinio!!

epinio login -u admin 'https://epinio.192-168-49-100.sslip.io'

Trust the certificate by pressing 'y' and 'enter'

The default password is "password". So use:

$ epinio settings show

to verify if everything has running very well

Deploy app with Epinio

first we are deploy one database service.

$ epinio service create postgresql-dev my-postgres

We can list all services deployed using:

$ epinio service list

Now let's deploy our application!!!!

inside the app path use:

epinio push --name not-api  --path ../deploy-app-with-epinio

Good links!!

Epinio Official Docs

Minikube Official Docs

Ingress Control Official Docs

Paketo Official Docs

Docs to Understand buildpacks

Troubleshooting

At the moment that you try deploy one application using Epinio, it happens somethings that is hard to understand. So you need apply some debug technics!

when you apply the commands to push one app using epinio. You can see the stage phase using:

$ kubectl describe po pod-name -n epinio

After stage phase the deploy is on the namespace workspace this is a default namespace created by epinio.

So to watch deploy, use:

$ kubectl get po -n workspace -w

If the pod found is not running, for example the status is CrashLoopBackOff

use kubectl describe again in order to see the problem.

If the pod is running but your application is not available, use:

$ kubectl logs pod-name -n workspace

to get more information about that.

When we use the postgresql service epinio native. We can get the password using the command bellow:

kubectl get secret --namespace default my-release-postgresql -o jsonpath="{.data.postgres-password}" | base64 -d

In order to access the data base outside of kubernetes we can use:

kubectl port-forward --namespace workspace svc/xbeeb293a60cdd0d4f4dac2355c57-postgresql 5435:5432 &

This will makes the port-forward. So we can use one data-base client like a Dbeaver.

In order to use one custom image in your project:

The best form that I founded is using the pack tool to do it. But this step is not so simple you need read more about that.

pack builder create oziel4ever/custom:001 --config builder.toml --publish

The flag publish will make push the image for your registry(in this case I use docker), after that you need make the epinio push using this image that you have been created.

for example:

epinio push --name not-api-custom  --path ../notifications_api --builder-image oziel4ever/custom:001

if you be using minikube, probably that the pod wont get the image, so you need use the command:

minikube ssh docker pull oziel4ever/custom:001

That's It. Thank you for reading!!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published