Commit 9a11ba7d authored by Ola Bini's avatar Ola Bini

Add provisioning support - both Vagrant and Docker. The README provides

more information about how to use it.

Contribution from Fan Jiang, Iván Pazmiño and Ola Bini.
parent 7bac584c
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
FROM ubuntu
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y zip
RUN apt-get install -y wget
RUN apt-get install -y xvfb
RUN apt-get install -y thunderbird
RUN apt-get install -y gnupg2
RUN apt-get install -y make
RUN apt-get install -y python
RUN apt-get install -y gcc
RUN apt-get install -y psmisc
RUN apt-get install -y language-pack-en-base
RUN apt-get install -y mime-support
RUN wget -O /tmp/jsunit-0.1.xpi https://www.enigmail.net/jsunit/jsunit-0.1.xpi
RUN rm -rf /usr/lib/thunderbird-addons/extensions/jsunit@enigmail.net
RUN unzip /tmp/jsunit-0.1.xpi -d /usr/lib/thunderbird-addons/extensions/jsunit@enigmail.net
RUN rm -rf '/usr/lib/thunderbird-addons/extensions/{847b3a00-7ab1-11d4-8f02-006008948af5}'
RUN echo "/enigmail-src/build/dist" > '/usr/lib/thunderbird-addons/extensions/{847b3a00-7ab1-11d4-8f02-006008948af5}'
WORKDIR /enigmail-src
ENV LC_CTYPE en_US.UTF-8
ENV LANG en_US.UTF-8
# enigmail-provisioning
Contains provisioning scripts for developing Enigmail, for Vagrant and Docker
If you have problems with permissions on the shared directory, this incantation is useful:
chcon -Rt svirt_sandbox_file_t $DIR
## Should I setup with Docker or Vagrant?
[Docker](https://www.docker.com) is a linux only virtual environment tool, which means it is easier to setup on a linux host. Mac OS X and Windows hosts will require the setup of a linux virtual machine for Docker to work because it is based on [LinuX Containers (LxC)](https://linuxcontainers.org).
Docker’s virtual environments are light weight versions of virtual machines. They aren’t distinct virtual computers with their own processors and hardware emulation. As a result, virtual environments place only a little extra load on the system. On the other hand, Docker’s isolation is not as good as a full virtual machine’s. Docker allows you to quickly create a specific, semi-isolated environment for short lived testing and debugging.
[Vagrant](https://www.vagrantup.com) is a wrapper on top of a full virtual machine. Vagrant is better when you require full isolation, and it is more convenient to use when you already have vagrant tools and you don’t have Docker on your non-linux host machine.
## Quick Setup With Docker
Please follow your [OS specific instructions](https://docs.docker.com/installation/#installation) to install docker on your system.
Once docker is installed...
1. [Create a docker group.](https://docs.docker.com/installation/ubuntulinux/#create-a-docker-group) Creating this group will keep you from having to use sudo each time you call the docker client.
2. Start the docker daemon. Those platform specific instructions should be in the docker docs after the installation steps. If you created the docker user group in step one, this will be the only step that requires `sudo`.
3. `./provisioning/docker-init.sh`
4. `./provisioning/docker-build.sh`
5. `./provisioning/docker-test.sh`
## Quick Setup With Vagrant
Please follow your OS specific instructions to install the following tool dependencies on your system:
* [Vagrant](https://www.vagrantup.com)
* Vagrant compatible virtualization software (i.e. virtualbox, vmware...)
Note: Virtualbox has default support on vagrant so if you use VMWare, AWS, etc. you must first install their respective vagrant plugins.
Once the vagrant tools are installed...
1. `cd provisioning`
2. `vagrant up` - Call vagrant to grab an instance of Ubuntu and provision it
3. `vagrant ssh` - ssh into the Ubuntu machine
4. `cd /enigmail-src` - This will be the same directory as the main project folder.
5. `./build.sh `
6. `./test.sh `
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/trusty64"
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
# `vagrant box outdated`. This is not recommended.
# config.vm.box_check_update = false
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
# accessing "localhost:8080" will access port 80 on the guest machine.
# config.vm.network "forwarded_port", guest: 80, host: 8080
# Create a private network, which allows host-only access to the machine
# using a specific IP.
# config.vm.network "private_network", ip: "192.168.33.10"
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
# config.vm.network "public_network"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "../", "/enigmail-src"
config.ssh.forward_x11 = true
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
#
# config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
# end
#
# View the documentation for the provider you are using for more
# information on available options.
# Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
# such as FTP and Heroku are also available. See the documentation at
# https://docs.vagrantup.com/v2/push/atlas.html for more information.
# config.push.define "atlas" do |push|
# push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
# end
config.vm.provider :virtualbox do |vb|
vb.gui = false
if ARGV[0] == "up"
if ENV["VB_GUI"] == "true" then vb.gui = true
else
puts("[info] VB_GUI environment variable not set so running headless")
end
end
end
# Enable provisioning with a shell script. Additional provisioners such as
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
# documentation for more information about their specific syntax and use.
config.vm.provision "shell", path: "provision-vagrant.sh"
end
#!/usr/bin/env bash
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
if command -v realpath>/dev/null 2>&1; then
CURRENT_FILE=`realpath "$0"`
else
CURRENT_FILE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/$(basename $0)"
fi
PROVISIONING_DIR=`dirname "$CURRENT_FILE"`
ENIGMAIL_ROOT=`dirname "$PROVISIONING_DIR"`
docker run -v $ENIGMAIL_ROOT:/enigmail-src -i -t enigmail-unit ./build.sh
#docker run -v $ENIGMAIL_ROOT:/enigmail-src -i -t enigmail-unit /bin/bash
#!/usr/bin/env bash
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
CURRENT_FILE=`realpath "$0"`
PROVISIONING_DIR=`dirname "$CURRENT_FILE"`
ENIGMAIL_ROOT=`dirname "$PROVISIONING_DIR"`
pushd .
cd $PROVISIONING_DIR
docker build -t enigmail-unit .
popd
#!/usr/bin/env bash
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
if command -v realpath>/dev/null 2>&1; then
CURRENT_FILE=`realpath "$0"`
else
CURRENT_FILE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/$(basename $0)"
fi
PROVISIONING_DIR=`dirname "$CURRENT_FILE"`
ENIGMAIL_ROOT=`dirname "$PROVISIONING_DIR"`
docker run -v $ENIGMAIL_ROOT:/enigmail-src -i -t enigmail-unit ./test.sh "$@"
#!/usr/bin/env bash
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
export DEBIAN_FRONTEND=noninteractive
echo "Provisioning ..."
curl -s "http://git.fedorahosted.org/cgit/mailcap.git/plain/mime.types" > mime.types
sudo cp mime.types /etc/mime.types
sudo apt-get update
sudo apt-get install -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" zip thunderbird xvfb gnupg2
#sudo apt-get upgrade -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
wget -O /tmp/jsunit-0.1.xpi https://www.enigmail.net/jsunit/jsunit-0.1.xpi
sudo unzip /tmp/jsunit-0.1.xpi -d /usr/lib/thunderbird-addons/extensions/jsunit@enigmail.net
sudo /bin/bash -c "echo $TRAVIS_BUILD_DIR/build/dist > /usr/lib/thunderbird-addons/extensions/{847b3a00-7ab1-11d4-8f02-006008948af5}"
#!/usr/bin/env bash
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
echo "Provisioning ..."
apt-get update
apt-get install -y zip thunderbird xvfb gnupg2
apt-get install -y xfce4 virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
apt-get install -y ntp
apt-get upgrade -y
wget -O /tmp/jsunit-0.1.xpi https://www.enigmail.net/jsunit/jsunit-0.1.xpi
rm -rf /usr/lib/thunderbird-addons/extensions/jsunit@enigmail.net
unzip /tmp/jsunit-0.1.xpi -d /usr/lib/thunderbird-addons/extensions/jsunit@enigmail.net
rm -rf '/usr/lib/thunderbird-addons/extensions/{847b3a00-7ab1-11d4-8f02-006008948af5}'
echo "/enigmail-src/build/dist" > '/usr/lib/thunderbird-addons/extensions/{847b3a00-7ab1-11d4-8f02-006008948af5}'
touch '/enigmail-src'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment