mirror of
https://github.com/ggogel/seafile-containerized.git
synced 2024-11-16 17:05:32 +00:00
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:
parent
99d2c8456b
commit
d8561eb442
|
@ -10,6 +10,6 @@ install:
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cd image && make base && make && cd ..
|
- cd image && make base && make && cd ..
|
||||||
- cp samples/server-sqlite3.conf bootstrap/bootstrap.conf
|
- cp samples/server.conf bootstrap/bootstrap.conf
|
||||||
- ./launcher bootstrap
|
- ./launcher bootstrap
|
||||||
- ./launcher start
|
- ./launcher start
|
||||||
|
|
|
@ -5,7 +5,7 @@ FROM phusion/baseimage:0.9.19
|
||||||
ENV UPDATED_AT=20161110 \
|
ENV UPDATED_AT=20161110 \
|
||||||
DEBIAN_FRONTEND=noninteractive
|
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
|
python2.7-dev python-imaging python-ldap python-mysqldb
|
||||||
|
|
||||||
# Utility tools
|
# Utility tools
|
||||||
|
|
|
@ -12,7 +12,6 @@ dirs=(
|
||||||
ccnet
|
ccnet
|
||||||
seafile-data
|
seafile-data
|
||||||
seahub-data
|
seahub-data
|
||||||
seahub.db
|
|
||||||
)
|
)
|
||||||
|
|
||||||
for d in ${dirs[*]}; do
|
for d in ${dirs[*]}; do
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[server]
|
|
||||||
server.hostname = seafile.example.com
|
|
||||||
admin.email = me@example.com
|
|
||||||
admin.password = asecret
|
|
||||||
db.type = sqlite3
|
|
|
@ -2,4 +2,3 @@
|
||||||
server.hostname = seafile.example.com
|
server.hostname = seafile.example.com
|
||||||
admin.email = me@example.com
|
admin.email = me@example.com
|
||||||
admin.password = asecret
|
admin.password = asecret
|
||||||
db.type = mysql
|
|
|
@ -22,33 +22,24 @@ shared_seafiledir = '/shared/seafile'
|
||||||
def main():
|
def main():
|
||||||
if not exists(shared_seafiledir):
|
if not exists(shared_seafiledir):
|
||||||
os.mkdir(shared_seafiledir)
|
os.mkdir(shared_seafiledir)
|
||||||
db_type = get_conf('db.type', 'mysql')
|
|
||||||
env = {
|
env = {
|
||||||
'SERVER_NAME': 'seafile',
|
'SERVER_NAME': 'seafile',
|
||||||
'SERVER_IP': get_conf('server.hostname'),
|
'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':
|
# Change the script to allow mysql root password to be empty
|
||||||
setup_script = get_script('setup-seafile.sh')
|
call('''sed -i -e 's/if not mysql_root_passwd/if not mysql_root_passwd and "MYSQL_ROOT_PASSWD" not in os.environ/g' {}'''
|
||||||
else:
|
.format(get_script('setup-seafile-mysql.py')), check_call=True)
|
||||||
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)
|
|
||||||
|
|
||||||
|
setup_script = get_script('setup-seafile-mysql.sh')
|
||||||
call('{} auto -n seafile'.format(setup_script), env=env)
|
call('{} auto -n seafile'.format(setup_script), env=env)
|
||||||
|
|
||||||
files_to_copy = ['conf', 'ccnet', 'seafile-data', 'seahub-data',]
|
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:
|
for fn in files_to_copy:
|
||||||
src = join(topdir, fn)
|
src = join(topdir, fn)
|
||||||
dst = join(shared_seafiledir, fn)
|
dst = join(shared_seafiledir, fn)
|
||||||
|
|
Loading…
Reference in a new issue