Compare commits

..

113 Commits

Author SHA1 Message Date
brian
b6f2befafb Merge branch 'acs-ats-enterprise' into acs-backend-enterprise 2021-04-02 09:13:57 -04:00
brian
c11990900c Merge branch 'acs-sync-base' into acs-backend-enterprise 2021-04-02 09:13:56 -04:00
brian
e07cea5ffa Merge branch 'acs-search' into acs-backend-enterprise 2021-04-02 09:13:54 -04:00
brian
29f4ca7c54 Merge branch 'acs-ats-base' into acs-ats-enterprise 2021-04-02 09:13:50 -04:00
brian
73fea3d13d Merge branch 'acs-enterprise' into acs-ats-enterprise 2021-04-02 09:13:49 -04:00
brian
910cc2e2cb Merge branch 'acs' into acs-enterprise 2021-04-02 09:13:44 -04:00
brian
99d39fa7f7 Merge branch 'acs-search-base' into acs-search 2021-04-02 09:13:42 -04:00
brian
1778fd04a4 Merge branch 'acs' into acs-search 2021-04-02 09:13:41 -04:00
brian
d616b9ef3a Merge branch 'acs-base' into acs 2021-04-02 09:13:32 -04:00
brian
a72d43a6af Merge branch 'acs-base' into acs-search-base 2021-04-02 09:13:30 -04:00
brian
f10722dec9 Merge branch 'acs-base' into acs-sync-base 2021-04-02 09:13:22 -04:00
39928d09fc Merge branch 'ats-base' into acs-ats-base 2021-04-02 09:11:32 -04:00
9859e68fe8 Merge branch 'acs-base' into acs-ats-base 2021-04-02 09:11:22 -04:00
4dccd7892f Merge branch 'base' into ats-base 2021-04-02 09:09:13 -04:00
6bce626075 Merge branch 'proxy' into acs-base 2021-04-02 08:42:43 -04:00
3d6aa1d4bc Merge branch 'base' into proxy 2021-04-02 08:41:45 -04:00
3b5fc8c096 fixed sync service config 2021-01-13 17:35:43 -05:00
ac7e691100 Merge branch 'acs-sync-base' into acs-backend-enterprise 2021-01-13 11:09:18 -05:00
15ccb5642b using proxy values for sync url 2021-01-13 09:59:21 -05:00
4349851dd9 Merge remote-tracking branch 'origin/acs-sync-base' into acs-backend-enterprise 2021-01-13 09:56:54 -05:00
9b3ba22ca1 Merge branch 'acs-search.acs' into acs-backend-enterprise.acs-search 2021-01-06 16:33:19 -05:00
2878298644 Merge branch 'acs-search-base.acs-base' into acs-search.acs-search-base 2021-01-06 16:26:04 -05:00
11bb8c62ed Merge branch 'acs.acs-base' into acs-search.acs 2021-01-06 16:24:47 -05:00
76dc8c7ad9 Merge branch 'acs-ats-base.acs-base' into acs-ats-enterprise.acs-ats-base 2021-01-06 16:22:31 -05:00
b024fd8d7e Merge branch 'ats-base.base' into acs-ats-base.ats-base 2021-01-06 16:21:36 -05:00
8a36f91d06 Merge branch 'acs-base.proxy' into acs-ats-base.acs-base 2021-01-06 16:15:41 -05:00
962817ba63 Merge branch 'acs-base.proxy' into acs-search-base.acs-base 2021-01-06 15:56:25 -05:00
a56556b596 Merge branch 'acs-base.proxy' into acs-sync-base.acs-base 2021-01-06 15:54:27 -05:00
d3b41dcc46 Merge branch 'base' into ats-base.base 2021-01-06 15:53:29 -05:00
37de03317b Merge branch 'acs-enterprise.acs-community' into acs-ats-enterprise.acs-enterprise 2021-01-06 15:40:03 -05:00
dc9fb0abfa added license dir 2021-01-06 15:39:29 -05:00
68dc071342 configured ACS for ATS 2021-01-06 15:36:32 -05:00
78ec9c2a94 Merge branch 'ats-base.base' into acs-ats-enterprise.ats-base 2021-01-06 15:25:16 -05:00
cafee75cdc set platform to v6.2.2.3 2021-01-06 15:21:05 -05:00
d70efc6943 parameterized AOS 2021-01-06 15:19:41 -05:00
83db2b08dc Merge branch 'acs-community.acs-base' into acs-search-community.acs-community 2021-01-06 12:23:18 -05:00
a3cb815dd1 Merge branch 'acs-base.proxy' into acs-community.acs-base 2021-01-06 12:22:27 -05:00
ebd6c503bd Merge branch 'proxy.base' into acs-base.proxy 2021-01-06 12:21:58 -05:00
ac18d6d637 fixed host/protocol URL rewrites 2021-01-06 12:21:21 -05:00
b47583a716 Merge branch 'acs-base.proxy' into acs-ats-base.acs-base 2020-12-26 14:15:39 -05:00
fc9c26eac5 Merge branch 'acs-community.acs-base' into acs-search-community.acs-community 2020-12-26 14:02:30 -05:00
2715b3afea Merge branch 'acs-base.proxy' into acs-search-base.acs-base 2020-12-26 14:00:14 -05:00
55b70f1a36 Merge branch 'acs-base.proxy' into acs-community.acs-base 2020-12-26 13:58:15 -05:00
1d5624496d renamed proxy variables to match changes to proxy branch 2020-12-26 13:55:19 -05:00
3a6b5c4850 Merge commit '817b062dfddd1035aa68554f55065c042607c482' into acs-base.proxy 2020-12-26 13:54:44 -05:00
817b062dfd merged platform/share into single proxy 2020-12-26 13:54:31 -05:00
c0c6dcd1ce remove share context; moving to acs-share-base 2020-12-26 13:51:23 -05:00
253b7fd3f2 Merge branch 'acs-search-base.acs-base' into acs-search-community.acs-search-base 2020-12-26 13:50:37 -05:00
9f75b4439d Merge branch 'acs-base.proxy' into acs-search-base.acs-base 2020-12-26 13:46:21 -05:00
3ac57ce7d1 Merge branch 'acs-base.proxy' into acs-community.acs-base 2020-12-26 13:37:05 -05:00
3cb24f7587 added proxy config to platform 2020-12-26 11:18:58 -05:00
6579a5a0c9 Merge branch 'proxy.base' into acs-base.proxy 2020-12-26 11:16:07 -05:00
d6b7a879b1 added .env configurable platform/share context 2020-12-26 11:15:44 -05:00
1ead7a8d16 added alf-specific variables back to docker-compose env in the right branch 2020-12-26 11:13:00 -05:00
63aa212ccb Merge branch 'proxy.base' into acs-base.proxy 2020-12-26 11:11:48 -05:00
5e618569bc Merge branch 'base' into proxy.base 2020-12-26 11:11:16 -05:00
6d396a640f added JDBC driver to base config 2020-12-26 11:06:07 -05:00
520e211c11 Merge branch 'acs-search-base.acs-base' into acs-search-community.acs-search-base 2020-12-25 23:38:58 -05:00
1635445cba Merge branch 'acs-community.acs-base' into acs-search-community.acs-community 2020-12-25 23:38:36 -05:00
6ec4a797ca Merge branch 'acs-base.proxy' into acs-community.acs-base 2020-12-25 23:38:22 -05:00
b1f3b14846 Merge branch 'acs-base.proxy' into acs-sync-base.acs-base 2020-12-25 23:37:08 -05:00
04f44ef280 Merge branch 'acs-base.proxy' into acs-ats-base.acs-base 2020-12-25 23:32:53 -05:00
0ed77985f0 Merge branch 'acs-base.proxy' into acs-search-base.acs-base 2020-12-25 23:32:10 -05:00
9720bd7fa6 Merge branch 'proxy.base' into acs-base.proxy 2020-12-25 23:08:53 -05:00
4e8453becd removed port from reverse proxy; allows it to work when port changes 2020-12-25 23:08:07 -05:00
ce9b143fb5 added ATS-only base config 2020-12-21 11:50:38 -05:00
1d0aa0c91e fixed solr configuration on platform 2020-12-17 21:00:27 -05:00
7a005d16d7 Merge branch 'acs-min-community.acs-base' into acs-search-community.acs-min-community 2020-12-17 20:50:09 -05:00
60b5a8989b changed from v6.2.2-RC1 to v6.2.0-ga 2020-12-17 20:42:54 -05:00
b762ba0ce1 Merge branch 'acs-community.acs-base' into acs-search-community.acs-community 2020-12-17 18:53:59 -05:00
c22af67a06 disabled jodconverter in platform 2020-12-17 18:53:34 -05:00
0b507962fa added sync service config 2020-12-17 17:41:47 -05:00
f73fdbb5ea added volume to base shared file store config 2020-12-17 17:16:01 -05:00
a7cacf8edc Merge branch 'acs-search-base.acs-base' into acs-search-community.acs-search-base 2020-12-17 16:35:44 -05:00
43d5686407 Merge branch 'acs-community.acs-base' into acs-search-community.acs-community 2020-12-17 16:35:11 -05:00
e29e80b650 Merge branch 'acs-base.proxy' into acs-community.acs-base 2020-12-17 16:34:26 -05:00
fbf7ca3678 Merge branch 'acs-base.proxy' into acs-search-base.acs-base 2020-12-17 16:32:50 -05:00
3b631bcd87 Merge branch 'acs-base.proxy' into acs-ats-base.acs-base 2020-12-17 16:29:45 -05:00
46bbeeef30 fixed missed envvar 2020-12-17 16:29:36 -05:00
d6f1c99c79 Merge branch 'acs-base.proxy' into acs-ats-base.acs-base 2020-12-17 16:25:37 -05:00
6b0c103d75 added depends_on for proxy 2020-12-17 16:24:34 -05:00
6d35ffa551 Merge branch 'acs-base.acs-proxy' into acs-ats-base.acs-base 2020-12-17 16:21:14 -05:00
faee3aaa48 Merge branch 'acs-proxy.proxy' into acs-base.acs-proxy 2020-12-17 16:20:23 -05:00
beb87dd97a Merge branch 'proxy.base' into acs-proxy.proxy 2020-12-17 16:20:12 -05:00
a42af25649 added port for localhost 2020-12-17 16:19:34 -05:00
6c739c5795 Merge branch 'acs-base.acs-proxy' into acs-ats-base.acs-base 2020-12-17 16:18:18 -05:00
db6a1e148c Merge branch 'acs-proxy.proxy' into acs-base.acs-proxy 2020-12-17 16:16:57 -05:00
ab396f7656 changed version to 'acs' 2020-12-17 16:16:44 -05:00
b65d3d301f Merge branch 'acs-proxy.proxy' into acs-base.acs-proxy 2020-12-17 16:16:07 -05:00
6332985ebd removed proxy 2020-12-17 16:09:48 -05:00
010149e6b6 added platform config 2020-12-17 16:07:17 -05:00
f1df9c3217 initial nginx dynamic docker image config 2020-12-17 16:03:33 -05:00
69974eaeea Merge branch 'acs-search-base.acs-base' into acs-search-community.acs-search-base 2020-12-17 13:24:15 -05:00
82d6fd5c8a Merge branch 'acs-community.acs-base' into acs-search-community.acs-community 2020-12-17 13:22:28 -05:00
90e935a49e minor fixes 2020-12-17 13:22:05 -05:00
6e32209824 Merge branch 'acs-base.base' into acs-community.acs-base 2020-12-17 13:20:59 -05:00
63d1ee7ef9 changed service from solr6 to search; added service name variables 2020-12-17 13:03:32 -05:00
a081d5b5c8 Merge branch 'acs-base.base' into acs-search-base.acs-base 2020-12-17 12:56:03 -05:00
487a677f6f added service referencing variables 2020-12-17 12:48:48 -05:00
0608045c1b Merge branch 'acs-base.base' into acs-ats-base.acs-base 2020-12-17 12:46:35 -05:00
79a1644530 more corrections to service names and addressing additions 2020-12-17 12:46:24 -05:00
79ef1f5868 added depends_on for ATS 2020-12-17 12:37:10 -05:00
8c480402ed Merge branch 'acs-base.base' into acs-ats-base.acs-base 2020-12-17 12:32:07 -05:00
5cfee3d18f updated service names 2020-12-17 12:31:55 -05:00
8a5004ed74 Merge branch 'acs-search-base.acs-base' into acs-search-community.acs-community 2020-12-17 12:29:33 -05:00
d0a62bfd24 Merge branch 'acs-base.base' into acs-community.acs-base 2020-12-16 23:57:29 -05:00
7cedfa4fa2 Merge branch 'acs-base.base' into acs-search-base.acs-base 2020-12-16 23:56:43 -05:00
6858d201c2 Merge branch 'acs-base.base' into acs-ats-base.acs-base 2020-12-16 23:56:08 -05:00
6c665fab04 added depends_on for the alfresco service 2020-12-16 23:55:56 -05:00
723f3ec954 configured for ACS community v6.2.2-RC1 2020-12-16 23:55:00 -05:00
dcb88c42ea added minimum unconfigured search service 2020-12-16 23:44:46 -05:00
c1323a8171 added ATS minimum unconfigured services 2020-12-16 23:38:34 -05:00
0f36dd1943 added minimum unconfigured ACS services to Docker Compose 2020-12-16 23:34:34 -05:00
12 changed files with 217 additions and 488 deletions

6
.env
View File

@@ -0,0 +1,6 @@
ALFRESCO_DIR=~/alfresco
ALFRESCO_LICENSE_DIR=~/alfresco/license
PROXY_PROTOCOL=http
PROXY_HOST=localhost
PROXY_PORT=8080

View File

@@ -3,23 +3,3 @@
This Git Repository intends to represent environments in Docker Compose. All environments are effectively a derivative of other environments. The original environment is the environment represented by the `base` branch. All derivative environments are represented by other branches. Those branches are named in the format `{core}.{parent}`. This Git Repository intends to represent environments in Docker Compose. All environments are effectively a derivative of other environments. The original environment is the environment represented by the `base` branch. All derivative environments are represented by other branches. Those branches are named in the format `{core}.{parent}`.
## Backup & Restore
### Backup
A previously run Docker Compose environment is required in order to perform a backup. The Docker Compose resultant containers may or may not use volumes for persistence. It is assumed that the Docker Compose environment is stopped at the time of the backup.
```sh
docker-compose stop
scripts/backup-data.sh
```
This will result in the creation or replacement of the `data` directory. This will hold all the resources required for a subsequent *Restore* execution.
### Restore
A clean Docker Compose environment is **not** required in order to perform a restore. The script will destory any existing data that may exist at the time of execution. It will also stop and remove any existing Docker containers. The Docker Compose resultant containers may or may not use volumes for persistence.
```sh
scripts/restore-data.sh
```

View File

@@ -1,3 +1,133 @@
# Originally sourced from https://github.com/Alfresco/acs-deployment/blob/4.0.3/docker-compose/docker-compose.yml # Sourced from https://github.com/Alfresco/acs-deployment/blob/4.0.3/docker-compose/docker-compose.yml
# #
version: "3" # Using version 2 as 3 does not support resource constraint options (cpu_*, mem_* limits) for non swarm mode in Compose
version: "2"
services:
platform:
image: alfresco/alfresco-content-repository:6.2.2.3
mem_limit: 1700m
environment:
JAVA_OPTS: "
-Ddb.driver=org.postgresql.Driver
-Ddb.username=alfresco
-Ddb.password=alfresco
-Ddb.url=jdbc:postgresql://postgres-acs:5432/alfresco
-Dindex.subsystem.name=solr6
-Dsolr.host=search
-Dsolr.port=8983
-Dsolr.secureComms=none
-Dalfresco.host=${PROXY_HOST}
-Dalfresco.port=${PROXY_PORT}
-Dalfresco.protocol=${PROXY_PROTOCOL}
-Daos.baseUrlOverwrite=${PROXY_PROTOCOL}://${PROXY_HOST}:${PROXY_PORT}/alfresco/aos
-Dmessaging.broker.url=\"failover:(nio://activemq:61616)?timeout=3000&jms.useCompression=true\"
-Ddeployment.method=DOCKER_COMPOSE
-Dcsrf.filter.enabled=false
-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
-Dtransform.service.enabled=true
-Dlocal.transform.service.enabled=false
-Dtransform.service.url=http://transform-router:8095
-Dsfs.url=http://shared-file-store:8099
-Dalfresco-pdf-renderer.url=http://transform-engine-aio:8090
-Djodconverter.url=http://transform-engine-aio:8090
-Dimg.url=http://transform-engine-aio:8090
-Dtika.url=http://transform-engine-aio:8090
-Dtransform.misc.url=http://transform-engine-aio:8090
-Ddsync.service.uris=${PROXY_PROTOCOL}://${PROXY_HOST}:${PROXY_PORT}/sync
-Dsystem.content.eagerOrphanCleanup=true
-Dsystem.content.orphanProtectDays=0
-Djodconverter.enabled=false
"
depends_on:
- postgres-acs
- activemq
- shared-file-store
volumes:
- "$ALFRESCO_LICENSE_DIR/acs:/usr/local/tomcat/shared/classes/alfresco/extension/license:ro"
transform-router:
image: quay.io/alfresco/alfresco-transform-router:1.3.1
environment:
ACTIVEMQ_URL: "nio://activemq:61616"
CORE_AIO_URL : "http://transform-core-aio:8090"
FILE_STORE_URL: "http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file"
depends_on:
- activemq
- shared-file-store
transform-core-aio:
image: alfresco/alfresco-transform-core-aio:2.3.6
environment:
ACTIVEMQ_URL: "nio://activemq:61616"
FILE_STORE_URL: "http://shared-file-store:8099/alfresco/api/-default-/private/sfs/versions/1/file"
depends_on:
- activemq
- shared-file-store
shared-file-store:
image: alfresco/alfresco-shared-file-store:0.10.0
volumes:
- shared-file-store-volume:/tmp/Alfresco/sfs
postgres-acs:
image: postgres:11.7
mem_limit: 512m
environment:
- POSTGRES_PASSWORD=alfresco
- POSTGRES_USER=alfresco
- POSTGRES_DB=alfresco
command: postgres -c max_connections=300 -c log_min_messages=LOG
search:
image: alfresco/alfresco-search-services:2.0.1
mem_limit: 2g
environment:
- SOLR_ALFRESCO_HOST=platform
- SOLR_ALFRESCO_PORT=8080
- SOLR_SOLR_HOST=search
- SOLR_SOLR_PORT=8983
- SOLR_CREATE_ALFRESCO_DEFAULTS=alfresco,archive
- ALFRESCO_SECURE_COMMS=none
activemq:
image: alfresco/alfresco-activemq:5.15.8
mem_limit: 256m
sync:
image: quay.io/alfresco/service-sync:3.3.3.1
mem_limit: 512m
environment:
JAVA_OPTS : "
-Dsql.db.driver=org.postgresql.Driver
-Dsql.db.url=jdbc:postgresql://postgres-acs:5432/alfresco
-Dsql.db.username=alfresco
-Dsql.db.password=alfresco
-Dmessaging.broker.host=activemq
-Drepo.hostname=platform
-Drepo.port=8080
-Ddw.server.applicationConnectors[0].type=http
-XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80
"
depends_on:
- postgres-acs
- activemq
proxy:
build: ./nginx-ingress
image: local/nginx-ingress:acs-sync
ports:
- 8080:8080
depends_on:
- platform
- sync
volumes:
shared-file-store-volume:
driver_opts:
type: tmpfs
device: tmpfs

8
nginx-ingress/Dockerfile Normal file
View File

@@ -0,0 +1,8 @@
FROM nginx:stable-alpine
COPY nginx.conf /etc/nginx/nginx.conf
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]

View File

@@ -0,0 +1,15 @@
#!/bin/sh
if [[ $ACS_PLATFORM_URL ]]; then
sed -i s%http:\/\/platform:8080%"$ACS_PLATFORM_URL"%g /etc/nginx/nginx.conf
fi
if [[ $ACS_SYNC_URL ]]; then
sed -i s%http:\/\/sync:9090%"$ACS_SYNC_URL"%g /etc/nginx/nginx.conf
fi
if [[ $ACCESS_LOG ]]; then
sed -i s%\#ENV_ACCESS_LOG%"access_log $ACCESS_LOG;"%g /etc/nginx/nginx.conf
fi
nginx -g "daemon off;"

56
nginx-ingress/nginx.conf Normal file
View File

@@ -0,0 +1,56 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen *:8080;
client_max_body_size 0;
set $allowOriginSite *;
proxy_pass_request_headers on;
proxy_pass_header Set-Cookie;
# External settings, do not remove
#ENV_ACCESS_LOG
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass_header Set-Cookie;
# Protect access to SOLR APIs
location ~ ^(/.*/service/api/solr/.*)$ {return 403;}
location ~ ^(/.*/s/api/solr/.*)$ {return 403;}
location ~ ^(/.*/wcservice/api/solr/.*)$ {return 403;}
location ~ ^(/.*/wcs/api/solr/.*)$ {return 403;}
location ~ ^(/.*/proxy/alfresco/api/solr/.*)$ {return 403 ;}
location ~ ^(/.*/-default-/proxy/alfresco/api/.*)$ {return 403;}
# Protect access to Prometheus endpoint
location ~ ^(/.*/s/prometheus)$ {return 403;}
location / {
proxy_pass http://platform:8080;
}
location /alfresco/ {
proxy_pass http://platform:8080;
# If using external proxy / load balancer (for initial redirect if no trailing slash)
absolute_redirect off;
}
location /sync/ {
proxy_pass http://sync:9090/alfresco/;
}
}
}

View File

@@ -1,73 +0,0 @@
@echo off
REM This script performs a backup of key data in the Docker Compose Alfresco
REM environment that is started using the companion `docker-compose.yml`
REM file. It backs up the binary data and database. It ignores the search
REM engine and MQ server. This is not proper for a production environment.
REM Notice that we are not compressing any of this backup. We are counting on
REM Git's ability to only deal with differences to get far better effective
REM compression over of the data as it is verioned. Git also compresses these
REM files in transit and in storage anyway. By not putting them in ZIP files, we
REM use just as little disk space with one commit and probably 90% smaller over
REM 10 commits and 99% smaller over 100 commits.
call :prepare
call :backup
exit /B 0
:prepare
echo Preparing for the backup ...
set THISDIR_REL=%~dp0
set THISDIR=%THISDIR_REL:~0,-1%
set DOCKER_COMPOSE_DIR=%THISDIR%
set DATA_DIR=%DOCKER_COMPOSE_DIR%\data
echo Clearing previous backup (if one exists) ...
rd /s /q "%DATA_DIR%"
md "%DATA_DIR%"
exit /B
:backup
echo Performing a backup ...
exit /B
:backup_database
set CONTAINER_ID=%1
set SQL_SCHEMA_FILENAME=%2
set SQL_DATA_FILENAME=%3
set DB_NAME=%4
set DB_USERNAME=%5
set DB_DISPLAY=%6
echo Backing up the %DB_DISPLAY% database ...
echo Dumping %DB_DISPLAY% database schema ...
docker container exec %CONTAINER_ID% pg_dump -U %DB_USERNAME% -s -f /tmp/%SQL_SCHEMA_FILENAME% %DB_NAME%
echo Dumping %DB_DISPLAY% database data ...
docker container exec %CONTAINER_ID% pg_dump -U %DB_USERNAME% -a -f /tmp/%SQL_DATA_FILENAME% %DB_NAME%
echo Copying %DB_DISPLAY% database schema from Docker container ...
docker cp %CONTAINER_ID%:/tmp/%SQL_SCHEMA_FILENAME% "%DOCKER_COMPOSE_DIR%\data"
echo Copying %DB_DISPLAY% database data from Docker container ...
docker cp %CONTAINER_ID%:/tmp/%SQL_DATA_FILENAME% "%DOCKER_COMPOSE_DIR%\data"
exit /B
:backup_binaryData
set CONTAINER_ID=%1
set DATA_DIRECTORY=%2
set CONTAINER_PATH=%3
set DISPLAY=%4
echo Backing up the %DISPLAY% binary data ...
echo Copying %DISPLAY% binary data ...
docker cp "%CONTAINER_ID%:%CONTAINER_PATH%\%DATA_DIRECTORY%" "%DOCKER_COMPOSE_DIR%\data"
exit /B

View File

@@ -1,69 +0,0 @@
#!/bin/bash
# This script performs a backup of key data in the Docker Compose Alfresco
# environment that is started using the companion `docker-compose.yml`
# file. It backs up the binary data and database. It ignores the search
# engine and MQ server. This is not proper for a production environment.
# Notice that we are not compressing any of this backup. We are counting on
# Git's ability to only deal with differences to get far better effective
# compression over of the data as it is verioned. Git also compresses these
# files in transit and in storage anyway. By not putting them in ZIP files, we
# use just as little disk space with one commit and probably 90% smaller over
# 10 commits and 99% smaller over 100 commits.
prepare() {
echo "Preparing for the backup ..."
export THISDIR=`dirname "$(readlink -f "$0")"`
export DOCKER_COMPOSE_DIR=$THISDIR
export DATA_DIR=$DOCKER_COMPOSE_DIR/data
source "$THISDIR/common.sh"
echo "Clearing previous backup (if one exists) ..."
sudo rm -rf "$DATA_DIR"
mkdir -p "$DATA_DIR"
}
backup() {
echo "Performing a backup ..."
}
backup_database() {
CONTAINER_ID=$1
SQL_SCHEMA_FILENAME=$2
SQL_DATA_FILENAME=$3
DB_NAME=$4
DB_USERNAME=$5
DB_DISPLAY=$6
echo "Backing up the $DB_DISPLAY database ..."
echo "Dumping $DB_DISPLAY database schema ..."
docker container exec $CONTAINER_ID pg_dump -U $DB_USERNAME -s -f /tmp/$SQL_SCHEMA_FILENAME $DB_NAME
echo "Dumping $DB_DISPLAY database data ..."
docker container exec $CONTAINER_ID pg_dump -U $DB_USERNAME -a -f /tmp/$SQL_DATA_FILENAME $DB_NAME
echo "Copying $DB_DISPLAY database schema from Docker container ..."
docker cp $CONTAINER_ID:/tmp/$SQL_SCHEMA_FILENAME "${DOCKER_COMPOSE_DIR}/data"
echo "Copying $DB_DISPLAY database data from Docker container ..."
docker cp $CONTAINER_ID:/tmp/$SQL_DATA_FILENAME "${DOCKER_COMPOSE_DIR}/data"
}
backup_binaryData() {
CONTAINER_ID=$1
DATA_DIRECTORY=$2
CONTAINER_PATH=$3
DISPLAY=$4
echo "Backing up the $DISPLAY binary data ..."
echo "Copying $DISPLAY binary data ..."
docker cp -a "$CONTAINER_ID:$CONTAINER_PATH/$DATA_DIRECTORY" "${DOCKER_COMPOSE_DIR}/data"
}
prepare
backup

View File

@@ -1,93 +0,0 @@
@echo off
call :%*
exit /B 0
:prepare_container
set SERVICE_NAME=%1
set SERVICE_DISPLAY=%2
echo Preparing the %SERVICE_DISPLAY% service or Docker container ...
echo Checking to see if %SERVICE_DISPLAY% service exists ...
set CONTAINER_ID=
for /f %%i in ('docker-compose --project-directory "%DOCKER_COMPOSE_DIR%" ps -q %SERVICE_NAME%') do set CONTAINER_ID=%%i
set CONTAINER_CREATED=
set CONTAINER_STARTED=
if "%CONTAINER_ID%" == "" (
call :create_container %*
) else (
call :check_container %*
)
exit /B
:create_container
set SERVICE_NAME=%1
set SERVICE_DISPLAY=%2
set CONTAINER_CREATED=1
echo %SERVICE_DISPLAY% service does not exist; creating and starting it ...
docker-compose --project-directory "%DOCKER_COMPOSE_DIR%" up --detach --no-deps %SERVICE_NAME%
echo Getting new %SERVICE_DISPLAY% service container ID ...
for /f %%i in ('docker-compose --project-directory "%DOCKER_COMPOSE_DIR%" ps -q %SERVICE_NAME%') do set CONTAINER_ID=%%i
echo Found %SERVICE_DISPLAY% Docker container: %CONTAINER_ID%
exit /B
:check_container
set SERVICE_NAME=%1
set SERVICE_DISPLAY=%2
echo Found %SERVICE_DISPLAY% Docker container: %CONTAINER_ID%
echo Checking to see if %SERVICE_DISPLAY% service is running ...
set CONTAINER_TOP=
for /f %%i in ('docker-compose --project-directory "%DOCKER_COMPOSE_DIR%" ps -q %SERVICE_NAME%') do set CONTAINER_TOP=%%i
if "%CONTAINER_TOP%" == "" (
call :start_container %*
) else (
echo %SERVICE_DISPLAY% service is running; will perform a hot backup ...
)
exit /B
:start_container
set SERVICE_NAME=%1
set SERVICE_DISPLAY=%2
set CONTAINER_STARTED=1
echo %SERVICE_DISPLAY% service is not running; starting it ...
docker-compose --project-directory "%DOCKER_COMPOSE_DIR%" start %SERVICE_NAME%
exit /B
:unwind_container
set SERVICE_NAME=%1
set SERVICE_DISPLAY=%2
set CONTAINER_CREATED=%3
set CONTAINER_STARTED=%4
echo Unwinding the %SERVICE_DISPLAY% service or Docker container ...
if "%CONTAINER_CREATED%" == "1" (
echo %SERVICE_DISPLAY% service did not exist; stopping and destorying it ...
docker-compose --project-directory "%DOCKER_COMPOSE_DIR%" rm --stop --force %SERVICE_NAME%
)
if "%CONTAINER_STARTED%" == "1" (
echo %SERVICE_DISPLAY% service was not running; stopping it ...
docker-compose --project-directory "%DOCKER_COMPOSE_DIR%" stop %SERVICE_NAME%
)
exit /B
:wait_container_postgres
set CONTAINER_ID=%1
echo Waiting for PostgreSQL database to become available ...
docker container exec %CONTAINER_ID% sh -c "until [ -f /var/run/postgresql/.s.PGSQL.5432.lock ]; do sleep 1; done"
exit /B

View File

@@ -1,81 +0,0 @@
#!/bin/bash
prepare_container() {
SERVICE_NAME=$1
SERVICE_DISPLAY=$2
echo "Preparing the $SERVICE_DISPLAY service or Docker container ..."
echo "Checking to see if $SERVICE_DISPLAY service exists ..."
export CONTAINER_ID=`docker-compose --project-directory "${DOCKER_COMPOSE_DIR}" ps -q $SERVICE_NAME`
unset CONTAINER_CREATED
unset CONTAINER_STARTED
if [[ -z $CONTAINER_ID ]]; then
create_container $*
else
check_container $*
fi
}
create_container() {
SERVICE_NAME=$1
SERVICE_DISPLAY=$2
export CONTAINER_CREATED=1
echo "$SERVICE_DISPLAY service does not exist; creating and starting it ..."
docker-compose --project-directory "${DOCKER_COMPOSE_DIR}" up --detach --no-deps $SERVICE_NAME
echo "Getting new $SERVICE_DISPLAY service container ID ..."
export CONTAINER_ID=`docker-compose --project-directory "${DOCKER_COMPOSE_DIR}" ps -q $SERVICE_NAME`
echo "Found $SERVICE_DISPLAY Docker container: $CONTAINER_ID"
}
check_container() {
SERVICE_NAME=$1
SERVICE_DISPLAY=$2
echo "Found $SERVICE_DISPLAY Docker container: $CONTAINER_ID"
echo "Checking to see if $SERVICE_DISPLAY service is running ..."
CONTAINER_TOP=`docker-compose --project-directory "${DOCKER_COMPOSE_DIR}" top $SERVICE_NAME`
if [[ -z $CONTAINER_TOP ]]; then
start_container $*
else
echo "$SERVICE_DISPLAY service is running; will perform while running ..."
fi
}
start_container() {
SERVICE_NAME=$1
SERVICE_DISPLAY=$2
export CONTAINER_STARTED=1
echo "$SERVICE_DISPLAY service is not running; starting it ..."
docker-compose --project-directory "${DOCKER_COMPOSE_DIR}" start $SERVICE_NAME
}
unwind_container() {
SERVICE_NAME=$1
SERVICE_DISPLAY=$2
CONTAINER_CREATED=$3
CONTAINER_STARTED=$4
echo "Unwinding the $SERVICE_DISPLAY service or Docker container ..."
if [[ $CONTAINER_CREATED ]]; then
echo "$SERVICE_DISPLAY service did not exist; stopping and destorying it ..."
docker-compose --project-directory "${DOCKER_COMPOSE_DIR}" rm --stop --force $SERVICE_NAME
elif [[ $CONTAINER_STARTED ]]; then
echo "$SERVICE_DISPLAY service was not running; stopping it ..."
docker-compose --project-directory "${DOCKER_COMPOSE_DIR}" stop $SERVICE_NAME
fi
}
wait_container_postgres() {
CONTAINER_ID=$1
echo "Waiting for PostgreSQL database to become available ..."
docker container exec $CONTAINER_ID sh -c "until [ -f /var/run/postgresql/.s.PGSQL.5432.lock ]; do sleep 1; done"
}

View File

@@ -1,81 +0,0 @@
@echo off
call :prepare
call :restore
exit /B 0
:prepare
echo Preparing to restore ...
set THISDIR_REL=%~dp0
set THISDIR=%THISDIR_REL:~0,-1%
set DOCKER_COMPOSE_DIR=%THISDIR%
set DATA_DIR=%DOCKER_COMPOSE_DIR%/data
exit /B
:restore
if exist "%DATA_DIR%" (
echo Restore data directory found
echo Removing existing data ...
docker-compose --project-directory "%DOCKER_COMPOSE_DIR%" down --volumes
setlocal ENABLEDELAYEDEXPANSION
echo Performing a restore ...
endlocal
) else (
echo Restore data directory not found; doing nothing ...
)
exit /B
:restore_database
set CONTAINER_ID=%1
set SQL_SCHEMA_FILENAME=%2
set SQL_DATA_FILENAME=%3
set DB_NAME=%4
set DB_USERNAME=%5
set DISPLAY_NAME=%6
if exist "%DATA_DIR%\%SQL_SCHEMA_FILENAME%" (
echo Restoring the %DISPLAY_NAME% database ...
wait_pgdb %CONTAINER_ID%
echo SET session_replication_role = 'replica'; > c:\Windows\Temp\db-data.sql
type "%DATA_DIR%\%SQL_DATA_FILENAME%" >> c:\Windows\Temp\db-data.sql
echo Uploading %DISPLAY_NAME% database schema to Docker container ...
docker cp "%DATA_DIR%\%SQL_SCHEMA_FILENAME%" %CONTAINER_ID%:/tmp
echo Uploading %DISPLAY_NAME% database data to Docker container ...
docker cp c:\Windows\Temp\db-data.sql %CONTAINER_ID%:/tmp
del c:\Windows\Temp\db-data.sql
echo Restoring %DISPLAY_NAME% database schema ...
docker container exec %CONTAINER_ID% psql -U %DB_USERNAME% -f /tmp/%SQL_SCHEMA_FILENAME% %DB_NAME%
echo Restoring %DISPLAY_NAME% database data ...
docker container exec %CONTAINER_ID% psql -U %DB_USERNAME% -f /tmp/db-data.sql %DB_NAME%
)
exit /B
:restore_binaryData
set CONTAINER_ID=%1
set DATA_DIRECTORY=%2
set CONTAINER_PATH=%3
set DISPLAY_NAME=%4
if exist "%DATA_DIR%\%DATA_DIRECTORY%" (
echo Restoring the %DISPLAY_NAME% binary data ...
echo Copying %DISPLAY_NAME% binary data ...
docker cp "%DATA_DIR%\%DATA_DIRECTORY%" "%CONTAINER_ID%:%CONTAINER_PATH%"
)
exit /B

View File

@@ -1,69 +0,0 @@
#!/bin/bash
prepare() {
echo "Preparing to restore ..."
export THISDIR=`dirname "$(readlink -f "$0")"`
export DOCKER_COMPOSE_DIR=$THISDIR
export DATA_DIR=$DOCKER_COMPOSE_DIR/data
source "$THISDIR/common.sh"
}
restore() {
if [ -d "${DATA_DIR}" ]; then
echo "Restore data directory found"
echo "Removing existing data ..."
docker-compose --project-directory "${DOCKER_COMPOSE_DIR}" down --volumes
echo "Performing a restore ..."
else
echo "Restore data directory not found; doing nothing ..."
fi
}
restore_database() {
CONTAINER_ID=$1
SQL_SCHEMA_FILENAME=$2
SQL_DATA_FILENAME=$3
DB_NAME=$4
DB_USERNAME=$5
DISPLAY_NAME=$6
if [ -f "${DATA_DIR}/$SQL_SCHEMA_FILENAME" ]; then
echo "Restoring the $DISPLAY_NAME database ..."
echo "SET session_replication_role = 'replica';" | cat - "${DATA_DIR}/$SQL_DATA_FILENAME" > /tmp/db-data.sql
echo "Uploading $DISPLAY_NAME database schema to Docker container ..."
docker cp "${DATA_DIR}/$SQL_SCHEMA_FILENAME" $CONTAINER_ID:/tmp
echo "Uploading $DISPLAY_NAME database data to Docker container ..."
docker cp /tmp/db-data.sql $CONTAINER_ID:/tmp
rm /tmp/db-data.sql
echo "Restoring $DISPLAY_NAME database schema ..."
docker container exec $CONTAINER_ID psql -U $DB_USERNAME -f /tmp/$SQL_SCHEMA_FILENAME $DB_NAME
echo "Restoring $DISPLAY_NAME database data ..."
docker container exec $CONTAINER_ID psql -U $DB_USERNAME -f /tmp/db-data.sql $DB_NAME
fi
}
restore_binaryData() {
CONTAINER_ID=$1
DATA_DIRECTORY=$2
CONTAINER_PATH=$3
DISPLAY_NAME=$4
if [ -d "${DATA_DIR}/$DATA_DIRECTORY" ]; then
echo "Restoring the $DISPLAY_NAME binary data ..."
echo "Copying $DISPLAY_NAME binary data ..."
sudo docker cp "${DATA_DIR}/$DATA_DIRECTORY" "$CONTAINER_ID:$CONTAINER_PATH"
fi
}
prepare
restore