This page documents how to install necessary dependencies to work with the wire-server code base.
This repository makes use of git submodules. When cloning or updating, use git submodule update --init --recursive
to check out the code dependencies.
Note: all the below sections for getting compile-time dependencies necessary to compile all of wire-server may potentially go out of date; if you spot a mistake please open an issue or PR
Using Stack's Nix integration, Stack will take care of installing any system
dependencies automatically - including cryptobox-c
. If new system dependencies are needed, add them to the stack-deps.nix
file in the project root.
If you have direnv
and nix
, you will automatically have make
, docker-compose
and stack
in PATH
once you cd
into the project root and direnv allow
.
You can then run all the builds, and the native dependencies will be automatically present.
-
Install Nix
- MacOS users with a recent Mac might need to follow these instructions
- Debian users can use their distro's
nix
package, and should remember
to add their user to the
nix-users
group in /etc/group, and re-start their login session. -
Install Direnv.
- On debian, you can install the
direnv
package. On MacOS usebrew install direnv
. - On NixOS with home-manager, you can set
programs.direnv.enable = true;
. - Make sure direnv is hooked into your shell via it's appripriate
rc
file. Addeval "$(direnv hook bash|zsh|fish)"
to your ~/.(bash|zsh|fish)rc . - When successfully installed and hooked, direnv should ask you to
direnv allow
the current.envrc
when you cd to this repository. See the Installation documentation for further details.
- On debian, you can install the
sudo dnf install -y pkgconfig haskell-platform libstdc++-devel libstdc++-static gcc-c++ libtool automake openssl-devel libsodium-devel ncurses-compat-libs libicu-devel GeoIP-devel libxml2-devel snappy-devel protobuf-compiler
Note: Debian is not recommended due to this issue when running local integration tests: #327. This issue does not occur with Ubuntu.
sudo apt install pkg-config libsodium-dev openssl-dev libtool automake build-essential libicu-dev libsnappy-dev libgeoip-dev protobuf-compiler libxml2-dev zlib1g-dev libtinfo-dev liblzma-dev libpcre3 libpcre3-dev -y
If openssl-dev
does not work for you, try libssl-dev
.
# You might also need 'sudo pacman -S base-devel' if you haven't
# installed the base-devel group already.
sudo pacman -S geoip snappy icu openssl ncurses-compat-libs
brew install pkg-config libsodium openssl automake icu4c geoip snappy protobuf
Note: macOS users will need to make sure to link Haskell services against a more recent version of OpenSSL than what ships with the OS by default. Additionally, icu4c
is installed in a non-standard location by homebrew
. Add the following to your .stack/config.yaml
:
extra-include-dirs:
- /usr/local/opt/openssl/include
- /usr/local/opt/icu4c/include
extra-lib-dirs:
- /usr/local/opt/openssl/lib
- /usr/local/opt/icu4c/lib
Note: if you're getting fatal error: 'libxml/parser.h' file not found
and you're on macOS Mojave, try doing:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
Please refer to Stack's installation instructions.
When you're done, ensure stack --version
is the same as STACK_VERSION
in build/ubuntu/Dockerfile.prebuilder
.
If you have to, you can downgrade stack with this command:
stack upgrade --binary-version <version>
Note: The packaged versions of haskell-stack
are too old. It is recommended to follow the generic instructions or to use stack to update stack (stack upgrade
).
sudo apt install haskell-stack -y
curl -sSL https://get.haskellstack.org/ | sh
# or
wget -qO- https://get.haskellstack.org/ | sh
sudo apt install rustc cargo -y
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
You need ormolu
on your PATH, get it with stack install ormolu
We use headroom
, get it with stack install headroom
This is a tool to create debian-style binary packages. It is optional, and is only used if you want to install debian-style packages on your debian or ubuntu system.
Note: If you want to build debian-style packages of cryptobox-c and other wire utilities, execute this step. otherwise, make sure to execute the 'Generic' version of the cryptobox-c step.
git clone https://github.com/wireapp/wire-server && cd wire-server/tools/makedeb
export VERSION=0
make dist
dpkg -i ../../dist/makedeb*.deb
git clone https://github.com/wireapp/cryptobox-c && cd cryptobox-c
make dist
dpkg -i target/release/cryptobox*.deb
export TARGET_LIB="$HOME/.wire-dev/lib"
export TARGET_INCLUDE="$HOME/.wire-dev/include"
mkdir -p "$TARGET_LIB"
mkdir -p "$TARGET_INCLUDE"
git clone https://github.com/wireapp/cryptobox-c && cd cryptobox-c
make install
# Add cryptobox-c to ldconfig
sudo bash -c "echo \"${TARGET_LIB}\" > /etc/ld.so.conf.d/cryptobox.conf"
sudo ldconfig
Make sure stack knows where to find it. In ~/.stack/config.yaml
add:
(using ~
or $HOME
doesn't work, needs full paths)
extra-include-dirs:
- /usr/local/include
- <YOUR_HOME_DIR>/.wire-dev/include
extra-lib-dirs:
- /usr/local/lib
- <YOUR_HOME_DIR>/.wire-dev/lib
Note: While it is possible to use non-docker solutions to set up and configure this software, we recommend using docker and our provided docker images to configure dependent services rapidly, and ensure a consistent environment for all potential developers.
sudo apt install docker.io docker-compose
After installing docker-io, add your user to the docker group, and restart your shell (usually involving a restart of your graphical environment).
once you've logged in again, if you would like to upload any docker images (optional):
docker login --username=<MY_DOCKER_USERNAME>
You can instead use telepresence to allow you to talk to services installed in a given kubernetes namespace on a local or remote kubernetes cluster using easy DNS names like: curl http://elasticsearch:9200
.
Requirements:
- install telepresence (e.g.
nix-env -iA nixpkgs.telepresence
) - you need access to a kubernetes cluster
- you need a namespace in which you have installed something (e.g.
make kube-integration-setup
will do this)
# terminal 1
telepresence --namespace "$NAMESPACE" --also-proxy cassandra-ephemeral
# terminal 2
curl http://elasticsearch-ephemeral:9200
# just one terminal
telepresence --namespace "$NAMESPACE" --also-proxy cassandra-ephemeral --run bash -c "curl http://elasticsearch-ephemeral:9200"
- If you have
fake-aws
anddatabases-ephemeral
helm charts set up, you can run eitherbrig
and other services locally (they connect to cassandra-inside-kubernetes) - If you also have
brig
and other haskell services running in kubernetes (e.g. you ranmake kube-integration-setup
, you can use telepresence to only run test executables (likebrig-integration
) locally which connect to services inside kubernetes.
In both cases, you need to adjust the various integration configuration files and names so that this can work.
Buildah is used for local docker image creation during development. See buildah installation
See make buildah-docker
for an entry point here.
You need kubectl
, helm
, helmfile
, and a valid kubernetes context. Refer to https://docs.wire.com for details.