-
Notifications
You must be signed in to change notification settings - Fork 519
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
12eb20a
commit a571bd0
Showing
7 changed files
with
138 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Stand Documentserver with mssql | ||
|
||
### How it works | ||
|
||
For deploy stand: | ||
|
||
**STEP 1**: Build you own images: | ||
|
||
```bash | ||
sudo docker-compose build | ||
``` | ||
|
||
**STEP 2**: Wait build complete and when: | ||
|
||
```bash | ||
sudo docker-compose up -d | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
#generate SA password | ||
SYMBOLS='!#$%&*+,-.:;=?@^_~' | ||
for (( i=1; i <= 20; i++ )); do | ||
PASS=$(tr -dc "A-Za-z0-9$SYMBOLS" </dev/urandom | head -c 15) | ||
if [[ $PASS == *[0-9]* && | ||
$PASS != $(echo "$PASS" | tr [:upper:] ' ') && | ||
$PASS != $(echo "$PASS" | tr [:lower:] ' ') && | ||
$PASS != $(echo "$PASS" | tr "$SYMBOLS" ' ') ]]; then | ||
break | ||
fi | ||
done | ||
export MSSQL_SA_PASSWORD=$PASS | ||
|
||
CONNECTION_STR="/opt/mssql-tools/bin/sqlcmd -S localhost,1433 -U SA -P "$MSSQL_SA_PASSWORD" -C -Q" | ||
|
||
#start db | ||
/opt/mssql/bin/sqlservr & | ||
|
||
#wait for db up | ||
for (( i=1; i <= 10; i++ )); do | ||
RES=$($CONNECTION_STR "SELECT @@VERSION;" 2>/dev/null | grep "affected" | wc -l) | ||
if [ "$RES" -eq "1" ]; then | ||
echo "Database is ready" | ||
break | ||
fi | ||
sleep 10 | ||
done | ||
|
||
#create new db user | ||
$CONNECTION_STR "IF NOT EXISTS (SELECT * FROM sys.sql_logins WHERE name = '$MSSQL_USER') BEGIN CREATE LOGIN $MSSQL_USER WITH PASSWORD = '$MSSQL_PASSWORD' , CHECK_POLICY = OFF; ALTER SERVER ROLE [dbcreator] ADD MEMBER [$MSSQL_USER]; END" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
version: '2.1' | ||
services: | ||
onlyoffice-documentserver: | ||
container_name: onlyoffice-documentserver | ||
build: | ||
context: ../../. | ||
dockerfile: Dockerfile | ||
depends_on: | ||
- onlyoffice-mssql | ||
environment: | ||
- DB_TYPE=${DB_TYPE:-mssql} | ||
- DB_HOST=${DB_HOST:-onlyoffice-mssql} | ||
- DB_PORT=${DB_PORT:-1433} | ||
- DB_NAME=${DB_NAME:-onlyoffice} | ||
- DB_USER=${DB_USER:-onlyoffice} | ||
- DB_PWD=${DB_PWD:-onlyoffice} | ||
stdin_open: true | ||
restart: always | ||
ports: | ||
- '80:80' | ||
|
||
onlyoffice-mssql: | ||
container_name: onlyoffice-mssql | ||
build: | ||
context: . | ||
dockerfile: mssql.Dockerfile | ||
args: | ||
- MSSQL_DATABASE=${DB_NAME:-onlyoffice} | ||
- MSSQL_USER=${DB_USER:-onlyoffice} | ||
- MSSQL_PASSWORD=${DB_PWD:-onlyoffice} | ||
restart: always | ||
volumes: | ||
- mssql_data:/var/opt/mssql | ||
expose: | ||
- '1433' | ||
|
||
volumes: | ||
mssql_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM mcr.microsoft.com/mssql/server:2022-latest as onlyoffice-mssql | ||
|
||
ENV ACCEPT_EULA=Y | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
|
||
COPY create_db_user.sh /tmp/create_db_user.sh | ||
|
||
RUN bash /tmp/create_db_user.sh |