From d8561eb442be2bfb75f8830d0888e02a675d6dc9 Mon Sep 17 00:00:00 2001 From: Shuai Lin Date: Mon, 14 Nov 2016 20:21:05 +0800 Subject: [PATCH] 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. --- .travis.yml | 2 +- image/base/Dockerfile | 2 +- image/seafile/create_data_links.sh | 1 - samples/server-sqlite3.conf | 5 ---- samples/{server-mysql.conf => server.conf} | 3 +-- scripts/bootstrap.py | 27 ++++++++-------------- 6 files changed, 12 insertions(+), 28 deletions(-) delete mode 100644 samples/server-sqlite3.conf rename samples/{server-mysql.conf => server.conf} (65%) diff --git a/.travis.yml b/.travis.yml index dfd6bd9..f10737b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/image/base/Dockerfile b/image/base/Dockerfile index cda8ae4..8420707 100644 --- a/image/base/Dockerfile +++ b/image/base/Dockerfile @@ -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 diff --git a/image/seafile/create_data_links.sh b/image/seafile/create_data_links.sh index 5623fba..c18c204 100755 --- a/image/seafile/create_data_links.sh +++ b/image/seafile/create_data_links.sh @@ -12,7 +12,6 @@ dirs=( ccnet seafile-data seahub-data - seahub.db ) for d in ${dirs[*]}; do diff --git a/samples/server-sqlite3.conf b/samples/server-sqlite3.conf deleted file mode 100644 index e3d32ae..0000000 --- a/samples/server-sqlite3.conf +++ /dev/null @@ -1,5 +0,0 @@ -[server] -server.hostname = seafile.example.com -admin.email = me@example.com -admin.password = asecret -db.type = sqlite3 \ No newline at end of file diff --git a/samples/server-mysql.conf b/samples/server.conf similarity index 65% rename from samples/server-mysql.conf rename to samples/server.conf index 097c19d..bf66497 100644 --- a/samples/server-mysql.conf +++ b/samples/server.conf @@ -1,5 +1,4 @@ [server] server.hostname = seafile.example.com admin.email = me@example.com -admin.password = asecret -db.type = mysql \ No newline at end of file +admin.password = asecret \ No newline at end of file diff --git a/scripts/bootstrap.py b/scripts/bootstrap.py index 2ac2088..12287bc 100755 --- a/scripts/bootstrap.py +++ b/scripts/bootstrap.py @@ -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)