Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thumbnail docker #2

Merged
merged 5 commits into from
Sep 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,6 @@ nohup.out

#
.DS_Store

# docker
docker/src/
40 changes: 0 additions & 40 deletions default

This file was deleted.

60 changes: 60 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
FROM phusion/baseimage:0.11
# docker.seafile.top/seafile-dev/seatable-thumbnail-server:1.3.0

# Aliyun ubuntu source
RUN rm -rf /etc/apt/sources.list
COPY scripts/my-ubuntu-source.list /etc/apt/sources.list

## Dev related libs
RUN apt-get update --fix-missing

# Nginx
RUN apt-get install -y nginx

# Mysql
RUN apt-get install -y mysql-client

# set python3.6 global
RUN apt-get install -y python3 python3-pip python3-setuptools python3-ldap
RUN python3.6 -m pip install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple && rm -r /root/.cache/pip
RUN rm -f /usr/bin/python && \
rm -f /usr/bin/python3 && \
rm -f /usr/bin/pip && \
rm -f /usr/bin/pip3 && \
ln -s /usr/bin/python3.6 /usr/bin/python && \
ln -s /usr/bin/python3.6 /usr/bin/python3 && \
ln -s /usr/local/bin/pip3.6 /usr/bin/pip && \
ln -s /usr/local/bin/pip3.6 /usr/bin/pip3

RUN pip3 install uvicorn pillow pymysql sqlalchemy future \
-i https://mirrors.aliyun.com/pypi/simple && rm -r /root/.cache/pip


# seatable-thumbnail
RUN mkdir -p /opt/seatable-thumbnail
WORKDIR /opt/seatable-thumbnail
COPY src/seafile /opt/seatable-thumbnail/seafile
COPY src/seatable-thumbnail-server /opt/seatable-thumbnail/seatable-thumbnail-server

RUN ln -sf /opt/seatable-thumbnail/seafile/lib/libsearpc.so.1.0.2 /opt/seatable-thumbnail/seafile/lib/libsearpc.so.1
RUN ln -sf /opt/seatable-thumbnail/seafile/lib/libsearpc.so.1.0.2 /opt/seatable-thumbnail/seafile/lib/libsearpc.so
RUN ln -sf /opt/seatable-thumbnail/seafile/lib/libccnet.so.0.0.0 /opt/seatable-thumbnail/seafile/lib/libccnet.so.0
RUN ln -sf /opt/seatable-thumbnail/seafile/lib/libccnet.so.0.0.0 /opt/seatable-thumbnail/seafile/lib/libccnet.so


# scripts
COPY scripts /scripts

RUN mkdir -p /etc/service/nginx && \
rm -f /etc/nginx/sites-enabled/* /etc/nginx/conf.d/* && \
mv /scripts/nginx.conf /etc/nginx/nginx.conf && \
mv /scripts/nginx.sh /etc/service/nginx/run

# my_init
RUN rm -rf /etc/my_init.d/*
COPY scripts/01_init.sh /etc/my_init.d/01_init.sh
RUN chmod +x /etc/my_init.d/01_init.sh \
/scripts/*.sh \
/scripts/*.py

CMD ["/sbin/my_init", "--", "/scripts/enterpoint.sh"]
13 changes: 13 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '2.0'
services:
seatable:
image: docker.seafile.top/seafile-dev/seatable-thumbnail-server:1.3.0
container_name: seatable-thumbnail
ports:
- "80:80"
- "443:443"
volumes:
- /opt/seatable-thumbnail/shared:/shared
environment:
- SEATABLE_THUMBNAIL_SERVER_HOSTNAME=thumbnail.seatable.cn
- SEATABLE_THUMBNAIL_SERVER_LETSENCRYPT=True
17 changes: 17 additions & 0 deletions docker/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# seatable-thumbnail-server-docker

## Deploy

1. mkdir -p /opt/seatable-thumbnail/shared/
2. vim /opt/seatable-thumbnail/docker-compose.yml
3. docker-compose up
4. vim /opt/seatable-thumbnail/shared/seatable-thumbnail/conf/*
5. vim /opt/seatable-thumbnail/shared/seatable-thumbnail/seafile-license.txt
6. docker exec -d seatable-thumbnail /scripts/seatable-thumbnail.sh

## Build

1. cp seatable_thumbnail docker/src/seatable-thumbnail-server/seatable_thumbnail
2. cp main.py docker/src/seatable-thumbnail-server/main.py
3. cp seafile docker/src/seafile (seafile folder was in seatable-pro-server_1.x.x.tar.gz)
4. docker build -t docker.seafile.top/seafile-dev/seatable-thumbnail-server:1.x.x ./
63 changes: 63 additions & 0 deletions docker/scripts/01_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash

set -e

# check folder
if [[ ! -e /shared ]]; then
echo 'do not find /shared path'
exit 1
fi

if [[ ! -e /shared/nginx-logs ]]; then
mkdir /shared/nginx-logs
fi

if [[ ! -e /shared/ssl ]]; then
mkdir /shared/ssl
fi

if [[ ! -e /shared/seatable-thumbnail ]]; then
mkdir /shared/seatable-thumbnail
fi

if [[ ! -e /shared/seatable-thumbnail/conf ]]; then
mkdir /shared/seatable-thumbnail/conf
fi

if [[ ! -e /shared/seatable-thumbnail/ccnet ]]; then
mkdir /shared/seatable-thumbnail/ccnet
fi

if [[ ! -e /shared/seatable-thumbnail/seafile-data ]]; then
mkdir /shared/seatable-thumbnail/seafile-data
fi

if [[ ! -e /shared/seatable-thumbnail/thumbnail ]]; then
mkdir /shared/seatable-thumbnail/thumbnail
fi

if [[ ! -e /shared/seatable-thumbnail/pids ]]; then
mkdir /shared/seatable-thumbnail/pids
fi

if [[ ! -e /shared/seatable-thumbnail/logs ]]; then
mkdir /shared/seatable-thumbnail/logs
fi

# seatable.sh
if [[ ! -e /shared/seatable-thumbnail/scripts ]]; then
mkdir /shared/seatable-thumbnail/scripts
fi

if [[ -f /shared/seatable-thumbnail/scripts/seatable-thumbnail.sh ]]; then
cp /shared/seatable-thumbnail/scripts/seatable-thumbnail.sh /shared/seatable-thumbnail/scripts/seatable-thumbnail.sh.bak
fi

cp /scripts/seatable-thumbnail.sh /shared/seatable-thumbnail/scripts/seatable-thumbnail.sh
sed -i '$a\PATH=/opt/seatable-thumbnail/scripts:$PATH' ~/.bashrc
chmod u+x /shared/seatable-thumbnail/scripts/*.sh

# main
ln -sfn /shared/seatable-thumbnail/* /opt/seatable-thumbnail
ln -sfn /shared/nginx-logs /opt
ln -sfn /shared/ssl /opt
22 changes: 22 additions & 0 deletions docker/scripts/acme-tiny-master/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License (MIT)

Copyright (c) 2015 Daniel Roesler

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Loading