SpringBoot基于 Docker 安装 FastDFS

SpringBoot基于 Docker 安装 FastDFS

环境准备

所需全部环境配置文件已上传至群中,通过首页扫码加群下载即可

  • libfastcommon.tar.gz
  • fastdfs-5.11.tar.gz
  • nginx-1.13.6.tar.gz
  • fastdfs-nginx-module_v1.16.tar.gz

创建工作目录

在 Linux 服务器上创建 /usr/local/docker/fastdfs/environmen 目录

说明:

  • /usr/local/docker/fastdfs:用于存放 docker-compose.yml 配置文件及 FastDFS 的数据卷
  • /usr/local/docker/fastdfs/environmen:用于存放 Dockerfile 镜像配置文件及 FastDFS 所需环境

docker-compose.yml

version: '3.7'
services:
  fastdfs:
    build: environment
    restart: always
    container_name: fastdfs
    volumes:
      - ./storage:/fastdfs/storage
    network_mode: host

Dockerfile

FROM ubuntu:xenial
MAINTAINER topsale@vip.qq.com

# 更新数据源
WORKDIR /etc/apt
RUN echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse' > sources.list
RUN echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse' >> sources.list
RUN echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse' >> sources.list
RUN echo 'deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse' >> sources.list
RUN apt-get update

# 安装依赖
RUN apt-get install make gcc libpcre3-dev zlib1g-dev --assume-yes

# 复制工具包
ADD fastdfs-5.11.tar.gz /usr/local/src
ADD fastdfs-nginx-module_v1.16.tar.gz /usr/local/src
ADD libfastcommon.tar.gz /usr/local/src
ADD nginx-1.13.6.tar.gz /usr/local/src

# 安装 libfastcommon
WORKDIR /usr/local/src/libfastcommon
RUN ./make.sh && ./make.sh install

# 安装 FastDFS
WORKDIR /usr/local/src/fastdfs-5.11
RUN ./make.sh && ./make.sh install

# 配置 FastDFS 跟踪器
ADD tracker.conf /etc/fdfs
RUN mkdir -p /fastdfs/tracker

# 配置 FastDFS 存储
ADD storage.conf /etc/fdfs
RUN mkdir -p /fastdfs/storage

# 配置 FastDFS 客户端
ADD client.conf /etc/fdfs

# 配置 fastdfs-nginx-module
ADD config /usr/local/src/fastdfs-nginx-module/src

# FastDFS 与 Nginx 集成
WORKDIR /usr/local/src/nginx-1.13.6
RUN ./configure --add-module=/usr/local/src/fastdfs-nginx-module/src
RUN make && make install
ADD mod_fastdfs.conf /etc/fdfs

WORKDIR /usr/local/src/fastdfs-5.11/conf
RUN cp http.conf mime.types /etc/fdfs/

# 配置 Nginx
ADD nginx.conf /usr/local/nginx/conf

COPY entrypoint.sh /usr/local/bin/
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]

WORKDIR /
EXPOSE 8888
CMD ["/bin/bash"]

entrypoint.sh

#!/bin/sh
/etc/init.d/fdfs_trackerd start
/etc/init.d/fdfs_storaged start
/usr/local/nginx/sbin/nginx -g 'daemon off;'

注:Shell 创建后是无法直接使用的,需要赋予执行的权限,使用 chmod +x entrypoint.sh 命令

各种配置文件说明

tracker.conf

FastDFS 跟踪器配置,容器中路径为:/etc/fdfs,修改为:

base_path=/fastdfs/tracker

storage.conf

FastDFS 存储配置,容器中路径为:/etc/fdfs,修改为:

base_path=/fastdfs/storage
store_path0=/fastdfs/storage
tracker_server=192.168.100.167:22122
http.server_port=8888

client.conf

FastDFS 客户端配置,容器中路径为:/etc/fdfs,修改为:

base_path=/fastdfs/tracker
tracker_server=192.168.100.167:22122

config

fastdfs-nginx-module 配置文件,容器中路径为:/usr/local/src/fastdfs-nginx-module/src,修改为:

# 修改前
CORE_INCS="$CORE_INCS /usr/local/include/fastdfs /usr/local/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/local/lib -lfastcommon -lfdfsclient"

# 修改后
CORE_INCS="$CORE_INCS /usr/include/fastdfs /usr/include/fastcommon/"
CORE_LIBS="$CORE_LIBS -L/usr/lib -lfastcommon -lfdfsclient"

mod_fastdfs.conf

fastdfs-nginx-module 配置文件,容器中路径为:/usr/local/src/fastdfs-nginx-module/src,修改为:

connect_timeout=10
tracker_server=192.168.100.167:22122
url_have_group_name = true
store_path0=/fastdfs/storage

nginx.conf

Nginx 配置文件,容器中路径为:/usr/local/src/nginx-1.13.6/conf,修改为:

user  root;
worker_processes  1;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    sendfile        on;

    keepalive_timeout  65;

    server {
        listen       8888;
        server_name  localhost;

        location ~/group([0-9])/M00 {
            ngx_fastdfs_module;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

启动容器

docker-compose up -d

测试上传

交互式进入容器

docker exec -it fastdfs /bin/bash

测试文件上传

/usr/bin/fdfs_upload_file /etc/fdfs/client.conf /usr/local/src/fastdfs-5.11/INSTALL

服务器反馈上传地址

group1/M00/00/00/wKhLi1oHVMCAT2vrAAAeSwu9TgM3976771

测试 Nginx 访问

http://192.168.100.167:8888/group1/M00/00/00/wKhLi1oHVMCAT2vrAAAeSwu9TgM3976771
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
【资源说明】 1、基于SpringBoot+Vue 驾校理论课模拟考试系统(自动化部署)源码+项目说明.zip 2、该资源包括项目的全部源码,下载可以直接使用! 3、本项目适合作为计算机、数学、电子信息等专业的课程设计、期末大作业和毕设项目,作为参考资料学习借鉴。 4、本资源作为“参考资料”如果需要实现其他功能,需要能看懂代码,并且热爱钻研,自行调试。 基于SpringBoot+Vue 驾校理论课模拟考试系统(自动化部署)源码+项目说明.zip ## 驾校理论课模拟考试系统 ## 工具 Git Npm Lombok ## CI/CD **具体部署流程看/ServerDeploy/服务器部署流程.txt** Jenkins + Docker 持续集成 ![11](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%8715.png) ### 技术栈 1.后端: ​ 权限控制:SpringSecurity + JWT ​ Ioc框架:SpringBoot ​ 持久层:MybatisPlus + Spring Data JPA ​ 缓存:Redis ​ 图片处理:FastDFS ​ 定时任务:xxl-job 2.前端: ​ Vue、Element-UI ## 功能 系统五个功能模块为:试题管理模块、系统监控模块、模拟考试模块、系统管理模块、个人信息模块。 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%871.png) ## 登录 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%872.png) ### **模拟考试模块** **小车(c1,c2)、货车(b2)、客车(a1)** **包含科目一 科目四试题** 1.顺序练习 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%879.png) 2.随机练习 3.专项练习:按照单选题和判断题划分。 4.模拟考试:随机100道题,计时45分钟。 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%8710.png) ### **试题管理模块** 1.试题字典:按照指定条件搜索,添加、修改、删除试题(管理员权限)。 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%874.png) 添加/修改试题: ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%8712.png) 2.推荐试题:按照后台针对用户错题进行计算返回的一定数目的试题。 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%873.png) ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%875.png) 3.我的错题:每次用户计算错题后进行记录。 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%876.png) 4.我的收藏:用户收藏的试题。 ![1](https://raw.githubusercontent.com/1170159634/Mockexam-Server/master/images/%E5%9B%BE%E7%89%877.png)

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值