Drop sqlite3 support.

Using mysql is much better in general. And now that we're using docker,
setting up with mysql is as easy as setting up with sqlite3.
This commit is contained in:
Shuai Lin 2016-11-14 20:21:05 +08:00
parent 99d2c8456b
commit d8561eb442
6 changed files with 12 additions and 28 deletions

View file

@ -10,6 +10,6 @@ install:
script:
- cd image && make base && make && cd ..
- cp samples/server-sqlite3.conf bootstrap/bootstrap.conf
- cp samples/server.conf bootstrap/bootstrap.conf
- ./launcher bootstrap
- ./launcher start

View file

@ -5,7 +5,7 @@ FROM phusion/baseimage:0.9.19
ENV UPDATED_AT=20161110 \
DEBIAN_FRONTEND=noninteractive
RUN apt-get update -qq && apt-get -qq -y install memcached sqlite3 mariadb-server nginx \
RUN apt-get update -qq && apt-get -qq -y install memcached mariadb-server nginx \
python2.7-dev python-imaging python-ldap python-mysqldb
# Utility tools

View file

@ -12,7 +12,6 @@ dirs=(
ccnet
seafile-data
seahub-data
seahub.db
)
for d in ${dirs[*]}; do

View file

@ -1,5 +0,0 @@
[server]
server.hostname = seafile.example.com
admin.email = me@example.com
admin.password = asecret
db.type = sqlite3

View file

@ -1,5 +1,4 @@
[server]
server.hostname = seafile.example.com
admin.email = me@example.com
admin.password = asecret
db.type = mysql
admin.password = asecret

View file

@ -22,33 +22,24 @@ shared_seafiledir = '/shared/seafile'
def main():
if not exists(shared_seafiledir):
os.mkdir(shared_seafiledir)
db_type = get_conf('db.type', 'mysql')
env = {
'SERVER_NAME': 'seafile',
'SERVER_IP': get_conf('server.hostname'),
'MYSQL_USER': 'seafile',
'MYSQL_USER_PASSWD': str(uuid.uuid4()),
'MYSQL_USER_HOST': '127.0.0.1',
# Default MariaDB root user has empty password and can only connect from localhost.
'MYSQL_ROOT_PASSWD': '',
}
if db_type == 'sqlite3':
setup_script = get_script('setup-seafile.sh')
else:
setup_script = get_script('setup-seafile-mysql.sh')
env.update({
'MYSQL_USER': 'seafile',
'MYSQL_USER_PASSWD': str(uuid.uuid4()),
'MYSQL_USER_HOST': '127.0.0.1',
# Default MariaDB root user has empty password and can only connect from localhost.
'MYSQL_ROOT_PASSWD': '',
})
# Change the script to allow mysql root password to be empty
call('''sed -i -e 's/if not mysql_root_passwd/if not mysql_root_passwd and "MYSQL_ROOT_PASSWD" not in os.environ/g' {}'''
.format(get_script('setup-seafile-mysql.py')), check_call=True)
# Change the script to allow mysql root password to be empty
call('''sed -i -e 's/if not mysql_root_passwd/if not mysql_root_passwd and "MYSQL_ROOT_PASSWD" not in os.environ/g' {}'''
.format(get_script('setup-seafile-mysql.py')), check_call=True)
setup_script = get_script('setup-seafile-mysql.sh')
call('{} auto -n seafile'.format(setup_script), env=env)
files_to_copy = ['conf', 'ccnet', 'seafile-data', 'seahub-data',]
if db_type in ('sqlite', 'sqlite3'):
files_to_copy += ['seahub.db']
for fn in files_to_copy:
src = join(topdir, fn)
dst = join(shared_seafiledir, fn)