nextcoud starter
This commit is contained in:
commit
9d0e64797a
73
docker-compose.yaml
Normal file
73
docker-compose.yaml
Normal file
@ -0,0 +1,73 @@
|
||||
version: '3.7'
|
||||
|
||||
networks:
|
||||
nextcloud:
|
||||
external: true
|
||||
|
||||
services:
|
||||
|
||||
nextcloud:
|
||||
build: ./src/nextcloud/
|
||||
container_name: nextcloud
|
||||
environment:
|
||||
- TZ=Europe/Moscow
|
||||
- POSTGRES_HOST=postgres-nextcloud
|
||||
- POSTGRES_DB=nextcloud
|
||||
- POSTGRES_USER=nextcloud
|
||||
- POSTGRES_PASSWORD=dsfjhskdjfhskWER!
|
||||
volumes:
|
||||
- ./nextcloud/apps:/var/www/html/apps
|
||||
- ./nextcloud/custom_apps:/var/www/html/custom_apps
|
||||
- ./nextcloud/config:/var/www/html/config
|
||||
- ./nextcloud/data:/var/www/html/data
|
||||
networks:
|
||||
- nextcloud
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- postgres-nextcloud
|
||||
|
||||
postgres-nextcloud:
|
||||
image: postgres:14.1-alpine
|
||||
container_name: postgres-nextcloud
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- POSTGRES_DB=nextcloud
|
||||
- POSTGRES_USER=nextcloud
|
||||
- POSTGRES_PASSWORD=dsfjhskdjfhskWER!
|
||||
volumes:
|
||||
- ./database:/var/lib/postgresql/data
|
||||
networks:
|
||||
- nextcloud
|
||||
|
||||
onlyoffice:
|
||||
image: onlyoffice/documentserver
|
||||
#build: ./src/onlyoffice/
|
||||
#stdin_open: true
|
||||
#tty: true
|
||||
#entrypoint: [ '/usr/bin/tail', '--follow', '/dev/null' ]
|
||||
container_name: onlyoffice
|
||||
restart: always
|
||||
environment:
|
||||
- DB_TYPE=postgres
|
||||
- DB_HOST=postgres-nextcloud
|
||||
- DB_PORT=5432
|
||||
- DB_NAME=nextcloud
|
||||
- DB_USER=nextcloud
|
||||
- DB_PWD=dsfjhskdjfhskWER!
|
||||
volumes:
|
||||
- ./onlyoffice/logs:/var/log/onlyoffice
|
||||
- ./onlyoffice/data:/var/www/onlyoffice/Data
|
||||
- ./onlyoffice/lib:/var/lib/onlyoffice
|
||||
networks:
|
||||
- nextcloud
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
4
rebuild.sh
Executable file
4
rebuild.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
docker-compose down
|
||||
docker-compose up -d --no-deps --build
|
||||
docker-compose logs nextcloud
|
8
src/nextcloud/Dockerfile
Normal file
8
src/nextcloud/Dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
FROM nextcloud:24.0.4-apache
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
COPY ./script/cron.sh /app/cron.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["apache2-foreground"]
|
8
src/nextcloud/Dockerfile~
Normal file
8
src/nextcloud/Dockerfile~
Normal file
@ -0,0 +1,8 @@
|
||||
FROM nextcloud:23.0.3-apache
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
COPY ./script/cron.sh /app/cron.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
CMD ["apache2-foreground"]
|
15
src/nextcloud/script/cron.sh
Normal file
15
src/nextcloud/script/cron.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
run_as() {
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
su -p www-data -s /bin/sh -c "$1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
run_as ' \
|
||||
php /var/www/html/cron.php
|
||||
'
|
||||
|
||||
echo $?
|
21
src/nextcloud/script/enable-apps.sh
Normal file
21
src/nextcloud/script/enable-apps.sh
Normal file
@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
run_as() {
|
||||
if [ "$(id -u)" = 0 ]; then
|
||||
su -p www-data -s /bin/sh -c "$1"
|
||||
else
|
||||
sh -c "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:80/index.php/login)" != "200" ]]; do sleep 5; done
|
||||
|
||||
run_as ' \
|
||||
for app in $(ls /var/www/html/apps/); do \
|
||||
echo "Disabling $app..."
|
||||
php /var/www/html/occ app:disable $app
|
||||
echo "Installing $app..."
|
||||
php /var/www/html/occ app:install $app
|
||||
echo "Enabling $app..."
|
||||
php /var/www/html/occ app:enable $app
|
||||
done'
|
5
src/onlyoffice/Dockerfile
Normal file
5
src/onlyoffice/Dockerfile
Normal file
@ -0,0 +1,5 @@
|
||||
FROM onlyoffice/documentserver
|
||||
|
||||
COPY ./script/licencing.sh /app/licencing.sh
|
||||
|
||||
ENTRYPOINT [ "/bin/bash", "/app/licencing.sh" ]
|
101
src/onlyoffice/script/licencing.sh
Normal file
101
src/onlyoffice/script/licencing.sh
Normal file
@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
|
||||
apt-get update
|
||||
apt-get -y install build-essential python3-dev
|
||||
|
||||
FILE=OO_PubKey
|
||||
if test -f "$FILE"; then
|
||||
echo Patch has already been applied. Starting DocumentServer...
|
||||
else
|
||||
apt-get update && apt-get install -y python3.8-dev
|
||||
wget https://bootstrap.pypa.io/get-pip.py
|
||||
python3.8 get-pip.py
|
||||
pip install pycryptodome
|
||||
rm -f /var/www/onlyoffice/Data/license.lic
|
||||
|
||||
cat <<EOF > index.py
|
||||
from Crypto.Hash import SHA, SHA256
|
||||
from Crypto.Signature import PKCS1_v1_5
|
||||
from Crypto.PublicKey import RSA
|
||||
from shutil import copyfile
|
||||
import json
|
||||
import codecs
|
||||
|
||||
hexlify = codecs.getencoder('hex')
|
||||
|
||||
licenseFile = {
|
||||
"branding": False,
|
||||
"connections": 9999,
|
||||
"customization": False,
|
||||
"end_date": "2099-01-01T23:59:59.000Z",
|
||||
"light": "False",
|
||||
"mode": "",
|
||||
"portal_count": "0",
|
||||
"process": 2,
|
||||
"ssbranding": False,
|
||||
"test": "False",
|
||||
"trial": "False",
|
||||
"user_quota": "0",
|
||||
"users_count": 9999,
|
||||
"users_expire": 99999,
|
||||
"whiteLabel": False,
|
||||
"customer_id": "customerID",
|
||||
"start_date": "2020-01-01T00:00:00.000Z",
|
||||
"users": [],
|
||||
"version": 2
|
||||
}
|
||||
|
||||
jsonLicenseFile = codecs.encode(json.dumps(licenseFile, separators=(',', ':')), encoding='utf-8')
|
||||
|
||||
privKey = RSA.generate(1024)
|
||||
publKey = privKey.publickey().exportKey('PEM')
|
||||
|
||||
digest = SHA.new(jsonLicenseFile)
|
||||
signer = PKCS1_v1_5.new(privKey)
|
||||
signature = signer.sign(digest)
|
||||
|
||||
finalSignature = signature.hex()
|
||||
|
||||
licenseFile['signature'] = finalSignature
|
||||
|
||||
f = open("OO_License", "w+")
|
||||
f.write(json.dumps(licenseFile))
|
||||
f.close
|
||||
|
||||
f = open("OO_PubKey", "w+")
|
||||
f.write(publKey.decode('utf-8'))
|
||||
f.close()
|
||||
|
||||
print("The license file has been saved to OO_License. Here's the content :")
|
||||
print(json.dumps(licenseFile))
|
||||
print("It will be placed automatically in the Data directory of OnlyOffice")
|
||||
|
||||
copyfile("OO_License", "/var/www/onlyoffice/Data/license.lic")
|
||||
|
||||
print("Patching docservice and converter...")
|
||||
|
||||
basePath = "/var/www/onlyoffice/documentserver/server/"
|
||||
files = ["DocService/docservice", "FileConverter/converter"]
|
||||
|
||||
for file in files:
|
||||
f = open(basePath+file, 'rb')
|
||||
data = f.read()
|
||||
f.close()
|
||||
|
||||
replacedData = data.replace(b"-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRhGF7X4A0ZVlEg594WmODVVUI\niiPQs04aLmvfg8SborHss5gQXu0aIdUT6nb5rTh5hD2yfpF2WIW6M8z0WxRhwicg\nXwi80H1aLPf6lEPPLvN29EhQNjBpkFkAJUbS8uuhJEeKw0cE49g80eBBF4BCqSL6\nPFQbP9/rByxdxEoAIQIDAQAB\n-----END PUBLIC KEY-----", bytes(publKey))
|
||||
# replacedData = bytes(publKey)
|
||||
|
||||
f = open(basePath+file, 'wb')
|
||||
f.write(replacedData)
|
||||
f.close()
|
||||
|
||||
EOF
|
||||
|
||||
python3.8 index.py
|
||||
|
||||
echo Patching docservice and converter completed.
|
||||
|
||||
echo Done! Running Document Server...
|
||||
fi
|
||||
|
||||
/app/ds/run-document-server.sh
|
Loading…
Reference in New Issue
Block a user