├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── Vagrantfile ├── auto-install.j2 ├── docker-compose-mysql-wf.yml ├── docker-compose-postgres.yml ├── docker-compose.yml ├── stack-mysql57.yml ├── stack.yml ├── start-logicaldoc.sh ├── wait-for-it.sh ├── wait-for-mysql.sh └── wait-for-postgres.sh /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.bak 3 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # LogicalDOC Document Management System ( https://www.logicaldoc.com ) 2 | FROM openjdk:11-jdk 3 | 4 | MAINTAINER LogicalDOC 5 | 6 | # set default variables for LogicalDOC install 7 | ENV LDOC_VERSION="8.7.3" 8 | ENV LDOC_MEMORY="2500" 9 | ENV DEBIAN_FRONTEND="noninteractive" 10 | ENV CATALINA_HOME="/opt/logicaldoc/tomcat" 11 | ENV DB_ENGINE="mysql" 12 | ENV DB_HOST="mysql-ld" 13 | ENV DB_PORT="3306" 14 | ENV DB_NAME="logicaldoc" 15 | ENV DB_INSTANCE="" 16 | ENV DB_USER="ldoc" 17 | ENV DB_PASSWORD="changeme" 18 | ENV DB_MANUALURL="false" 19 | ENV DB_URL="" 20 | 21 | 22 | RUN mkdir /opt/logicaldoc 23 | COPY start-logicaldoc.sh /opt/logicaldoc 24 | COPY auto-install.j2 /opt/logicaldoc 25 | COPY wait-for-it.sh / 26 | COPY wait-for-postgres.sh / 27 | 28 | # prepare system for java installation (to be removed) 29 | RUN apt-get update && \ 30 | apt-get -y install software-properties-common 31 | 32 | # Packages needed to install LogicalDOC CE 33 | RUN apt-get -y install \ 34 | curl \ 35 | unzip \ 36 | imagemagick \ 37 | ghostscript \ 38 | python3-jinja2 \ 39 | python3-pip \ 40 | mariadb-client \ 41 | postgresql-client \ 42 | vim \ 43 | nano 44 | 45 | # Download and unzip LogicalDOC CE installer 46 | RUN curl -L https://sourceforge.net/projects/logicaldoc/files/distribution/LogicalDOC%20CE%208.7/logicaldoc-community-installer-${LDOC_VERSION}.zip/download \ 47 | -o /opt/logicaldoc/logicaldoc-community-installer-${LDOC_VERSION}.zip && \ 48 | unzip /opt/logicaldoc/logicaldoc-community-installer-${LDOC_VERSION}.zip -d /opt/logicaldoc && \ 49 | rm /opt/logicaldoc/logicaldoc-community-installer-${LDOC_VERSION}.zip 50 | 51 | #COPY logicaldoc-community-installer-${LDOC_VERSION}.zip /opt/logicaldoc/ 52 | #RUN unzip /opt/logicaldoc/logicaldoc-community-installer-${LDOC_VERSION}.zip -d /opt/logicaldoc && \ 53 | # rm /opt/logicaldoc/logicaldoc-community-installer-${LDOC_VERSION}.zip 54 | 55 | # Install j2cli for the transformation of the templates (Jinja2) 56 | RUN pip install j2cli 57 | 58 | #volumes for persistent storage 59 | VOLUME /opt/logicaldoc/conf 60 | VOLUME /opt/logicaldoc/repository 61 | 62 | EXPOSE 8080 63 | 64 | CMD ["/opt/logicaldoc/start-logicaldoc.sh", "run"] 65 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Docker pulls](https://img.shields.io/docker/pulls/logicaldoc/logicaldoc-ce.svg?maxAge=3600)](https://hub.docker.com/r/logicaldoc/logicaldoc-ce/) [![Docker Stars](https://img.shields.io/docker/stars/logicaldoc/logicaldoc-ce.svg?maxAge=3600)](https://hub.docker.com/r/logicaldoc/logicaldoc-ce/) [![Docker layers](https://images.microbadger.com/badges/image/logicaldoc/logicaldoc-ce.svg)](https://microbadger.com/images/logicaldoc/logicaldoc-ce.svg) [![Docker version](https://images.microbadger.com/badges/version/logicaldoc/logicaldoc-ce.svg)](https://microbadger.com/images/logicaldoc/logicaldoc-ce) ![License](https://img.shields.io/badge/License-LGPL%20v3-green.svg?maxAge=3600) 2 | 3 | # LogicalDOC Community Edition (AKA LogicalDOC CE) 4 | A repository for LogicalDOC DMS - Community Edition - Docker image https://www.logicaldoc.com/download-logicaldoc-community 5 | Note: This image requires to be connected to an external database 6 | 7 | ## What is LogicalDOC CE? 8 | LogicalDOC Community Edition (AKA LogicalDOC CE) is an open-source document management software platform. 9 | By leveraging on the best-of-breed Java frameworks, it creates a flexible and powerful document management platform, which thanks to the most advanced presentation technology (Google GWT), is able to meet the needs of usability and more demanding management. 10 | LogicalDOC is both document management and collaboration system. The software is loaded with many functions and allows organizing, index, retrieving, controlling and distributing important business documents securely and safely for any organization and individual. 11 | 12 | Check out https://www.logicaldoc.com to learn more. 13 | 14 | The design of LogicalDOC is based on best-of-breed Java technologies in order to provide a reliable DMS platform. The main interface is Web-based, no need to install anything else; users can access the system through their browser. 15 | LogicalDOC CE is 100% free software, supports all major DBMS and this particular distribution installation can be used with MySQL, MariaDB and PostreSQL 16 | 17 | 18 | ![LogicalDOC CE](https://www.logicaldoc.com/images/assets/LogicalDocWhiteH02-167.png) 19 | 20 | * **SourceForge project**: https://sourceforge.net/projects/logicaldoc/ 21 | * **Manuals**: https://docs.logicaldoc.com 22 | * **Forums**: https://forums.logicaldoc.com 23 | 24 | ### How to use this image 25 | 26 | **Start a LogicalDOC instance linked to a MySQL container** 27 | 1. Run the MySQL container 28 | ```Shell 29 | docker run -d --name=mysql-ld -e MYSQL_ROOT_PASSWORD=mypassword -e MYSQL_DATABASE=logicaldoc -e MYSQL_USER=ldoc -e MYSQL_PASSWORD=changeme mysql:8.0 --default-authentication-plugin=mysql_native_password 30 | ``` 31 | 32 | 2. Run the LogicalDOC container 33 | ```Shell 34 | docker run -d -p 8080:8080 --link mysql-ld logicaldoc/logicaldoc-ce 35 | ``` 36 | 37 | This image includes EXPOSE 8080 (the logicaldoc port). The default LogicalDOC configuration is applied. 38 | 39 | Then, access it via `http://localhost:8080` or `http://host-ip:8080` in a browser. Default User and Password are **admin** / **admin**. 40 | 41 | Notes: 42 | In the most recent versions of MySQL it is necessary to enable native authentication, otherwise LogicalDOC will not be able to connect. 43 | To do this, simply add the default-authentication-plugin command line argument to the container launch string 44 | e.g.: 45 | ```Shell 46 | docker run -d --name=mysql-ld -e MYSQL_ROOT_PASSWORD=mypassword -e MYSQL_DATABASE=logicaldoc -e MYSQL_USER=ldoc -e MYSQL_PASSWORD=changeme mysql:8.0.23 --default-authentication-plugin=mysql_native_password 47 | ``` 48 | or with the latest MySQL 8 image 49 | ```Shell 50 | docker run -d --name=mysql-ld -e MYSQL_ROOT_PASSWORD=mypassword -e MYSQL_DATABASE=logicaldoc -e MYSQL_USER=ldoc -e MYSQL_PASSWORD=changeme mysql:latest --default-authentication-plugin=mysql_native_password 51 | ``` 52 | 53 | 54 | ## Start a LogicalDOC with some settings 55 | ```Shell 56 | docker run -d -p 8080:8080 -e LDOC_MEMORY=4000 --link mysql-ld logicaldoc/logicaldoc-ce 57 | ``` 58 | This will run the same image as above but with 4000 MB memory allocated to LogicalDOC. 59 | 60 | Then, access it via `http://localhost:8080` or `http://host-ip:8080` in a browser. 61 | 62 | If you'd like to use an external database instead of a linked `mysql-ld` container, specify the hostname with `DB_HOST` and port with `DB_PORT` along with the password in `DB_PASSWORD` and the username in `DB_USER` (if it is something other than `ldoc`): 63 | 64 | ```console 65 | $ docker run -d -p 8080:8080 -e DB_HOST=10.1.2.3 -e DB_PORT=3306 -e DB_USER=... -e DB_PASSWORD=... logicaldoc/logicaldoc-ce 66 | ``` 67 | 68 | ## Persistence of configuration and documents 69 | Start as a daemon with attached volumes to persist the configuration and the documents 70 | ```console 71 | $ docker run -d --name logicaldoc-ce --restart=always -p 8080:8080 -v logicaldoc-conf:/opt/logicaldoc/conf -v logicaldoc-repo:/opt/logicaldoc/repository --link mysql-ld logicaldoc/logicaldoc-ce 72 | ``` 73 | 74 | All document files will be stored in the volume ``logicaldoc-repo``, the configuration files insead are in volume ``logicaldoc-conf` 75 | 76 | In this case the physical location of the ``logicaldoc-conf`` volume is ``/var/lib/docker/volumes/logicaldoc-conf/_data`` while the location of ``logicaldoc-repo`` volume is ``/var/lib/docker/volumes/logicaldoc-repo/_data`` 77 | 78 | 79 | ## Environment Variables 80 | The LogicalDOC image uses environment variables that allow to obtain a more specific setup. 81 | 82 | * **LDOC_MEMORY**: memory allocated for LogicalDOC expressed in MB (default is 2000) 83 | * **DB_ENGINE**: the database type, possible vaues are: mysql(default), mssql, oracle, postgres 84 | * **DB_HOST**: the database server host (default is 'mysql-ld') 85 | * **DB_PORT**: the database communication port (default is 3306) 86 | * **DB_NAME**: the database name (default is 'logicaldoc') 87 | * **DB_INSTANCE**: some databases require the instance specification 88 | * **DB_USER**: the username (default is 'ldoc') 89 | * **DB_PASSWORD**: the password (default is 'changeme') 90 | * **DB_MANUALURL**: must be true when using DB_URL (default is 'false') 91 | * **DB_URL**: the jdbc url to connect to the database (remember to set DB_MANUALURL to 'true') 92 | 93 | ## Using Oracle or MS SQL as Database engine 94 | At the following address you can find some examples of this container configured to use Oracle Database or MS SQL (Microsoft SQL server). 95 | Also, in some of these examples the DB_URL and DB_MANUALURL properties are explicitly used for database configuration 96 | 97 | https://wiki.logicaldoc.com/wiki/Docker 98 | 99 | ## Stopping and starting the container 100 | Assuming that you have assigned the "logicaldoc-ce" alias to the container 101 | 102 | To stop the container use: 103 | 104 | ```console 105 | $ docker stop logicaldoc-ce 106 | ``` 107 | 108 | To start the container again: 109 | 110 | ```console 111 | $ docker start logicaldoc-ce 112 | ``` 113 | 114 | ## Configuration 115 | (You must have enabled data persistence with volume assignment) 116 | 117 | To edit the settings file, check the physical location of the ``logicaldoc-conf`` volume using: 118 | 119 | ```console 120 | $ docker volume inspect logicaldoc-conf 121 | ``` 122 | 123 | Which should produce an output similar to this one: 124 | 125 | ```console 126 | [ 127 | { 128 | "Name": "logicaldoc-conf", 129 | "Driver": "local", 130 | "Mountpoint": "/var/lib/docker/volumes/logicaldoc-conf/_data", 131 | "Labels": null, 132 | "Scope": "local" 133 | } 134 | ] 135 | ``` 136 | In this case the physical location of the ``logicaldoc-conf`` volume is ``/var/lib/docker/volumes/logicaldoc-conf/_data``. 137 | 138 | ## Performing backups 139 | 140 | To backup the existing data, check the physical location of the ``logicaldoc-conf`` and ``logicaldoc-repo`` volumes using: 141 | 142 | ```console 143 | $ docker volume inspect logicaldoc-conf 144 | ``` 145 | 146 | Which should produce an output similar to this one: 147 | 148 | ```console 149 | [ 150 | { 151 | "Name": "logicaldoc-conf", 152 | "Driver": "local", 153 | "Mountpoint": "/var/lib/docker/volumes/logicaldoc-conf/_data", 154 | "Labels": null, 155 | "Scope": "local" 156 | } 157 | ] 158 | ``` 159 | 160 | ```console 161 | $ sudo tar -zcvf backup.tar.gz /var/lib/docker/volumes/logicaldoc-conf/_data /var/lib/docker/volumes/logicaldoc-repo/_data 162 | $ sudo chown `whoami` backup.tar.gz 163 | ``` 164 | 165 | If an external PostgreSQL or MySQL database or database containers, these too need to be backed up using their respective procedures. 166 | 167 | 168 | ## Restoring from a backup 169 | 170 | Uncompress the backup archive in the original docker volume using: 171 | 172 | ```console 173 | $ sudo tar -xvzf backup.tar.gz -C / 174 | ``` 175 | 176 | ## Building the image 177 | 178 | Clone the repository with: 179 | 180 | ```console 181 | $ git clone https://github.com/logicaldoc/logicaldoc-ce.git 182 | ``` 183 | 184 | Change to the directory of the cloned repository: 185 | 186 | ```console 187 | $ cd logicaldoc-ce 188 | ``` 189 | 190 | Execute Docker's build command: 191 | 192 | ```console 193 | $ docker build -t logicaldoc/logicaldoc-ce . 194 | ``` 195 | 196 | Or using an apt cacher to speed up the build: 197 | 198 | ```console 199 | $ docker build -t logicaldoc/logicaldoc-ce --build-arg APT_PROXY=172.18.0.1:3142 . 200 | ``` 201 | 202 | Replace the IP address `172.18.0.1` with the IP address of the Docker host used from which these commands are running. 203 | 204 | ## Testing 205 | 206 | Start a Vagrant box from the include Vagrant file. This Vagrant box will builds the Docker image and then start a container: 207 | 208 | ```console 209 | $ vagrant up 210 | ``` 211 | 212 | Create the same Vagrant box using an apt cacher to speed up the build: 213 | 214 | ```console 215 | $ APT_PROXY=172.18.0.1:3142 vagrant up 216 | ``` 217 | 218 | Replace the IP address `172.18.0.1` with the IP address of the Docker host used from which these commands are running. 219 | 220 | ## Using Docker compose 221 | 222 | To deploy a complete production stack using the included Docker compose file execute: 223 | 224 | ```console 225 | $ docker-compose -f docker-compose.yml up -d 226 | ``` 227 | 228 | This Docker compose file will provision 2 containers: 229 | 230 | - MySQL as the database 231 | - LogicalDOC CE using the above service container 232 | 233 | To stop the stack use: 234 | 235 | ```console 236 | $ docker-compose -f docker-compose.yml stop 237 | ``` 238 | 239 | The stack will also create three volumes to store the data of each container. These are: 240 | 241 | - ldoc_conf - The LogicalDOC configuration container, normally called `logicaldoc-conf` when not using Docker compose. 242 | - ldoc_repository - The LogicalDOC DMS data container for documents and search indexes, normally called `logicaldoc-repo` when not using Docker compose. 243 | - ldoc_db - The database volume, in this case MySQL. 244 | 245 | ### Stopping and starting with Docker compose 246 | 247 | To stop the services use: 248 | 249 | ```console 250 | $ docker-compose -f docker-compose.yml stop 251 | ``` 252 | 253 | To start the services again: 254 | 255 | ```console 256 | $ docker-compose -f docker-compose.yml start 257 | ``` 258 | 259 | To remove the stopped containers: 260 | 261 | ```console 262 | $ docker-compose -f docker-compose.yml rm -v 263 | ``` 264 | 265 | Destroys the containers and all the created volumes: 266 | 267 | ```console 268 | $ docker-compose -f docker-compose.yml down -v 269 | ``` 270 | 271 | 272 | ### Docker compose examples 273 | Some docker-compose examples are available in the repository of this container on GitHub https://github.com/logicaldoc/logicaldoc-ce 274 | 275 | ## ... via [`docker stack deploy`](https://docs.docker.com/engine/reference/commandline/stack_deploy/) or [`docker-compose`](https://github.com/docker/compose) 276 | 277 | Example `stack.yml` for `logicaldoc-ce`: 278 | 279 | ```yaml 280 | version: "3.1" 281 | 282 | services: 283 | 284 | logicaldoc: 285 | depends_on: 286 | - mysql-ld 287 | command: ["./wait-for-it.sh", "mysql-ld:3306", "-t", "30", "--", "/opt/logicaldoc/start-logicaldoc.sh", "run"] 288 | image: logicaldoc/logicaldoc-ce 289 | ports: 290 | - 8080:8080 291 | environment: 292 | - LDOC_MEMORY=2000 293 | 294 | mysql-ld: 295 | image: mysql:8.0 296 | command: --default-authentication-plugin=mysql_native_password 297 | environment: 298 | - MYSQL_ROOT_PASSWORD=example 299 | - MYSQL_DATABASE=logicaldoc 300 | - MYSQL_USER=ldoc 301 | - MYSQL_PASSWORD=changeme 302 | 303 | ``` 304 | 305 | [![Try in PWD](https://github.com/play-with-docker/stacks/raw/cff22438cb4195ace27f9b15784bbb497047afa7/assets/images/button.png)](http://play-with-docker.com?stack=https://raw.githubusercontent.com/logicaldoc/logicaldoc-ce/master/stack.yml) 306 | 307 | Run `docker stack deploy -c stack.yml logicaldocce` , wait for it to initialize completely, and visit `http://swarm-ip:8080`, `http://localhost:8080`, or `http://host-ip:8080` (as appropriate). 308 | 309 | ## Shell Access 310 | 311 | For debugging and maintenance purposes you may want access the containers shell. If you are using Docker version `1.3.0` or higher you can access a running containers shell by starting `bash` using `docker exec`. 312 | 313 | Assuming that you have assigned the "logicaldoc-ce" alias to the container: 314 | 315 | ```bash 316 | docker exec -it logicaldoc-ce bash 317 | ``` 318 | 319 | 320 | 321 | 322 | 323 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | Vagrant.configure(2) do |config| 2 | config.vm.provider "virtualbox" do |v| 3 | v.memory = 3072 4 | v.cpus = 2 5 | config.vm.network "forwarded_port", guest: 8080, host: 8080 6 | end 7 | 8 | config.vm.define :dockerhost do |config| 9 | config.vm.box = "bento/debian-8.6" 10 | 11 | if ENV["apt_proxy"] 12 | config.vm.provision "shell", inline: <<-EOF 13 | echo "Acquire::http::Proxy \\"#{ENV['apt_proxy']}\\";" >/etc/apt/apt.conf.d/50proxy 14 | echo "apt_proxy=\"#{ENV['apt_proxy']}\"" >/etc/profile.d/apt_proxy.sh 15 | EOF 16 | end 17 | 18 | config.vm.provision "shell", env: {"apt_proxy" => ENV["apt_proxy"]}, inline: <<-EOF 19 | set -e 20 | export DEBIAN_FRONTEND=noninteractive 21 | echo "en_US.UTF-8 UTF-8" >/etc/locale.gen 22 | locale-gen 23 | echo "Apt::Install-Recommends 'false';" >/etc/apt/apt.conf.d/02no-recommends 24 | echo "Acquire::Languages { 'none' };" >/etc/apt/apt.conf.d/05no-languages 25 | apt-get update 26 | apt-get -y autoremove --purge 27 | wget -qO- https://get.docker.com/ | sh 28 | sudo usermod -aG docker vagrant 29 | cd /vagrant 30 | 31 | if [ $apt_proxy ]; then 32 | docker build -t logicaldoc/logicaldoc-ce --build-arg APT_PROXY=$apt_proxy . 33 | else 34 | docker build -t logicaldoc/logicaldoc-ce . 35 | fi 36 | 37 | #docker run --rm -v logicaldoc-repo:/opt/logicaldoc/repository -v logicaldoc-conf:/opt/logicaldoc/conf logicaldoc/logicaldoc-ce 38 | docker run -d --name logicaldocce --restart=always -p 8080:8080 -v logicaldoc-repo:/opt/logicaldoc/repository -v logicaldoc-conf:/opt/logicaldoc/conf logicaldoc/logicaldoc-ce 39 | EOF 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /auto-install.j2: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | /opt/logicaldoc 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /docker-compose-mysql-wf.yml: -------------------------------------------------------------------------------- 1 | version: '2.0' 2 | services: 3 | logicaldoc: 4 | depends_on: 5 | - lddb 6 | command: ["./wait-for-it.sh", "mysql-ld:3306", "-t", "30", "--", "/opt/logicaldoc/start-logicaldoc.sh", "run"] 7 | image: logicaldoc/logicaldoc-ce 8 | restart: always 9 | ports: 10 | - 8080:8080 11 | environment: 12 | - LDOC_MEMORY=2000 13 | 14 | lddb: 15 | container_name: mysql-ld 16 | image: mysql:8.0 17 | command: --default-authentication-plugin=mysql_native_password 18 | restart: always 19 | environment: 20 | - MYSQL_ROOT_PASSWORD=example 21 | - MYSQL_DATABASE=logicaldoc 22 | - MYSQL_USER=ldoc 23 | - MYSQL_PASSWORD=changeme 24 | -------------------------------------------------------------------------------- /docker-compose-postgres.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | 5 | db: 6 | container_name: ld-postgres 7 | image: postgres:9.3 8 | ports: 9 | - 5432:5432 10 | environment: 11 | - POSTGRES_DB=logicaldoc 12 | - POSTGRES_USER=ldoc 13 | - POSTGRES_PASSWORD=changeme 14 | 15 | logicaldoc: 16 | depends_on: 17 | - db 18 | command: ["./wait-for-postgres.sh", "ld-postgres", "logicaldoc", "ldoc", "changeme", "/opt/logicaldoc/start-logicaldoc.sh run", "run"] 19 | container_name: logicaldoc-ce 20 | image: logicaldoc/logicaldoc-ce 21 | ports: 22 | - 8080:8080 23 | environment: 24 | - LDOC_MEMORY=2000 25 | - DB_HOST=ld-postgres 26 | - DB_NAME=logicaldoc 27 | - DB_USER=ldoc 28 | - DB_PASSWORD=changeme 29 | - DB_PORT=5432 30 | - DB_ENGINE=postgres 31 | 32 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | services: 3 | db: 4 | container_name: mysql-ld 5 | image: mysql:8.0 6 | command: --default-authentication-plugin=mysql_native_password 7 | volumes: 8 | - ldoc_db:/var/lib/mysql 9 | ports: 10 | - 3306:3306 11 | environment: 12 | - MYSQL_ROOT_PASSWORD=mysqlroot 13 | - MYSQL_DATABASE=logicaldoc 14 | - MYSQL_USER=ldoc 15 | - MYSQL_PASSWORD=changeme 16 | 17 | logicaldoc: 18 | container_name: logicaldoc-ce 19 | image: logicaldoc/logicaldoc-ce 20 | depends_on: 21 | - db 22 | command: ["./wait-for-it.sh", "mysql-ld:3306", "-t", "30", "--", "/opt/logicaldoc/start-logicaldoc.sh", "run"] 23 | ports: 24 | - 8080:8080 25 | environment: 26 | - LDOC_MEMORY=2000 27 | - DB_HOST=mysql-ld 28 | - DB_NAME=logicaldoc 29 | - DB_USER=ldoc 30 | - DB_PASSWORD=changeme 31 | volumes: 32 | - ldoc_conf:/opt/logicaldoc/conf 33 | - ldoc_repository:/opt/logicaldoc/repository 34 | # ulimits: 35 | # nproc: 65535 36 | # nofile: 37 | # soft: 6000 38 | # hard: 40000 39 | # mem_limit: 7000000000 40 | 41 | volumes: 42 | ldoc_db: 43 | ldoc_conf: 44 | ldoc_repository: 45 | 46 | 47 | -------------------------------------------------------------------------------- /stack-mysql57.yml: -------------------------------------------------------------------------------- 1 | version: "3.1" 2 | 3 | services: 4 | 5 | logicaldoc: 6 | depends_on: 7 | - mysql-ld 8 | command: ["./wait-for-it.sh", "mysql-ld:3306", "-t", "30", "--", "/opt/logicaldoc/start-logicaldoc.sh", "run"] 9 | image: logicaldoc/logicaldoc-ce 10 | ports: 11 | - 8080:8080 12 | environment: 13 | - LDOC_MEMORY=2000 14 | 15 | mysql-ld: 16 | image: mysql:5.7 17 | environment: 18 | - MYSQL_ROOT_PASSWORD=example 19 | - MYSQL_DATABASE=logicaldoc 20 | - MYSQL_USER=ldoc 21 | - MYSQL_PASSWORD=changeme 22 | -------------------------------------------------------------------------------- /stack.yml: -------------------------------------------------------------------------------- 1 | version: "3.1" 2 | 3 | services: 4 | 5 | logicaldoc: 6 | depends_on: 7 | - mysql-ld 8 | command: ["./wait-for-it.sh", "mysql-ld:3306", "-t", "30", "--", "/opt/logicaldoc/start-logicaldoc.sh", "run"] 9 | image: logicaldoc/logicaldoc-ce 10 | ports: 11 | - 8080:8080 12 | environment: 13 | - LDOC_MEMORY=2000 14 | 15 | mysql-ld: 16 | image: mysql:8.0.28 17 | command: --default-authentication-plugin=mysql_native_password 18 | environment: 19 | - MYSQL_ROOT_PASSWORD=example 20 | - MYSQL_DATABASE=logicaldoc 21 | - MYSQL_USER=ldoc 22 | - MYSQL_PASSWORD=changeme 23 | -------------------------------------------------------------------------------- /start-logicaldoc.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -eo pipefail 3 | if [ ! -d /opt/logicaldoc/tomcat ]; then 4 | printf "Installing LogicalDOC\n" 5 | j2 /opt/logicaldoc/auto-install.j2 > /opt/logicaldoc/auto-install.xml 6 | java -jar /opt/logicaldoc/logicaldoc-installer.jar /opt/logicaldoc/auto-install.xml 7 | /opt/logicaldoc/bin/logicaldoc.sh stop 8 | /opt/logicaldoc/tomcat/bin/catalina.sh stop 9 | else 10 | printf "LogicalDOC already installed\n" 11 | fi 12 | 13 | case $1 in 14 | run) echo "run"; 15 | /opt/logicaldoc/bin/logicaldoc.sh run 16 | ;; 17 | start) echo "start"; 18 | /opt/logicaldoc/bin/logicaldoc.sh start 19 | ;; 20 | stop) echo "STOOP!!!"; 21 | /opt/logicaldoc/bin/logicaldoc.sh stop 22 | ;; 23 | *) /opt/logicaldoc/bin/logicaldoc.sh $1 24 | ;; 25 | esac 26 | 27 | 28 | -------------------------------------------------------------------------------- /wait-for-it.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Use this script to test if a given TCP host/port are available 3 | 4 | cmdname=$(basename $0) 5 | 6 | echoerr() { if [[ $QUIET -ne 1 ]]; then echo "$@" 1>&2; fi } 7 | 8 | usage() 9 | { 10 | cat << USAGE >&2 11 | Usage: 12 | $cmdname host:port [-s] [-t timeout] [-- command args] 13 | -h HOST | --host=HOST Host or IP under test 14 | -p PORT | --port=PORT TCP port under test 15 | Alternatively, you specify the host and port as host:port 16 | -s | --strict Only execute subcommand if the test succeeds 17 | -q | --quiet Don't output any status messages 18 | -t TIMEOUT | --timeout=TIMEOUT 19 | Timeout in seconds, zero for no timeout 20 | -- COMMAND ARGS Execute command with args after the test finishes 21 | USAGE 22 | exit 1 23 | } 24 | 25 | wait_for() 26 | { 27 | if [[ $TIMEOUT -gt 0 ]]; then 28 | echoerr "$cmdname: waiting $TIMEOUT seconds for $HOST:$PORT" 29 | else 30 | echoerr "$cmdname: waiting for $HOST:$PORT without a timeout" 31 | fi 32 | start_ts=$(date +%s) 33 | while : 34 | do 35 | if [[ $ISBUSY -eq 1 ]]; then 36 | nc -z $HOST $PORT 37 | result=$? 38 | else 39 | (echo > /dev/tcp/$HOST/$PORT) >/dev/null 2>&1 40 | result=$? 41 | fi 42 | if [[ $result -eq 0 ]]; then 43 | end_ts=$(date +%s) 44 | echoerr "$cmdname: $HOST:$PORT is available after $((end_ts - start_ts)) seconds" 45 | break 46 | fi 47 | sleep 1 48 | done 49 | return $result 50 | } 51 | 52 | wait_for_wrapper() 53 | { 54 | # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692 55 | if [[ $QUIET -eq 1 ]]; then 56 | timeout $BUSYTIMEFLAG $TIMEOUT $0 --quiet --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & 57 | else 58 | timeout $BUSYTIMEFLAG $TIMEOUT $0 --child --host=$HOST --port=$PORT --timeout=$TIMEOUT & 59 | fi 60 | PID=$! 61 | trap "kill -INT -$PID" INT 62 | wait $PID 63 | RESULT=$? 64 | if [[ $RESULT -ne 0 ]]; then 65 | echoerr "$cmdname: timeout occurred after waiting $TIMEOUT seconds for $HOST:$PORT" 66 | fi 67 | return $RESULT 68 | } 69 | 70 | # process arguments 71 | while [[ $# -gt 0 ]] 72 | do 73 | case "$1" in 74 | *:* ) 75 | hostport=(${1//:/ }) 76 | HOST=${hostport[0]} 77 | PORT=${hostport[1]} 78 | shift 1 79 | ;; 80 | --child) 81 | CHILD=1 82 | shift 1 83 | ;; 84 | -q | --quiet) 85 | QUIET=1 86 | shift 1 87 | ;; 88 | -s | --strict) 89 | STRICT=1 90 | shift 1 91 | ;; 92 | -h) 93 | HOST="$2" 94 | if [[ $HOST == "" ]]; then break; fi 95 | shift 2 96 | ;; 97 | --host=*) 98 | HOST="${1#*=}" 99 | shift 1 100 | ;; 101 | -p) 102 | PORT="$2" 103 | if [[ $PORT == "" ]]; then break; fi 104 | shift 2 105 | ;; 106 | --port=*) 107 | PORT="${1#*=}" 108 | shift 1 109 | ;; 110 | -t) 111 | TIMEOUT="$2" 112 | if [[ $TIMEOUT == "" ]]; then break; fi 113 | shift 2 114 | ;; 115 | --timeout=*) 116 | TIMEOUT="${1#*=}" 117 | shift 1 118 | ;; 119 | --) 120 | shift 121 | CLI=("$@") 122 | break 123 | ;; 124 | --help) 125 | usage 126 | ;; 127 | *) 128 | echoerr "Unknown argument: $1" 129 | usage 130 | ;; 131 | esac 132 | done 133 | 134 | if [[ "$HOST" == "" || "$PORT" == "" ]]; then 135 | echoerr "Error: you need to provide a host and port to test." 136 | usage 137 | fi 138 | 139 | TIMEOUT=${TIMEOUT:-15} 140 | STRICT=${STRICT:-0} 141 | CHILD=${CHILD:-0} 142 | QUIET=${QUIET:-0} 143 | 144 | # check to see if timeout is from busybox? 145 | # check to see if timeout is from busybox? 146 | TIMEOUT_PATH=$(realpath $(which timeout)) 147 | if [[ $TIMEOUT_PATH =~ "busybox" ]]; then 148 | ISBUSY=1 149 | BUSYTIMEFLAG="-t" 150 | else 151 | ISBUSY=0 152 | BUSYTIMEFLAG="" 153 | fi 154 | 155 | if [[ $CHILD -gt 0 ]]; then 156 | wait_for 157 | RESULT=$? 158 | exit $RESULT 159 | else 160 | if [[ $TIMEOUT -gt 0 ]]; then 161 | wait_for_wrapper 162 | RESULT=$? 163 | else 164 | wait_for 165 | RESULT=$? 166 | fi 167 | fi 168 | 169 | if [[ $CLI != "" ]]; then 170 | if [[ $RESULT -ne 0 && $STRICT -eq 1 ]]; then 171 | echoerr "$cmdname: strict mode, refusing to execute subprocess" 172 | exit $RESULT 173 | fi 174 | exec "${CLI[@]}" 175 | else 176 | exit $RESULT 177 | fi 178 | -------------------------------------------------------------------------------- /wait-for-mysql.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | set -x 5 | 6 | host="$1" 7 | shift 8 | cmd="$@" 9 | 10 | until mysql -h "$host" -u ${MYSQL_USER} -p${MYSQL_PASSWORD} ${MYSQL_DATABASE} -e 'select 1'; do 11 | >&2 echo "MySQL is unavailable - sleeping" 12 | sleep 1 13 | done 14 | 15 | >&2 echo "Mysql is up - executing command" 16 | exec $cmd 17 | -------------------------------------------------------------------------------- /wait-for-postgres.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # wait-for-postgres.sh 3 | 4 | set -e 5 | 6 | host="$1" 7 | dbname="$2" 8 | user="$3" 9 | 10 | export PGPASSWORD="$4" 11 | 12 | shift 4 13 | cmd="$@" 14 | 15 | until psql -h "$host" -U "$user" -d "$dbname" -c '\q'; do 16 | >&2 echo "Postgres is unavailable - sleeping" 17 | sleep 1 18 | done 19 | 20 | >&2 echo "Postgres is up - executing command" 21 | exec $cmd 22 | --------------------------------------------------------------------------------