Merge branch 'init'

This commit is contained in:
Gerrit Gogel 2021-01-28 00:44:34 +01:00
commit 488ac1c9ea
8 changed files with 57 additions and 44 deletions

View file

@ -109,14 +109,7 @@ Networks:
``` ```
- TIME_ZONE=Europe/Berlin - 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. 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. 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.
``` ```
@ -127,6 +120,16 @@ Networks:
- HTTPS=false - 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* ### *db*
Password of the mariadb root user. Must match DB_ROOT_PASSWD. Password of the mariadb root user. Must match DB_ROOT_PASSWD.
``` ```

View file

@ -12,9 +12,6 @@ services:
- SEAFILE_ADMIN_PASSWORD=asecret - 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. - 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! - SEAFILE_SERVER_HOSTNAME=seafile.mydomain.com # Mandatory on first deployment!
depends_on:
- db
- memcached
networks: networks:
- seafile-net - seafile-net
deploy: deploy:
@ -26,8 +23,9 @@ services:
- seafile-data:/shared - seafile-data:/shared
- seahub-avatars:/shared/seafile/seahub-data/avatars - seahub-avatars:/shared/seafile/seahub-data/avatars
- seahub-custom:/shared/seafile/seahub-data/custom - seahub-custom:/shared/seafile/seahub-data/custom
depends_on: environment:
- seafile - SEAFILE_ADMIN_EMAIL=me@example.com
- SEAFILE_ADMIN_PASSWORD=asecret
networks: networks:
- seafile-net - seafile-net
deploy: deploy:

View file

@ -8,8 +8,6 @@ services:
- DB_HOST=db - DB_HOST=db
- DB_ROOT_PASSWD=db_dev - DB_ROOT_PASSWD=db_dev
- TIME_ZONE=Europe/Berlin - 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. - 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! - SEAFILE_SERVER_HOSTNAME=seafile.mydomain.com # Mandatory on first deployment!
depends_on: depends_on:
@ -25,6 +23,9 @@ services:
- seafile-data:/shared - seafile-data:/shared
- seahub-avatars:/shared/seafile/seahub-data/avatars - seahub-avatars:/shared/seafile/seahub-data/avatars
- seahub-custom:/shared/seafile/seahub-data/custom - seahub-custom:/shared/seafile/seahub-data/custom
environment:
- SEAFILE_ADMIN_EMAIL=me@example.com
- SEAFILE_ADMIN_PASSWORD=asecret
depends_on: depends_on:
- seafile-server - seafile-server
- seafile-caddy - seafile-caddy

View file

@ -70,21 +70,7 @@ def main():
fix_gunicorn_bind() 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('seafile.sh')))
#call('{} start'.format(get_script('seahub.sh')))
finally:
if exists(password_file):
os.unlink(password_file)
print('seafile server is running now.') print('seafile server is running now.')
try: try:

View file

@ -17,8 +17,8 @@ function stop_server {
} }
function start_socat { function start_socat {
while [ ! -S /opt/seafile/seafile-server-latest/runtime/seafile.sock ]; do
echo "Waiting for SeaRPC socket..." echo "Waiting for SeaRPC socket..."
while [ ! -S /opt/seafile/seafile-server-latest/runtime/seafile.sock ]; do
sleep 1 sleep 1
done done
socat -d -d TCP-LISTEN:8001,fork,reuseaddr UNIX:/opt/seafile/seafile-server-latest/runtime/seafile.sock,forever socat -d -d TCP-LISTEN:8001,fork,reuseaddr UNIX:/opt/seafile/seafile-server-latest/runtime/seafile.sock,forever

View file

@ -49,6 +49,7 @@ pyjwt \
pycryptodome \ pycryptodome \
requests_oauthlib \ requests_oauthlib \
django-pylibmc \ django-pylibmc \
configparser \
&& rm -r /root/.cache/pip && rm -r /root/.cache/pip
FROM alpine:3.9 FROM alpine:3.9
@ -69,6 +70,8 @@ libmemcached
COPY --from=get /tmp/seafile-server*/seahub /opt/seafile/seafile-server-latest/seahub 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*/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=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 --from=pip /usr/lib/python3.6/site-packages /usr/lib/python3.6/site-packages
COPY scripts /scripts COPY scripts /scripts
@ -79,6 +82,8 @@ ENV CCNET_CONF_DIR=/opt/seafile/conf/ccnet
ENV SEAFILE_CONF_DIR=/opt/seafile/seafile-data ENV SEAFILE_CONF_DIR=/opt/seafile/seafile-data
ENV SEAFILE_CENTRAL_CONF_DIR=/opt/seafile/conf ENV SEAFILE_CENTRAL_CONF_DIR=/opt/seafile/conf
ENV SEAFILE_RPC_PIPE_PATH=/opt/seafile/seafile-server-latest/runtime 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 &&\ RUN mkdir -p /opt/seafile/logs &&\
ln -sf /dev/stdout /opt/seafile/logs/seahub.log ln -sf /dev/stdout /opt/seafile/logs/seahub.log

View file

@ -18,6 +18,11 @@ if [[ $TIME_ZONE != "" ]]; then
fi fi
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=( dirs=(
conf conf
ccnet ccnet
@ -34,14 +39,14 @@ for d in ${dirs[*]}; do
fi fi
done done
if [[ ! -e /shared/seafile/conf/seahub.conf ]]; then #ln -sf /shared/seafile/seahub-data /opt/seafile/seafile-server-latest/seahub-data
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/avatars
rm -rf /opt/seafile/seafile-server-latest/seahub/media/custom 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/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/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

View file

@ -1,9 +1,24 @@
#!/bin/bash #!/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 function start_socat {
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 & 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