子苓°

CentOS 7上使用docker安装pydio单元
Install pydio cells with docker on CentOS 7.Recently, I'v...
扫描右侧二维码阅读全文
20
2019/10

CentOS 7上使用docker安装pydio单元

Install pydio cells with docker on CentOS 7.

Recently, I've tried several types of self-hosted cloud services. Today,
I'll share you about how to set up a 
pydio cells
 server.

Install

According to official docs, to set up your personal secured
 
pydio
, you need two things.

  1. Docker installed.
  2. A valid ssl certificate, for safety.

Assume that you have already got a valid ssl certificate from somewhere,
for example, 
Let's encrypt
.

Now, we're about to start our dockers, there are four dockers which we
need to start for pydio instance:

  1. A database: in this tutorial, we will use mariadb.
  2. A php-fpm service for 
    pydio cells
     frontend.
  3. A pydio-cell core service.
  4. A reverse proxy front of pydio service, in this tutorial we will use caddy.

The shell below will setup all four services that are required for a pydio
instance automatically. So just open a ssl console window to your server,
copy and paste those commands to execute.

export DB_PW=P@ssw0rd
export HOST_NAME=pydio.domain.com
export HTTP_PORT=12080
export HTTPS_PORT=12443
export SSL_CRT_FILE=/root/.acme.sh/*.domain.com/*.domain.com.cer
export SSL_KEY_FILE=/root/.acme.sh/*.domain.com/*.domain.com.key
export TIMEZONE=Asia/Shanghai
export DB_ROOT=/data/pydio-cells/mariadb
export CELLS_ROOT=/data/pydio-cells/cells
export CADDY_ROOT=/data/pydio-cells/caddy
export PHP_FPM_ROOT=/data/pydio-cells/php-fpm

docker network create --driver bridge --subnet 172.22.6.0/24 pydio-cells

mkdir -p $CADDY_ROOT
cat <<EOF > $CADDY_ROOT/Caddyfile
0.0.0.0:$HTTP_PORT {
    redir https://{hostonly}:$HTTPS_PORT{path}
}

0.0.0.0:$HTTPS_PORT {
    log stdout

    tls /etc/ssl/ssl.crt /etc/ssl/ssl.key

    timeouts 0

    # And the rest to pydio
    proxy / https://pydio-cells:$HTTPS_PORT {
        insecure_skip_verify
        transparent
        websocket
        header_upstream Host $HOST_NAME:$HTTPS_PORT
    }
}
EOF

mkdir -p $PHP_FPM_ROOT
cat <<EOF > $PHP_FPM_ROOT/docker-php-ext-timezone.ini
date.timezone = "$TIMEZONE"
EOF

docker run -d --restart=always \
  --name pydio-cells-mariadb \
  --network pydio-cells \
  --hostname pydio-cells-mariadb \
  -v /etc/localtime:/etc/localtime:ro \
  -v $DB_ROOT:/var/lib/mysql \
  -p 12306:3306 \
  -e MYSQL_ROOT_PASSWORD=$DB_PW mariadb

docker run -d --restart=always \
  --name pydio-cells-fpm \
  --network pydio-cells \
  --hostname pydio-cells-fpm \
  --link pydio-cells-mariadb:mariadb \
  -v /etc/localtime:/etc/localtime:ro \
  -v $PHP_FPM_ROOT/docker-php-ext-timezone.ini:/usr/local/etc/php/conf.d/docker-php-ext-timezone.ini:ro \
  -v $CELLS_ROOT:/root/.config/pydio/cells pydio/cells-php-fpm
docker exec -t pydio-cells-fpm apk add --no-cache icu-dev
docker exec -t pydio-cells-fpm docker-php-ext-configure intl
docker exec -t pydio-cells-fpm docker-php-ext-install -j$(grep -c ^processor /proc/cpuinfo 2>/dev/null || 1) intl

docker run -d --restart=always \
  --name pydio-cells \
  --network pydio-cells \
  --hostname pydio-cells \
  --link pydio-cells-fpm:php-fpm \
  --link pydio-cells-mariadb:mariadb \
  -v /etc/localtime:/etc/localtime:ro \
  -v $CELLS_ROOT:/root/.config/pydio/cells \
  -e CELLS_NO_SSL=0 \
  -e CELLS_BIND=$HOST_NAME:$HTTPS_PORT \
  -e CELLS_EXTERNAL=$HOST_NAME:$HTTPS_PORT \
  pydio/cells

docker restart pydio-cells-fpm

docker run -d \
  --name pydio-cells-caddy \
  --network pydio-cells \
  --hostname pydio-cells-caddy \
  --link pydio-cells:pydio-cells \
  -v /etc/localtime:/etc/localtime:ro \
  -v $CADDY_ROOT/Caddyfile:/etc/Caddyfile \
  -v $SSL_CRT_FILE:/etc/ssl/ssl.crt:ro \
  -v $SSL_KEY_FILE:/etc/ssl/ssl.key:ro \
  -p $HTTP_PORT:$HTTP_PORT \
  -p $HTTPS_PORT:$HTTPS_PORT \
  abiosoft/caddy

Wait for pydio cells server initialize for about half minute, you'll able
to visit

https://pydio.domain.com:12443/ to get install start.

In web installation pages, you may need the information below:

database host: mariadb
php-fpm location: pydio-fpm:9000

How to uninstall

Just simply run this code below in shell. If you have changed pydio folder location in install, modify the rm command by yourself.

# uninstall

docker stop pydio-cells-caddy && docker rm pydio-cells-caddy
docker stop pydio-cells && docker rm pydio-cells
docker stop pydio-cells-fpm && docker rm pydio-cells-fpm
docker stop pydio-cells-mariadb && docker rm pydio-cells-mariadb
rm -rf /data/pydio-cells/cells
rm -rf /data/pydio-cells/mariadb

docker rmi mariadb
docker rmi pydio/cells-php-fpm
docker rmi pydio/cells
docker rmi abiosoft/caddy
docker network rm pydio-cells
Last modification:October 20th, 2019 at 08:23 pm
如果觉得我的文章对你有用,请随意赞赏

Leave a Comment