diff --git a/.ci/setup-tools.sh b/.ci/setup-tools.sh index a01fcfa..0764ca5 100755 --- a/.ci/setup-tools.sh +++ b/.ci/setup-tools.sh @@ -3,12 +3,13 @@ set -euo pipefail IFS=$'\n\t' -COMMANDER_VERSION=1.2.1 -DOCKER_COMPOSE_VERSION=1.23.2 -GOSS_VERSION=0.3.7 -HADOLINT_VERSION=1.17.1 +COMMANDER_VERSION=2.0.0 +DOCKER_COMPOSE_VERSION=1.25.5 +GOSS_VERSION=0.3.11 +HADOLINT_VERSION=1.17.6 REG_VERSION=0.16.1 -TRIVY_VERSION=0.1.1 +SHELLCHECK_VERSION=0.7.1 +TRIVY_VERSION=0.6.0 progname=$(basename "$0") tempdir=$(mktemp -d "/tmp/$progname.XXXXXX") @@ -78,5 +79,15 @@ if ! command -v npm > /dev/null; then fi if ! command -v eclint > /dev/null; then - npm install -g eclint + npm install eclint -g fi + +if ! command -v shellcheck > /dev/null; then + wget "https://github.com/koalaman/shellcheck/releases/download/v$SHELLCHECK_VERSION/shellcheck-v$SHELLCHECK_VERSION.linux.x86_64.tar.xz" + tar -xf shellcheck-v*.linux.x86_64.tar.xz + sudo mv shellcheck-v*/shellcheck /usr/local/bin/ +fi + +if ! command -v jq > /dev/null; then + sudo apt install -y jq +fi \ No newline at end of file diff --git a/.editorconfig b/.editorconfig index d213f4f..968a4d7 100644 --- a/.editorconfig +++ b/.editorconfig @@ -33,3 +33,6 @@ indent_style = space [LICENSE] indent_style = space + +[Vagrantfile] +indent_style = space diff --git a/.gitignore b/.gitignore index cf92909..2ba672c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ build.tags calendar/kopano-calendar-*/ *.pem apt_auth.conf +.vagrant diff --git a/README.md b/README.md index 97fd56f..e26c5b2 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ The compose file itself is part of the git repository and should not be edited d This project uses the `COMPOSE_FILE` environment variable to allow users to override the ports exposed by each container (for example when using a different front facing proxy). When using a `docker-compose.override.yml` file make sure this is included in this variable in the `.env` file. For example like this: -``` +```bash COMPOSE_FILE=docker-compose.yml:docker-compose.portmapping.yml:docker-compose.override.yml ``` @@ -154,6 +154,24 @@ Yes, that is certainly a possibility. Within the `examples/` directory you can f - Same command but getting volumes from the existing `kopano_server` container: `docker run --rm -it --volumes-from kopano_server -v /root/kopano-backup:/kopano/path zokradonh/kopano_utils kopano-backup -h` - Get a shell in a new container to (for example) run `kopano-migration-pst`: `docker run --rm -it -v /var/run/kopano/:/var/run/kopano -v $(pwd):/kopano/path zokradonh/kopano_utils` (to directly run kopano-migration-pst just append it to the command) +### Try this project without installing Docker locally + +This project includes a configuration file for [Vagrant](https://www.vagrantup.com/) to easily try kopano-docker locally. All that is required is Vagrant itself and Virtualbox. + +Steps to start kopano-docker in Vagrant: + +```bash +# run setup.sh +$ ./setup.sh +# provision virtual machine +$ vagrant up +# alternatively "vagrant up --provider hyperv" when running on Windows +# in case you want to connect into the machine +$ vagrant ssh +``` + +After the machine has started it will be reachable from the local system through the IP `10.16.73.20`, please make sure that your chosen hostname resolves to this IP. The project files are mounted to `/vagrant` in the machine. To interact with the containers just change into this directory first. + ## Third party docker images The example `docker-compose.yml` uses the following components for the MTA (mail delivery, including anti-spam & anti-virus) and openLDAP. Please consult their documentation for further configuration advice. diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..903d445 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,33 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + if !Vagrant.has_plugin?("vagrant-docker-compose") + print " WARN: Missing plugin 'vagrant-docker-compose'.\n" + print " Use 'vagrant plugin install vagrant-docker-compose' to install.\n" + end + + config.vm.box = "hashicorp/bionic64" + + config.vm.provider "virtualbox" do |v| + v.memory = 4096 + v.cpus = 2 + end + + config.vm.network "private_network", ip: "10.16.73.20" + + config.vm.provision :docker + config.vm.provision :docker_compose + + config.vm.provision :shell, :path => "./.ci/setup-tools.sh" + + config.vm.provision "app", + type: "shell", + keep_color: true, + privileged: false, + run: "always", + inline: <<-SCRIPT + cd /vagrant + docker-compose up --detach + SCRIPT +end