Skip to content

Instantly share code, notes, and snippets.

@epiphone
Created January 24, 2017 13:24
Show Gist options
  • Save epiphone/8fe223bbfc375d01f12822e405f6aa54 to your computer and use it in GitHub Desktop.
Save epiphone/8fe223bbfc375d01f12822e405f6aa54 to your computer and use it in GitHub Desktop.
Installing OpenWhisk on Ubuntu Server 16.04

Configuring the OpenWhisk server

This guide contains instructions on manually setting up Openwhisk and CouchDB on a fresh Ubuntu 16.04 server.

The guide is based on the OpenWhisk Ansible README, which at the time of writing is missing some key steps and gotchas - hence this new guide.

1. Dependencies

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git python-pip python-setuptools build-essential libssl-dev libffi-dev python-dev software-properties-common
sudo pip install ansible==2.1.2.0

Install Docker:

sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
sudo apt-get install docker-engine -y

You can check whether Docker is running via sudo service docker status. Also, importantly, make sure to enable the remote API.

2. CouchDB

We're using a self-hosted CouchDB here, but you can choose to skip this step and use an ephemeral CouchDB or Cloudant instead.

sudo add-apt-repository ppa:couchdb/stable -y
sudo apt-get update
sudo apt-get install couchdb -y

Secure the database and add an admin user:

sudo service couchdb stop
sudo chown -R couchdb:couchdb /usr/share/couchdb /etc/couchdb /usr/bin/couchdb
sudo chmod -R 0770 /usr/share/couchdb /etc/couchdb /usr/bin/couchdb
sudo service couchdb start
curl -X PUT localhost:5984/_config/admins/USERNAME -d '"PASSWORD"'

Set the reduce_limit property to false (as per OpenWhisk instructions):

curl -X PUT localhost:5984/_config/query_server_config/reduce_limit -d '"false"' -u USERNAME:PASSWORD

Also set bind_address=0.0.0.0 in /etc/couchdb/local.ini and restart via sudo service couchdb restart to access CouchDB from Docker containers: running curl <your CouchDB IP>:5984 should now output CouchDB info.

3. OpenWhisk

Important! Run the following Ansible commands with the root user (e.g. via sudo su -), since using another username seems to mess up the database table names!

git clone https://github.com/openwhisk/openwhisk.git
cd openwhisk
(cd tools/ubuntu-setup && ./all.sh)

Configure our database parameters:

cd ansible
export OW_DB=CouchDB
export OW_DB_PROTOCOL=http
export OW_DB_HOST=<the IP of your CouchDB server (should be accessible from Docker containers)>
export OW_DB_PORT=5984
export OW_DB_USERNAME=USERNAME
export OW_DB_PASSWORD=PASSWORD

ansible-playbook setup.yml

Now db_local.ini should contain the correct DB settings. Let's continue with building OpenWhisk (it'll take a while):

ansible-playbook prereq.yml
cd ~/openwhisk
./gradlew distDocker

And deploying it:

cd ansible
ansible-playbook initdb.yml
ansible-playbook wipe.yml
ansible-playbook apigateway.yml
ansible-playbook openwhisk.yml
ansible-playbook postdeploy.yml
@anishvarghese
Copy link

Please update the repository before install docker-engine
otherwise you get an error like this
The following packages have unmet dependencies:
docker-engine : Depends: libsystemd-journal0 (>= 201) but it is not installable
Recommends: aufs-tools but it is not going to be installed
Recommends: cgroupfs-mount but it is not going to be installed or
cgroup-lite but it is not going to be installed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment