1
0
mirror of https://github.com/zokradonh/kopano-docker synced 2025-06-06 15:36:40 +00:00

add Vagrantfile for easy local test/dev deployment (#394)

* add Vagrantfile for easy local test/dev deployment
* add exception to editorconfig
* Update README.md
* update ci tools
* add jq to setup ci script
This commit is contained in:
Felix Bartels 2020-05-05 20:08:23 +02:00 committed by GitHub
parent 87de275e9f
commit 05230d1c0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 73 additions and 7 deletions

View File

@ -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

View File

@ -33,3 +33,6 @@ indent_style = space
[LICENSE]
indent_style = space
[Vagrantfile]
indent_style = space

1
.gitignore vendored
View File

@ -11,3 +11,4 @@ build.tags
calendar/kopano-calendar-*/
*.pem
apt_auth.conf
.vagrant

View File

@ -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.

33
Vagrantfile vendored Normal file
View File

@ -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