-
Products and Features
- How to Create and Manage VPC on CloudRaya
- Getting Started with CloudRaya Container Registry
- How to use Sudo on a CloudRaya Linux VM
- Keeping Your CloudRaya Linux VMs Up-to-Date
- Maximizing StorageRaya with Essential Practices
- Assign Multiple IP Addresses to Virtual Machine
- Generating a CloudRaya API key
- Simplify CloudRaya Management with API
- Deploying a Virtual Machine on CloudRaya
- Deploying a Kubernetes Cluster on KubeRaya
- Using StorageRaya – CloudRaya S3 Object Storage
- Opening Ping Access on Cloud Raya VM Public IP
- Maximize Your Storage Raya Access Speed with Content Delivery Network (CDN)
- How to Create Project Tag in Cloud Raya for More Organized VM Billing Report
- Exporting Cloud Raya VM to outer Cloud Raya's Infrastructure using Acronis Cyber Protect
- SSO Management on Cloud Raya
- Using the SSH key Feature in Cloud Raya Dashboard
- Cloud Raya Load Balancer, Solution to Distribute Load Equally
- Create your own VPN server with DNS-Level AdBlocker using PiVPN
- Fix Broken LetsEncrypt SSL Certificate due to Expired Root CA Certificate
- How to Make a Snapshot and Configure VM Backup in Cloud Raya
- How to Request Services or Licenses Products
- Adding, Attaching, and Resize Root Storage Disk in Cloud Raya VPS
- Managing your DNS Zone with DNS Bucket in Cloud Raya
- Create VM, Custom Package, Reinstall VM, and Adjusting Security Profile
- How to backup Linux VM via Acronis in Cloud Raya
- How to Backup Desktop Linux and Windows via Acronis in Cloud Raya
- Backing-Up Cloud Raya Windows VM Using Acronis Cyber Protect
- Load Balancing in Cloud Raya
- Establishing a VPN in Cloud Raya
- Generating an API Token
- Deploying a Virtual Machine in Cloud Raya
- Show Remaining Articles17 Collapse Articles
-
- How to backup Linux VM via Acronis in Cloud Raya
- How to Backup Desktop Linux and Windows via Acronis in Cloud Raya
-
- Maximizing StorageRaya with Essential Practices
- Using StorageRaya – CloudRaya S3 Object Storage
- Building a Static Website Using Storage Raya S3 Bucket
- Integrating S3 Storage Raya and Strapi for Asset Storage Optimization – Part 4
- Maximize Your Storage Raya Access Speed with Content Delivery Network (CDN)
- Managing Storage Raya from various tools and from various OS
- Binding NextCloud with CloudRaya S3 Object Storage as External Storage Mount
-
- How to use Sudo on a CloudRaya Linux VM
- Keeping Your CloudRaya Linux VMs Up-to-Date
- Implement Multi-Factor Authentication on CloudRaya Linux VM
- Assign Multiple IP Addresses to Virtual Machine
- Deploying a Virtual Machine on CloudRaya
- Configurating cPanel Using Ubuntu 20.04 on CloudRaya – Part 2
- Deploying cPanel Using Ubuntu 20.04 on CloudRaya - Part 1
- Exporting Cloud Raya VM to outer Cloud Raya's Infrastructure using Acronis Cyber Protect
- Using the SSH key Feature in Cloud Raya Dashboard
- Adding, Attaching, and Resize Root Storage Disk in Cloud Raya VPS
- Create VM, Custom Package, Reinstall VM, and Adjusting Security Profile
- How to backup Linux VM via Acronis in Cloud Raya
- Backing-Up Cloud Raya Windows VM Using Acronis Cyber Protect
- Deploying a Virtual Machine in Cloud Raya
-
Integration
- Implement Multi-Factor Authentication on CloudRaya Linux VM
- Accessing KubeRaya Cluster Using the Kubernetes Dashboard
- Building a Static Website Using Storage Raya S3 Bucket
- Integrating S3 Storage Raya and Strapi for Asset Storage Optimization – Part 4
- Integrating Strapi Content to Frontend React - Part 3
- Content Management with Strapi Headless CMS - Part 2
- Strapi Headless CMS Installation in CloudRaya - Part. 1
- Using SSH Key on CloudRaya VM with PuTTY
- Installing Multiple PHP Versions in One VM for More Flexible Web Development
- Replatforming Apps to K8s with RKE and GitLab CI
- OpenAI API Integration: Completions in PHP
- Building an Email Server on CloudRaya Using iRedMail
- Improving Email Delivery with Sendinblue SMTP Relay
- Building a Self Hosted Password Manager Using Passbolt
- How to Install Podman on Almalinux/Rocky Linux 9
- ElkarBackup: GUI Based backup Tools based on Rsync and Rsnapshot
- Improving Webserver Performance with SSL Termination on NGINX Load Balancer
- Using NGINX as an HTTP Load Balancer
- Automating Task with Cronjob
- Upgrade Zimbra and the OS Version
- Deploy Mailu on Rancher Kubernetes
- Export and Import Database in MySQL or MariaDB Using Mysqldump
- Backup & Sync Local and Remote Directories Using RSYNC
- Managing Storage Raya from various tools and from various OS
- Binding NextCloud with CloudRaya S3 Object Storage as External Storage Mount
- Simple monitoring and alerting with Monit on Ubuntu 22.04 LTS
- VS Code on your browser! How to install code-server on a VM
- Implementing Redis HA and Auto-Failover on Cloud Raya
- Using XFCE Desktop Environment on Cloud Raya VM
- Installing Python 3.7-3.9 on Ubuntu 22.04 Jammy LTS using PPA
- Implementing Continuous Integration with Gitlab CI and Continuous Delivery with Rancher Fleet
- Using Collabora Online on Cloud Raya NextCloud's VM
- Installing NextCloud in Cloud Raya- Detail Steps from the Beginning to the Very End
- Set Up High Availability PostgreSQL Cluster Using Patroni on Cloud Raya
- Set Up WAF KEMP in Cloud Raya Part 2
- Set Up WAF KEMP in Cloud Raya Part 1
- Using the SSH key Feature in Cloud Raya Dashboard
- Monitor Your Services Uptime Using Uptime Kuma
- Hosting Static Website with Hugo on Cloud Raya
- Kubernetes Ingress Controller using SSL in CloudRaya
- Reverse Proxy management using Nginx Proxy Manager
- Create your own VPN server with DNS-Level AdBlocker using PiVPN
- How to deploy Portainer on Linux to easily manage your docker containers
- High Availability Kubernetes Using RKE in Cloud Raya Part 3
- High Availability Kubernetes Using RKE in Cloud Raya Part 2
- High Availability Kubernetes Using RKE in Cloud Raya Part 1
- How to backup Linux VM via Acronis in Cloud Raya
- How to Backup Desktop Linux and Windows via Acronis in Cloud Raya
- Deploying Magento on Cloud Raya
- How to Install Nextcloud on Cloud Raya
- How to Install CWP in Cloud Raya
- How to Install Node.js and Launch Your First Node App
- How to install and secure MariaDB on Ubuntu 18.04 and 20.04 on Cloud Raya
- How to Install and Securing MongoDB on Ubuntu 18.04 and 20.04
- Classes: Post Installation on Ansible
- Classes: Install and Configure Ansible
- Classes: Introduction to Ansible for a robust Configuration Management
- How to Setup Active Directory Domain Service & DNS with Cloud Raya
- How to Host Your Own Docker Hub in Cloud Raya
- How to Setup Your Own Laravel with Nginx in Ubuntu 18.04
- How to Deploy Container in Cloud Raya using Docker
- Securing CentOS with iptables
- Install and Configure Squid Proxy in Ubuntu
- Installing Apache and Tomcat: A Quick Way
- Securing Ubuntu with UFW
- Install a Node.js and Launch a Node App on Ubuntu 18.04
- Installing LAMP in Ubuntu
- Installing LEMP Stack on Ubuntu 18.04
- Show Remaining Articles53 Collapse Articles
-
- Articles coming soon
-
- Implement Multi-Factor Authentication on CloudRaya Linux VM
- Configurating cPanel Using Ubuntu 20.04 on CloudRaya – Part 2
- Deploying cPanel Using Ubuntu 20.04 on CloudRaya - Part 1
- Integrating S3 Storage Raya and Strapi for Asset Storage Optimization – Part 4
- Integrating Strapi Content to Frontend React - Part 3
- Content Management with Strapi Headless CMS - Part 2
- Strapi Headless CMS Installation in CloudRaya - Part. 1
- Using SSH Key on CloudRaya VM with PuTTY
- Building an Email Server on CloudRaya Using iRedMail
- Improving Email Delivery with Sendinblue SMTP Relay
- Building a Self Hosted Password Manager Using Passbolt
- ElkarBackup: GUI Based backup Tools based on Rsync and Rsnapshot
- Improving Webserver Performance with SSL Termination on NGINX Load Balancer
- Using NGINX as an HTTP Load Balancer
- Upgrade Zimbra and the OS Version
- Deploy Mailu on Rancher Kubernetes
- Managing Storage Raya from various tools and from various OS
- Binding NextCloud with CloudRaya S3 Object Storage as External Storage Mount
- Simple monitoring and alerting with Monit on Ubuntu 22.04 LTS
- VS Code on your browser! How to install code-server on a VM
- Implementing Redis HA and Auto-Failover on Cloud Raya
- Using XFCE Desktop Environment on Cloud Raya VM
- Implementing Continuous Integration with Gitlab CI and Continuous Delivery with Rancher Fleet
- Using Collabora Online on Cloud Raya NextCloud's VM
- Installing NextCloud in Cloud Raya- Detail Steps from the Beginning to the Very End
- Set Up WAF KEMP in Cloud Raya Part 2
- Set Up WAF KEMP in Cloud Raya Part 1
- Monitor Your Services Uptime Using Uptime Kuma
- Create your own VPN server with DNS-Level AdBlocker using PiVPN
- How to deploy Portainer on Linux to easily manage your docker containers
- High Availability Kubernetes Using RKE in Cloud Raya Part 3
- High Availability Kubernetes Using RKE in Cloud Raya Part 2
- High Availability Kubernetes Using RKE in Cloud Raya Part 1
- How to Install Nextcloud on Cloud Raya
- Classes: Post Installation on Ansible
- Classes: Install and Configure Ansible
- Classes: Introduction to Ansible for a robust Configuration Management
- Connect Windows Active Directory on Cloud Raya with Azure AD
- How to Host Your Own Docker Hub in Cloud Raya
- How to Deploy Container in Cloud Raya using Docker
- Show Remaining Articles25 Collapse Articles
-
- Accessing KubeRaya Cluster Using the Kubernetes Dashboard
- Integrating S3 Storage Raya and Strapi for Asset Storage Optimization – Part 4
- Integrating Strapi Content to Frontend React - Part 3
- Content Management with Strapi Headless CMS - Part 2
- Strapi Headless CMS Installation in CloudRaya - Part. 1
- Creating Interactive Chatbot with OpenAI API in PHP
- Installing Multiple PHP Versions in One VM for More Flexible Web Development
- OpenAI API Integration: Completions in PHP
- Improving Webserver Performance with SSL Termination on NGINX Load Balancer
- Using NGINX as an HTTP Load Balancer
- Automating Task with Cronjob
- How to Deploy Django App on Cloud Raya VM Using Gunicorn, Supervisor, and Nginx
- How to Install Node.js and Launch Your First Node App
- How to Setup Your Own Laravel with Nginx in Ubuntu 18.04
- Install a Node.js and Launch a Node App on Ubuntu 18.04
-
- How to use Sudo on a CloudRaya Linux VM
- Keeping Your CloudRaya Linux VMs Up-to-Date
- Implement Multi-Factor Authentication on CloudRaya Linux VM
- Using SSH Key on CloudRaya VM with PuTTY
- Building a Self Hosted Password Manager Using Passbolt
- Improving Webserver Performance with SSL Termination on NGINX Load Balancer
- Export and Import Database in MySQL or MariaDB Using Mysqldump
- Backup & Sync Local and Remote Directories Using RSYNC
- How to Deploy Django App on Cloud Raya VM Using Gunicorn, Supervisor, and Nginx
- Set Up WAF KEMP in Cloud Raya Part 2
- Set Up WAF KEMP in Cloud Raya Part 1
- Using the SSH key Feature in Cloud Raya Dashboard
- How to backup Linux VM via Acronis in Cloud Raya
- How to Backup Desktop Linux and Windows via Acronis in Cloud Raya
- Securing CentOS with iptables
- Securing Ubuntu with UFW
- Show Remaining Articles1 Collapse Articles
-
- Configurating cPanel Using Ubuntu 20.04 on CloudRaya – Part 2
- Deploying cPanel Using Ubuntu 20.04 on CloudRaya - Part 1
- Integrating S3 Storage Raya and Strapi for Asset Storage Optimization – Part 4
- Integrating Strapi Content to Frontend React - Part 3
- Content Management with Strapi Headless CMS - Part 2
- Strapi Headless CMS Installation in CloudRaya - Part. 1
- Creating Interactive Chatbot with OpenAI API in PHP
- Installing Multiple PHP Versions in One VM for More Flexible Web Development
- Building an Email Server on CloudRaya Using iRedMail
- Building a Self Hosted Password Manager Using Passbolt
- Improving Webserver Performance with SSL Termination on NGINX Load Balancer
- Using NGINX as an HTTP Load Balancer
- Installing Python 3.7-3.9 on Ubuntu 22.04 Jammy LTS using PPA
- Reverse Proxy management using Nginx Proxy Manager
- Install and Configure Squid Proxy in Ubuntu
- Installing Apache and Tomcat: A Quick Way
- Installing LAMP in Ubuntu
- Installing LEMP Stack on Ubuntu 18.04
- Show Remaining Articles3 Collapse Articles
-
- Building a Static Website Using Storage Raya S3 Bucket
- Integrating S3 Storage Raya and Strapi for Asset Storage Optimization – Part 4
- Integrating Strapi Content to Frontend React - Part 3
- Content Management with Strapi Headless CMS - Part 2
- Strapi Headless CMS Installation in CloudRaya - Part. 1
- Creating Interactive Chatbot with OpenAI API in PHP
- Installing Multiple PHP Versions in One VM for More Flexible Web Development
- OpenAI API Integration: Completions in PHP
- Hosting Static Website with Hugo on Cloud Raya
- Deploying Magento on Cloud Raya
- How to Install CWP in Cloud Raya
- How to Setup Active Directory Domain Service & DNS with Cloud Raya
-
- Articles coming soon
Implementing Continuous Integration with Gitlab CI and Continuous Delivery with Rancher Fleet
Introduction
Before implementing the mechanism in Rancher Fleet, we need to know what we would do with the CI and CD.
In this article, continuous integration (CI) means pushing our image build through Dockerfile to the registry.
Meanwhile, continuous delivery (CD) means delivering our Kubernetes workload (deployments, services, Ingresses, etc) to the Kubernetes cluster.
The workload would be some manifest files with the .yaml extension.
Environment Set
- Cluster: a Kubernetes cluster built with RKE, please refer to the following series of articles to set up the cluster
- Repository: a public GitLab repository project
- CI Flow: create CI image build flow on branch image-build
- CD Flow: create a new branch named fleet, rancher fleet agent would monitor that
Preparation Guide
- Sign in / sign up to your Gitlab instance, then create a public repository
- Create two new branches named fleet and image-build. The fleet branch will contain the Kubernetes workload manifest files. The image-build branch will contain the Dockerfile definition to build your custom image
- Set the image-build as a protected branch, so that the Gitlab CI files could read the global variables. By default global variables could only be read by the protected branch (Configure a protected branch)
- Setting up a local GitLab runner and Gitlab CI (will be explained later in the article)
- Setting up a repository to be monitored by the rancher fleet ((will be explained later in the article)
- Writing up a Dockerfile to build a custom image
- Writing up a Gitlab CI actions
- Writing up a Kubernetes workload manifest
Building CI Mechanism
Writing a Dockerfile code
- In your image-build branch, create two folder for building custom Nginx and PHP-FPM image.
- Let’s say you’ve created folder nginx-build for building an Nginx custom image and fpm-build folder for building a PHP-FPM custom image.
- You also need to create the necessary config or file for building your custom image.
- Please see the below directory tree as a reference
![](https://cloudraya.com/wp-content/uploads/2022/07/image-7.png)
![](https://cloudraya.com/wp-content/uploads/2022/07/image-9.png)
Each file contains the following value:
fpm-build Dockerfile
FROM php:7.4-fpm
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng-dev \
vim \
libicu-dev\
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
&& docker-php-ext-install -j$(nproc) gd \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl \
&& docker-php-ext-configure mysqli \
&& docker-php-ext-install mysqli
# Use the default production configuration
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
RUN mkdir /app
COPY hello.php /app
fpm-build hello.php
<html>
<head>
<title>PHP Hello World!</title>
</head>
<body>
<?php echo '<h1>Hello World</h1>'; ?>
<?php phpinfo(); ?>
</body>
</html>
nginx-build Dockerfile
FROM nginx:latest
RUN apt-get update \
&& apt-get install inetutils-ping mariadb-client -y
Setting Up a Local Gitlab Runner
In this setup, we will install a GitLab runner in a docker container.
- Install docker engine on your local machine, please use the following link for the instruction: https://docs.docker.com/engine/install/
- Use Docker volumes to start the Runner container. First, we need to create a docker volume
docker volume create gitlab-runner-config
- Start the GitLab Runner container using the volume we just created:
docker run -d --name gitlab-runner --restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v gitlab-runner-config:/etc/gitlab-runner \
gitlab/gitlab-runner:latest
- Follow the pop up instruction to set up the config.toml on gitlab runner container. Your config.toml file should be like the following picture.
![](https://cloudraya.com/wp-content/uploads/2022/07/image.png)
- Register your runner to the Gitlab account.
- Login to your Gitlab account and navigate to Settings > CI/CD
- Expand the Runners value
- You should see the following informations
- Disable the shared runners on your settings to force all pipelines to use your registered runner
![](https://cloudraya.com/wp-content/uploads/2022/07/image-2.png)
- Take a note of your token registration for later use
- Registering your docker gitlab runner by typing the following command
docker run –rm -it -v gitlab-runner-config:/etc/gitlab-runner gitlab/gitlab-runner:latest register
- Restart your gitlab-runner container,
docker restart gitlab-runner
- You should now see your runner registered on the Gitlab project
![](https://cloudraya.com/wp-content/uploads/2022/07/image-3.png)
Writing up a Gitlab CI actions
- On your selected project, go to CI/CD > Editor > select image-build branch
- Paste the example Gitlab actions below to your editor
docker-build-php-fpm: # Name of the Job
# Official docker image.
image: docker:latest
stage: build # Define the stage as build
# Activates docker-in-docker service, which makes Docker able to run within a Docker environment
services:
- docker:dind
# Login to registry before pushing the image
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
script:
# Pull the latest/tagged image before building it from Dockerfile context
- docker build --pull -t "index.docker.io/sultanahmad/fpm:v1" ./fpm-build/
# Push the image to the docker registry
- docker push "index.docker.io/sultanahmad/fpm:v1"
only:
- image-build
docker-build-nginx:
# Official docker image.
image: docker:latest
stage: build
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD"
script:
- docker build --pull -t "index.docker.io/sultanahmad/nginx:v1" ./nginx-build/
- docker push "index.docker.io/sultanahmad/nginx:v1"
only:
- image-build
Before running the pipeline, add CI_REGISTRY_USER and CI_REGISTRY_PASSWORD variables to your Gitlab CI/CD variables setting.
To add variables to your project, please navigate to CI/CD > Variables and expand the Variables tab
After adding the variables, you should see the settings like below.
![](https://cloudraya.com/wp-content/uploads/2022/07/image-4.png)
Pipeline Run Test
In the CI/CD > Pipelines menu, you will see the list of your pipelines. You can also monitor the pipelines jobs, by clicking the Jobs tab.
If you see the passed status on your pipeline, meaning your jobs was successfully executed.
![](https://cloudraya.com/wp-content/uploads/2022/07/image-5.png)
Check your image in the registry and you should see your image update is changed.
![](https://cloudraya.com/wp-content/uploads/2022/07/image-6.png)
Building CD Mechanism
Build Kubernetes Workload Manifest File
In this section, we will write the Kubernetes workload manifest file for both nginx and fpm deployment.
Create two folders on branch fleet named nginx-deployment and fpm-deployment. Then place the nginx workload to folder nginx-workload and the fpm workload to fpm-workload.
See the example directory tree below.
![](https://cloudraya.com/wp-content/uploads/2022/07/image-10.png)
Please see the code below for reference.
Nginx Workload Manifest
nginx-configmap.yaml
apiVersion: v1
data:
sites.conf: |-
server {
listen 80;
server_name nginx.ahmadcloud.my.id www.nginx.ahmadcloud.my.id;
index index.php index.html;
error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;
root /var/www/html;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass fpm-svc:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
}
kind: ConfigMap
metadata:
name: nginx-custom-conf-test
namespace: mamad-namespace
nginx-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
namespace: mamad-namespace
spec:
progressDeadlineSeconds: 600
replicas: 2
revisionHistoryLimit: 10
## selector that match the apps deployment on rancher cluster
selector:
matchLabels:
workload.user.cattle.io/workloadselector: apps.deployment-mamad-namespace-nginx-deployment
##
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
annotations:
cattle.io/timestamp: "2022-07-22T19:06:28Z"
creationTimestamp: null
labels:
workload.user.cattle.io/workloadselector: apps.deployment-mamad-namespace-nginx-deployment
spec:
affinity: {}
containers:
- image: index.docker.io/sultanahmad/nginx:v1 # nginx custom image from CI section
imagePullPolicy: Always
name: nginx-container
ports:
- containerPort: 80
name: nginx-http
protocol: TCP
volumeMounts:
- mountPath: /var/www/html/ # the shared volume with fpm deployment
name: vol-nginx1
- mountPath: /etc/nginx/conf.d/
name: vol-nginx-configmap-test
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
volumes:
- hostPath: # shared volume using bind-mount method
path: /mnt/mamad-volume # path of the volume on the rancher host
type: DirectoryOrCreate
name: vol-nginx1
- configMap: # configmap for custom nginx configuration
defaultMode: 420
name: nginx-custom-conf-test
optional: false
name: vol-nginx-configmap-test
nginx-service.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
field.cattle.io/targetWorkloadIds: '["mamad-namespace/nginx-deployment"]'
management.cattle.io/ui-managed: "true"
name: nginx-deployment
namespace: mamad-namespace
spec:
ports:
- name: nginx-http
port: 80
protocol: TCP
targetPort: 80
## selector that match the apps deployment on rancher cluster
selector:
workload.user.cattle.io/workloadselector: apps.deployment-mamad-namespace-nginx-deployment
##
sessionAffinity: None
type: ClusterIP
nginx-ingress.yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress-test
namespace: mamad-namespace
spec:
ingressClassName: nginx
rules:
- host: nginx.ahmadcloud.my.id
http:
paths:
- backend:
service:
name: nginx-deployment
port:
number: 80
path: /hello.php
pathType: Prefix
tls:
- hosts:
- nginx.ahmadcloud.my.id
secretName: nginx.ahmadcloud.my.id
FPM Workload Manifest
fpm-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
workload.user.cattle.io/workloadselector: apps.deployment-mamad-namespace-fpm-test
name: fpm-test
namespace: mamad-namespace
spec:
progressDeadlineSeconds: 600
replicas: 2
revisionHistoryLimit: 10
selector:
matchLabels:
workload.user.cattle.io/workloadselector: apps.deployment-mamad-namespace-fpm-test
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
workload.user.cattle.io/workloadselector: apps.deployment-mamad-namespace-fpm-test
spec:
affinity: {}
containers:
- image: index.docker.io/sultanahmad/fpm:v1
imagePullPolicy: Always
## Command to copy all files from directory /app to /var/www/html
lifecycle:
postStart:
exec:
command:
- sh
- -c
- cp -r /app/* /var/www/html
##
name: fpm-test
ports:
- containerPort: 9000
name: fpm-port
protocol: TCP
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /var/www/html
name: vol-fpm1
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
## Persistance Volume with hostpath method
volumes:
- hostPath:
path: /mnt/mamad-volume # shared volume mount point
type: ""
name: vol-fpm1
fpm-service.yaml
apiVersion: v1
kind: Service
metadata:
annotations:
field.cattle.io/targetWorkloadIds: '["mamad-namespace/fpm-test"]'
management.cattle.io/ui-managed: "true"
name: fpm-svc
namespace: mamad-namespace
spec:
ports:
- name: fpm-port
port: 9000
protocol: TCP
targetPort: 9000
## selector that match workload in rancher
selector:
workload.user.cattle.io/workloadselector: apps.deployment-mamad-namespace-fpm-test
##
sessionAffinity: None
type: ClusterIP
Setting Up Rancher Fleet
In this section, we will use the continuous delivery feature that rancher provided.
- Login to rancher dashboard and choose continuous delivery.
- set the namespace view to fleet-local and input the following information.
![](https://cloudraya.com/wp-content/uploads/2022/07/image-11.png)
Test Result
![](https://cloudraya.com/wp-content/uploads/2022/07/image-12.png)
![](https://cloudraya.com/wp-content/uploads/2022/07/image-13.png)
![](https://cloudraya.com/wp-content/uploads/2022/07/image-14.png)
![](https://cloudraya.com/wp-content/uploads/2022/07/image-15.png)
![](https://cloudraya.com/wp-content/uploads/2022/07/image-16.png)
Conclusion
In some way, you might need to add an SSL Certificate on your ingress domain.
You could achieve that setup by following this tutorial – Kubernetes Ingress Controller using SSL in Cloud Raya.
I hope you find this article helpful. Please do not be hesitate to look for other references from our Knowledge Base. For tutorial that you can video-stream, please vsit our Youtube Channel.