2021SC@SDUSC
0.项目简介"山大智云"是以网盘功能为基础的在线应用系统。以seafile开源版本为基础,拓展网盘的应用功能和场景化的业务适配。
该项目已事先校园统一认证,文件锁,在线编辑预览,全文搜索,文件病毒扫描,审计,离线上传等功能。
1.项目配置 1.0 安装Ubuntu18.04 1.1 安装Dockerapt install docker.server1.2 创建Docker容器
docker run -it -p 8000:8000 -p 8080:8080 -p 8082:8082 -p 3000:3000 -p 9200:9200 --name seafile-ce-env ubuntu:18.04 bash1.3 安装中文语言
apt-get install language-pack-zh-hans locale-gen zh_CN.UTF-8 echo "export LC_ALL=zh_CN.UTF-8">>/root/.bashrc source /root/.bashrc1.4 安装先决条件
apt-get update && apt-get upgrade -y apt-get install -y ssh libevent-dev libcurl4-openssl-dev libglib2.0-dev uuid-dev intltool libsqlite3-dev libmysqlclient-dev libarchive-dev libtool libjansson-dev valac libfuse-dev python-dateutil cmake re2c flex sqlite3 python-pip python-simplejson git libssl-dev libldap2-dev libonig-dev vim vim-scripts wget cmake gcc autoconf automake mysql-client librados-dev libxml2-dev curl sudo telnet netcat unzip netbase ca-certificates apt-transport-https build-essential libxslt1-dev libffi-dev libpcre3-dev libz-dev xz-utils nginx pkg-config poppler-utils libmemcached-dev openjdk-11-jdk aria2 sudo curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - apt-get install -y nodejs apt-get install -y python3-pip python3.6 python3.6-dev python3.6 -m pip install --upgrade pip rm /usr/bin/python rm /usr/bin/python3 ln -s /usr/bin/python3.6 /usr/bin/python ln -s /usr/bin/python3.6 /usr/bin/python3 rm /usr/bin/pip rm /usr/bin/pip3 ln -s /usr/local/bin/pip3.6 /usr/bin/pip ln -s /usr/local/bin/pip3.6 /usr/bin/pip3 pip install python-cas djangosaml2 cffi sqlalchemy pymysql pillow pycryptodome configparser pylibmc django-pylibmc elasticsearch==5.5.0 elasticsearch-dsl==5.4.0 Django==2.2.14 future captcha django-statici18n django-post_office==3.3.0 django-webpack_loader==0.7.0 gunicorn mysqlclient django-picklefield==2.1.1 openpyxl qrcode django-formtools django-simple-captcha djangorestframework==3.11.1 python-dateutil requests pillow pyjwt pycryptodome requests_oauthlib mock nose exam splinter pytest pytest-django1.5 准备数据库
apt-get install -y mariadb-server service mysql start mysqladmin -u root password 123456
create database ccnet charset utf8; create database seafile charset utf8; create database seahub charset utf8;
CREATE USER 'master'@'localhost' IDENTIFIED BY '123456'; GRANT ALL PRIVILEGES ON *.* TO 'master'@'localhost';1.6 下载源文件
cd ~/ mkdir -p ~/dev/source-code cd ~/dev/source-code git clone https://github.com/SDU-NetdiskTeam/libevhtp.git git clone https://github.com/SDU-NetdiskTeam/libsearpc.git git clone https://github.com/SDU-NetdiskTeam/seafile-server.git git clone https://github.com/SDU-NetdiskTeam/seahub.git git clone https://github.com/SDU-NetdiskTeam/seahub-extra.git seahub_extra git clone https://github.com/SDU-NetdiskTeam/pro-set.git pro git clone https://github.com/SDU-NetdiskTeam/seafdav.git cd libsearpc/ git checkout 8.0 cd ../seafile-server git checkout develop cd ../seahub git checkout develop1.7 编译并安装
cd ../libevhtp cmake -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF . make make install ldconfig cd ../libsearpc ./autogen.sh ./configure make make install ldconfig cd ../seafile-server ./autogen.sh ./configure --disable-fuse make make install ldconfig1.8 创建配置文件
mkdir ~/dev/conf cd ~/dev/conf cat > ccnet.conf <seahub_settings.py < seafevents.conf < seafile.conf < seafdav.conf < 1.9 各种环境配置 seafile-server 启动 service mysql start seaf-server -c /root/dev/conf -d /root/dev/seafile-data -D all -f -l - &关闭kill `ps -aux | grep seaf-server | sed -n 1p | awk '{print $2}'`seahubcd ~/dev/source-code/seahub/ export PYTHonPATH=/usr/local/lib/python3.6/site-packages/:/root/dev/source-code/seahub/thirdpart:$PYTHonPATH export PYTHonPATH=/root/dev/source-code:/root/dev/source-code/pro/python:$PYTHonPATH export CCNET_CONF_DIR=/root/dev/conf export SEAFILE_CONF_DIR=/root/dev/seafile-data export SEAFILE_CENTRAL_CONF_DIR=/root/dev/conf export SEAFES_DIR=/root/dev/source-code/pro/python/seafes export SEAHUB_DIR=/root/dev/source-code/seahub export SEAHUB_LOG_DIR=/root/dev/logspython manage.py migrate cd ../*_extra mysqluse seahub; source raw_table_sql.sqlpython manage.py createsuperuserseahub-frontendcd ~/dev/souece-code/seahub/frontend npm i core-js@2.6.9 -D npm install npm audit fix # 这步可省略 npm run-script build cd .. make clean make distvim /root/dev/conf/seahub_settings.pyimport os PROJECT_ROOT = '/root/dev/source-code/seahub' WEBPACK_LOADER = { 'DEFAULT': { 'BUNDLE_DIR_NAME': 'frontend/', 'STATS_FILE': os.path.join(PROJECT_ROOT, 'frontend/webpack-stats.dev.json'), } } DEBUG = Trueseafeventscp /root/dev/source-code/pro/python/seafevents/main.py /root/dev/source-code/pro/python/seafevents/seafile_events.py cat > /root/dev/source-code/pro/python/seafevents/run.sh << EOD #!/bin/bash # Your ccnet conf dir export CCNET_CONF_DIR=/root/dev/conf # Your seafile conf dir export SEAFILE_CONF_DIR=/root/dev/seafile-data # Your extra python path. export PYTHonPATH=/usr/local/lib/python3.6/site-packages/:/root/dev/source-code/seahub/thirdpart:/root/dev/source-code:/root/dev/source-code/pro/python:/usr/local/lib/python3.6/site-packages/:/root/dev/source-code/seahub/thirdpart: export PYTHonPATH=/root/dev/source-code:/root/dev/source-code/pro/python:/root/dev/source-code:/root/dev/source-code/pro/python:/usr/local/lib/python3.6/site-packages/:/root/dev/source-code/seahub/thirdpart: pkill -f "python seafile_events.py" python seafile_events.py --loglevel=info --logfile=/root/dev/logs/events.log --reconnect --config-file=/root/dev/conf/seafevents.conf EOD chmod +x /root/dev/source-code/pro/python/seafevents/run.shseafdavvim /root/dev/source-code/seafdav/run.sh#!/bin/bash export CCNET_CONF_DIR=/root/dev/conf export SEAFILE_CONF_DIR=/root/dev/seafile-data export SEAFILE_CENTRAL_CONF_DIR=/root/dev/conf export PYTHonPATH=/usr/local/lib/python3.6/site-packages/:/root/dev/source-code/seahub/thirdpart:$PYTHonPATH export PYTHonPATH=/root/dev/source-code:/root/dev/source-code/pro/python:$CCNET_CONF_DIR:$PYTHonPATH TOP_DIR=$(python -c "import os; print(os.path.dirname(os.path.realpath('$0')))") cd "$TOP_DIR" python -m wsgidav.server.server_cli --host=0.0.0.0 --port=8080 --root=/ --server=gunicornchmod +x /root/dev/source-code/seafdav/run.sh1.10 项目启动cd /root/dev/source-code/(对应模块) ./run.sh2.项目预览 3.组内分工本人负责 seafobj模块及其相关部分
seafobj是seafile的面向对象工具组,用于访问seafile数据模型的python库
同时可以提供文件系统外部访问的api
源码:https://github.com/SDU-NetdiskTeam/seaobj