使用k8s部署RainLoop-Webmail

说明

* rainloop最新源码官方下载地址:https://www.rainloop.net/downloads/
* 系统要求:https://www.rainloop.net/docs/system-requirements/
* 安装文档:https://www.rainloop.net/docs/installation/
* 更多详细资料请查看官方文档
* docker镜像构建方法来源github:https://github.com/sauloaldocker/docker-rainloop

在这里插入图片描述

config说明

* config下所有文件均来源于:https://github.com/sauloaldocker/docker-rainloop
* 只有php启动脚本不一致,脚本如下:
* 无用,仅供参考


#!/bin/sh
exec 2>&1
#exec /usr/sbin/php5-fpm --fpm-config /etc/php5/fpm/php-fpm.conf

exec /usr/sbin/php7.4-fpm --fpm-config /etc/php/7.4/fpm/php-fpm.conf

Dockerfile


## Debian 7,对应PHP5
##FROM ahmet2mir/debian:wheezy
##ENV RELEASE wheezy

#
## Debian 11,对应PHP7
#FROM debian:bullseye
#ENV RELEASE bullseye
#
#
#ENV DEBIAN_FRONTEND noninteractive
#ENV SHELL /bin/bash
#
## Curl extension
##RUN apt-get update && apt-get install -y nginx php5-fpm php5-curl php5-sqlite php5-json
#
## Update PHP extensions to a compatible version
#RUN apt-get update && apt-get install -y nginx php7.4-fpm php7.4-curl libsqlite3-dev php7.4-json
#

#
#
## Adding files
#ADD . /
#
#RUN mkdir -p /webapps/logs/rainloop && \
#    mkdir -p /etc/service/ && \
#    mv  /rainloop /webapps && \
#	find /webapps/rainloop -type d -exec chmod 755 {} \; && \
#	find /webapps/rainloop -type f -exec chmod 644 {} \; && \
#	chown -R www-data:www-data /webapps/rainloop && \
#	cp -f /config/nginx.conf /etc/nginx/nginx.conf &&  \
#	cp -f /config/nginx-rainloop.conf /etc/nginx/sites-available/rainloop.conf &&  \
#	ln -s /etc/nginx/sites-available/rainloop.conf /etc/nginx/sites-enabled/rainloop.conf && \
##	sed -i 's/;daemonize = yes/daemonize = no/g' /etc/php5/fpm/php-fpm.conf
#    sed -i 's/;daemonize = yes/daemonize = no/g'  /etc/php/7.4/fpm/php-fpm.conf
#
## "Configure services"
## Based on https://github.com/mingfang/docker-salt
#RUN for dir in /config/service/*;\
#    do echo $dir; chmod +x $dir/run $dir/log/run;\
#    ln -sf $dir /etc/service/; done
#
## Expose services
#EXPOSE 22 80

# 使用php5无法打包成功,使用php7可以成功打包但是无法正常启动
# 所以,直接使用原始镜像,再修改里面的rainloop源码,方便自定义二次开发改造
# 实际config下面的文件没有用到,只需要rainloop源码即可


# 基础镜像来源:https://github.com/sauloaldocker/docker-rainloop
FROM ahmet2mir/rainloop

## 基础镜像中的源码非最新版,这里直接删除原来文件替换为最新版的源码
RUN rm -rf /webapps/rainloop/*

## 添加新文件
ADD ./rainloop /webapps/rainloop

## 设置权限
RUN find /webapps/rainloop -type d -exec chmod 755 {} \;
RUN find /webapps/rainloop -type f -exec chmod 644 {} \;
RUN chown -R www-data:www-data /webapps/rainloop

# Expose services
EXPOSE 22 80

构建镜像

docker build -t rainloop:1001 -f Dockerfile .

Deployment.yaml

## 创建pvc
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: pvc-rainloop-data-volume
  namespace: rainloop
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 10Gi
---
## 创建Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: rainloop
  name: rainloop
  namespace: rainloop
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  selector:
    matchLabels:
      app: rainloop
  strategy:
    rollingUpdate:
      maxSurge: 50%
      maxUnavailable: 50%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: rainloop
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: project.node
                    operator: In
                    values:
                      - rainloop
      volumes:
        - name: timezone
          hostPath:
            path: /usr/share/zoneinfo/Asia/Shanghai
        - name: data-volume
          persistentVolumeClaim:
            claimName: pvc-rainloop-data-volume
      containers:
        - env:
            - name: HOSTNAME
              value: "rainloop"
            - name: TZ
              value: Asia/Shanghai
          image: rainloop:1001
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 80
          name: rainloop
          hostname: rainloop
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - name: timezone
              mountPath: /etc/localtime
              # 将配置信息存在pvc中,防止重启后原来配置丢失
            - name: data-volume
              mountPath: /webapps/rainloop/data
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      terminationGracePeriodSeconds: 30

## 创建service
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: service-rainloop
  name: service-rainloop
  namespace: rainloop
spec:
  ports:
    - name: rainloop
      port: 80
      targetPort: 80
      nodePort: 30080
  selector:
    app: rainloop
  sessionAffinity: None
  type: NodePort

使用

* 先登录管理后台进行配置:ip:port/?admin,例如:http://127.0.0.1:30080/?admin
* 默认账号:admin,默认密码:12345,注意及时登录后台修改默认密码



* 普通用户使用登录:ip:port,例如:http://127.0.0.1:30080
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值