Skip to content

Commit

Permalink
Merge branch 'init'
Browse files Browse the repository at this point in the history
  • Loading branch information
ggogel committed Jan 27, 2021
2 parents 93b3bcd + 529c003 commit 488ac1c
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 43 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,7 @@ Networks:
```
- TIME_ZONE=Europe/Berlin
```
Username / E-Mail of the first admin user.
```
- SEAFILE_ADMIN_EMAIL=me@example.com
```
Password of the first admin user.
```
- SEAFILE_ADMIN_PASSWORD=asecret
```

This will be used for the SERVICE_URL and FILE_SERVER_ROOT.
Important: Changing those values in the config files later won't have any effect because they are written to the database. Those values have priority over the config files. To change them enter the "System Admin" section on the web-ui. If you encounter issues with file upload, it's likely that those are configured incorrectly.
```
Expand All @@ -127,6 +120,16 @@ Networks:
- HTTPS=false
```

### *seahub*
Username / E-Mail of the first admin user.
```
- SEAFILE_ADMIN_EMAIL=me@example.com
```
Password of the first admin user.
```
- SEAFILE_ADMIN_PASSWORD=asecret
```

### *db*
Password of the mariadb root user. Must match DB_ROOT_PASSWD.
```
Expand Down
8 changes: 3 additions & 5 deletions compose/docker-compose-swarm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ services:
- SEAFILE_ADMIN_PASSWORD=asecret
- HTTPS=false # Set this to true if you plan to use a reverse proxy with HTTPS. Can be changed later in the admin settings on the web-ui.
- SEAFILE_SERVER_HOSTNAME=seafile.mydomain.com # Mandatory on first deployment!
depends_on:
- db
- memcached
networks:
- seafile-net
deploy:
Expand All @@ -26,8 +23,9 @@ services:
- seafile-data:/shared
- seahub-avatars:/shared/seafile/seahub-data/avatars
- seahub-custom:/shared/seafile/seahub-data/custom
depends_on:
- seafile
environment:
- SEAFILE_ADMIN_EMAIL=me@example.com
- SEAFILE_ADMIN_PASSWORD=asecret
networks:
- seafile-net
deploy:
Expand Down
5 changes: 3 additions & 2 deletions compose/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ services:
- DB_HOST=db
- DB_ROOT_PASSWD=db_dev
- TIME_ZONE=Europe/Berlin
- SEAFILE_ADMIN_EMAIL=me@example.com
- SEAFILE_ADMIN_PASSWORD=asecret
- HTTPS=false # Set this to true if you plan to use a reverse proxy with HTTPS. Can be changed later in the admin settings on the web-ui.
- SEAFILE_SERVER_HOSTNAME=seafile.mydomain.com # Mandatory on first deployment!
depends_on:
Expand All @@ -25,6 +23,9 @@ services:
- seafile-data:/shared
- seahub-avatars:/shared/seafile/seahub-data/avatars
- seahub-custom:/shared/seafile/seahub-data/custom
environment:
- SEAFILE_ADMIN_EMAIL=me@example.com
- SEAFILE_ADMIN_PASSWORD=asecret
depends_on:
- seafile-server
- seafile-caddy
Expand Down
18 changes: 2 additions & 16 deletions seafile-server/scripts/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,8 @@ def main():

fix_gunicorn_bind()

admin_pw = {
'email': get_conf('SEAFILE_ADMIN_EMAIL', 'me@example.com'),
'password': get_conf('SEAFILE_ADMIN_PASSWORD', 'asecret'),
}
password_file = join(topdir, 'conf', 'admin.txt')
with open(password_file, 'w') as fp:
json.dump(admin_pw, fp)


try:
call('{} start'.format(get_script('seafile.sh')))
#call('{} start'.format(get_script('seahub.sh')))
finally:
if exists(password_file):
os.unlink(password_file)

call('{} start'.format(get_script('seafile.sh')))

print('seafile server is running now.')
try:
watch_controller()
Expand Down
2 changes: 1 addition & 1 deletion seafile-server/scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function stop_server {
}

function start_socat {
echo "Waiting for SeaRPC socket..."
while [ ! -S /opt/seafile/seafile-server-latest/runtime/seafile.sock ]; do
echo "Waiting for SeaRPC socket..."
sleep 1
done
socat -d -d TCP-LISTEN:8001,fork,reuseaddr UNIX:/opt/seafile/seafile-server-latest/runtime/seafile.sock,forever
Expand Down
5 changes: 5 additions & 0 deletions seahub/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ pyjwt \
pycryptodome \
requests_oauthlib \
django-pylibmc \
configparser \
&& rm -r /root/.cache/pip

FROM alpine:3.9
Expand All @@ -69,6 +70,8 @@ libmemcached

COPY --from=get /tmp/seafile-server*/seahub /opt/seafile/seafile-server-latest/seahub
COPY --from=get /tmp/seafile-server*/runtime /opt/seafile/seafile-server-latest/runtime
COPY --from=get /tmp/seafile-server*/seahub.sh /opt/seafile/seafile-server-latest/seahub.sh
COPY --from=get /tmp/seafile-server*/check_init_admin.py /opt/seafile/seafile-server-latest/check_init_admin.py
COPY --from=get /tmp/seafile-server*/seafile/lib64/python3.6/site-packages /opt/seafile/seafile-server-latest/seafile/lib64/python3.6/site-packages
COPY --from=pip /usr/lib/python3.6/site-packages /usr/lib/python3.6/site-packages
COPY scripts /scripts
Expand All @@ -79,6 +82,8 @@ ENV CCNET_CONF_DIR=/opt/seafile/conf/ccnet
ENV SEAFILE_CONF_DIR=/opt/seafile/seafile-data
ENV SEAFILE_CENTRAL_CONF_DIR=/opt/seafile/conf
ENV SEAFILE_RPC_PIPE_PATH=/opt/seafile/seafile-server-latest/runtime
ENV SEAFILE_ADMIN_EMAIL=me@example.com
ENV SEAFILE_ADMIN_PASSWORD=asecret

RUN mkdir -p /opt/seafile/logs &&\
ln -sf /dev/stdout /opt/seafile/logs/seahub.log
Expand Down
19 changes: 12 additions & 7 deletions seahub/scripts/create_data_links.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ if [[ $TIME_ZONE != "" ]]; then
fi
fi

while [[ ! -e /shared/seafile/conf || ! -e /shared/seafile/ccnet || ! -e /shared/seafile/seafile-data || ! -e /shared/seafile/seahub-data ]]; do
echo "Waiting for initialization by seafile-server..."
sleep 5
done

dirs=(
conf
ccnet
Expand All @@ -34,14 +39,14 @@ for d in ${dirs[*]}; do
fi
done

#ln -sf /shared/seafile/seahub-data /opt/seafile/seafile-server-latest/seahub-data
rm -rf /opt/seafile/seafile-server-latest/seahub/media/avatars
rm -rf /opt/seafile/seafile-server-latest/seahub/media/custom
ln -sf /shared/seafile/seahub-data/avatars /opt/seafile/seafile-server-latest/seahub/media
ln -sf /shared/seafile/seahub-data/custom /opt/seafile/seafile-server-latest/seahub/media

if [[ ! -e /shared/seafile/conf/seahub.conf ]]; then
mv /opt/seafile/seafile-server-latest/runtime/seahub.conf /shared/seafile/conf/seahub.conf
fi

rm -f /opt/seafile/seafile-server-latest/runtime/seahub.conf
ln -sf /shared/seafile/conf/seahub.conf /opt/seafile/seafile-server-latest/runtime/seahub.conf
ln -sf /shared/seafile/seahub-data /opt/seafile/seafile-server-latest/seahub-data
rm -rf /opt/seafile/seafile-server-latest/seahub/media/avatars
rm -rf /opt/seafile/seafile-server-latest/seahub/media/custom
ln -sf /shared/seafile/seahub-data/avatars /opt/seafile/seafile-server-latest/seahub/media
ln -sf /shared/seafile/seahub-data/custom /opt/seafile/seafile-server-latest/seahub/media
ln -sf /shared/seafile/conf/seahub.conf /opt/seafile/seafile-server-latest/runtime/seahub.conf
23 changes: 19 additions & 4 deletions seahub/scripts/start.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
#!/bin/bash

/scripts/create_data_links.sh
function start_seahub {
/scripts/create_data_links.sh
echo "{ \"email\": \"${SEAFILE_ADMIN_EMAIL}\",\"password\": \"${SEAFILE_ADMIN_PASSWORD}\"}" | tee /opt/seafile/conf/admin.txt
#/opt/seafile/seafile-server-latest/seahub.sh start
python3 /opt/seafile/seafile-server-latest/check_init_admin.py
python3 /opt/seafile/seafile-server-latest/seahub/manage.py runserver 0.0.0.0:8000
}

mkdir -p /opt/seafile/seafile-server-latest/runtime
socat -d -d UNIX-LISTEN:/opt/seafile/seafile-server-latest/runtime/seafile.sock,fork TCP:seafile-server:8001,forever,keepalive,keepidle=10,keepintvl=10,keepcnt=2 &
function start_socat {
mkdir -p /opt/seafile/seafile-server-latest/runtime
socat -d -d UNIX-LISTEN:/opt/seafile/seafile-server-latest/runtime/seafile.sock,fork TCP:seafile-server:8001,forever,keepalive,keepidle=10,keepintvl=10,keepcnt=2
}

python3 /opt/seafile/seafile-server-latest/seahub/manage.py runserver 0.0.0.0:8000
function keep_running {
while true; do
tail -f /dev/null & wait ${!}
done
}

start_socat &
start_seahub &
keep_running

0 comments on commit 488ac1c

Please sign in to comment.