Buy Me a Coffee

[Dokku] Network understanding

When I ran up Dokku container, I map the host port 8080 to Dokku container port 80. With this configuration, all external requests to Dokku have to reach the host port 8080 first and then they can reach the app deployed by Dokku. In Dokku container, Dokku server still listens to the port 80, 443, 22. Therefore, the port mapping from host to Dokku container looks like 8080:80 8443:443 5022:22 Again in Dokku container, the app’s nginx should listen to port 80. It’s because external requests will hit host port 8080, then will be converted to Dokku container port 80. Afterwards, Dokku app’s nginx can detect the requests and route them to the matching app according to the domain name. ...

[Dokku] How to install Dokku with Portainer

We can easily figure out how to set up Dokku by following the instructions on Dokku website. But for me, I like to host services in docker container as it will bring a clearer structure when it comes to host multiple services in a single machine. In this post, I will assume that you already had some idea about what Dokku is. If not, you can find more information here. In the title, I also mentioned another tool called Portainer. Basically it is a management tool of docker container and kubernete cluster with UI. But it is actually much more than that. (I feel I am digging a bit hole while introducing more and more tools). ...

[DroneCI] How to Configure Pipeline to Build and Push Docker Image

Sometimes we need to build Dockerfile to the docker image and push it to registry in CI pipeline. For instance, my development environment is windows/amd64, but my VPS is linux/arm64. At the end, I want to host the service in my VPS. Thus, it will be easy to build the docker image inside the CI pipeline. In this post, I will show how to configure the pipeline to build and push docker image in DroneCI, which is a self-service Continuous Integration platform for busy development teams. ...

[Golang] Direct request from http to https with reverse proxy

Let’s say we have a reverse proxy. The incoming request is HTTP, the target server hosts HTTPs APIs with self-signed TLS certificates. It is very common that we change the URL host or path with reverse proxy, so that the request can be directed a different API. However, in this case, we also need to add the self-signed certificates in reverse proxy. The below example will show how to achieve it. ...

[Nomad] How to mount the host path to docker task

Recently I came across a problem where I need to share the host path to Nomad docker task. I have to say that the official document about this part does not explain very clear. I spent quite long time to find the solution. Note that this is not about mounting the host volume to Nomad docker task. Just mount pure folder in host filesystem to Nomad docker task. It is equivalent to the docker command like ...

[Notepad++/Linux] How to install notepad++ on Ubuntu without using Snap

There is a way to use Windows software in Ubuntu platform, which is by using Wine. Notepad++ is one of such softwares. Of course, we also can install with Ubuntu Software store which uses Snap. However, it didn’t work as well as in Windows. So I choose the other way. Let’s kick off by opening the Terminal first. By the way, I’m using Ubuntu 20.04 # Add Wine GPG Key wget -O - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add - # Add apt repository sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main' # Install Wine on Linux sudo apt install --install-recommends winehq-stable # Set prefix export WINEARCH=win32 export WINEPREFIX=~/.wine32 Next, we need to download Notepad++ from https://notepad-plus-plus.org/downloads. Just choose Installer. ...

[VSCode] Golang No definition found

I have been using VS Code to develop Golang program for few years, and recently the issue “no definition found” bothered me a lot. At the beginning, the issue only happens in the mixed project where the go.mod is in the sub-directory under the root path. With this case, I still can use navigation feature to jump the editor among struct definition, function implementation or packages by opening the go.mod path as the root directory with VS Code. However, it even does not work in this way, which pushes me to solve the problem completely. ...

[Nomad] source path must be a file

When I run up a nomad job with the job file “example.nomad” created by nomad job init, the below error showed up Error getting job struct: Error getting jobfile from "example.nomad": source path must be a file The completed commands are: nomad job init # example.nomad is created nomad job run example.nomad # error pops up This issue stuck me for a while as I clearly remember that I successfully ran it up before. And these are very basic commands to play with Nomad set up. ...

Helm Handbook (🚧Continuous Update)

Helm is the package manager for Kubernetes. We can download it from here Take the public repository portainer/k8s as an example 1. Render the helm chart locally Open the terminal under the path github.com/portainer/k8s/charts helm template portainer/ # Render the chart with configurable argument helm template portainer/ --set image.tag="2.6.0" helm template portainer/ --set enterpriseEdition.enabled=true --set enterpriseEdition.image.tag="2.7.0" 2. Install helm chart helm install --create-namespace -n portainer portainer portainer/portainer 3. Install helm chart with local repository helm install --create-namespace -n portainer portainer-local portainer/ \ --values portainer/values.yaml # with argument helm install --set image.tag="2.6.0" --create-namespace \ -n portainer portainer-2-6 portainer/ \ --values portainer/values.yaml 4. helm chart repo # Add repo helm repo add <repo_name> https://portainer.github.io/k8s/ helm repo update # Remove repo helm repo remove <repo_name> 5. Delete helm namespace helm delete -n portainer portainer 6. List helm namespace helm ls --all-namespaces

Minikube Handbook (🚧Continuous Update)

Where to start? https://minikube.sigs.k8s.io/docs/start/ 1. Create kubernetes cluster # Specify the kubernetes version minikube start --kubernetes-version=v1.22.3 # Create second cluster minikube start -p minikube2 --kubernetes-version=v1.22.3 2. Create nginx ingress service kubectl create deployment ingress-nginx --image=k8s.gcr.io/ingress-nginx/controller kubectl expose deployment ingress-nginx --type=LoadBalancer --port=30777 3. General commands kubectl get pods -n portainer kubectl get svc -n portainer kubectl get events -n portainer kubectl logs -n portainer portainer-local-7c9f9d6897-jn97c kubectl get deployment -n portainer -o wide kubectl get --namespace portainer svc -w portainer kubectl port-forward -n portainer service/portainer 7080:9000 kubectl get --namespace portainer -o jsonpath="{.spec.ports[1].nodePort}" services portainer kubectl get nodes --namespace portainer -o jsonpath="{.items[0].status.addresses[0].address}" 4. Install and uninstall minkube cluster sudo dpkg -i minikube_latest_amd64.deb sudo dpkg --purge minikube

DigitalOcean Referral Badge
Sign up to get $200, 60-day account credit !