Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewscaya/f173b59a7d7ae0bd9140769ba57ab438 to your computer and use it in GitHub Desktop.
Save andrewscaya/f173b59a7d7ae0bd9140769ba57ab438 to your computer and use it in GitHub Desktop.
Installing OpenWhisk on Ubuntu Server 14.04

Installing the OpenWhisk Server

This guide contains instructions on manually setting up Openwhisk and CouchDB on a fresh Ubuntu 14.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 guide.

1. Installation

sudo su -
apt-get update
sudo apt-get install git -y
cd
git clone https://github.com/apache/incubator-openwhisk.git openwhisk
cd openwhisk/
(cd tools/ubuntu-setup && ./all.sh)
add-apt-repository ppa:couchdb/stable -y
apt-get update
apt-get install couchdb -y
service couchdb stop
chown -R couchdb:couchdb /usr/share/couchdb /etc/couchdb /usr/bin/couchdb
chmod -R 0770 /usr/share/couchdb /etc/couchdb /usr/bin/couchdb
service couchdb start
curl -X PUT localhost:5984/_config/admins/ubuntu -d '"wskdbpass"'
curl -X PUT localhost:5984/_config/query_server_config/reduce_limit -d '"false"' -u ubuntu:wskdbpass
sed -i 's/;bind_address = 127.0.0.1/bind_address = 0.0.0.0/' /etc/couchdb/local.ini
sudo service couchdb restart
ifconfig
curl 172.17.0.1:5984

2. Configuration and deployment

cd ansible
export OW_DB=CouchDB
export OW_DB_PROTOCOL=http
export OW_DB_HOST=172.17.0.1
export OW_DB_PORT=5984
export OW_DB_USERNAME=ubuntu
export OW_DB_PASSWORD=wskdbpass
touch db_local.ini
cat >db_local.ini << 'EOF'
[db_creds]
db_provider=CouchDB
db_username=ubuntu
db_password=wskdbpass
db_protocol=http
db_host=172.17.0.1
db_port=5984
EOF
ansible-playbook setup.yml
ansible-playbook prereq.yml
cd ..
./gradlew distDocker
cd ansible
ansible-playbook initdb.yml && ansible-playbook wipe.yml && ansible-playbook apigateway.yml && ansible-playbook openwhisk.yml && ansible-playbook postdeploy.yml
cd
export OPENWHISK_HOME=/root/openwhisk
git clone https://github.com/apache/incubator-openwhisk-cli.git openwhisk-cli
cd openwhisk-cli
./gradlew compile -PnativeCompile
cp build/wsk /bin
cd
wsk property set --apihost 172.17.0.1 --insecure
cd openwhisk/
wsk property set --auth `cat ansible/files/auth.guest`
wsk property get --auth

3. Running OpenWhisk

wsk action invoke /whisk.system/utils/echo -p message hello --result --i
wsk action list -i
wsk action update hello hello.php -i
wsk action invoke hello -r -i
wsk action invoke hello -r -i -p name Andrew

4. Custom runtime (optional)

cd
wsk sdk install docker
#!/bin/bash
sudo su -
apt-get update
sudo apt-get install git -y
cd
git clone https://github.com/apache/incubator-openwhisk.git openwhisk
cd openwhisk/
(cd tools/ubuntu-setup && ./all.sh)
add-apt-repository ppa:couchdb/stable -y
apt-get update
apt-get install couchdb -y
service couchdb stop
chown -R couchdb:couchdb /usr/share/couchdb /etc/couchdb /usr/bin/couchdb
chmod -R 0770 /usr/share/couchdb /etc/couchdb /usr/bin/couchdb
service couchdb start
curl -X PUT localhost:5984/_config/admins/ubuntu -d '"wskdbpass"'
curl -X PUT localhost:5984/_config/query_server_config/reduce_limit -d '"false"' -u ubuntu:wskdbpass
sed -i 's/;bind_address = 127.0.0.1/bind_address = 0.0.0.0/' /etc/couchdb/local.ini
sudo service couchdb restart
ifconfig
curl 172.17.0.1:5984
cd ansible
export OW_DB=CouchDB
export OW_DB_PROTOCOL=http
export OW_DB_HOST=172.17.0.1
export OW_DB_PORT=5984
export OW_DB_USERNAME=ubuntu
export OW_DB_PASSWORD=wskdbpass
touch db_local.ini
cat >db_local.ini << 'EOF'
[db_creds]
db_provider=CouchDB
db_username=ubuntu
db_password=wskdbpass
db_protocol=http
db_host=172.17.0.1
db_port=5984
EOF
ansible-playbook setup.yml
ansible-playbook prereq.yml
cd ..
./gradlew distDocker
cd ansible
ansible-playbook initdb.yml && ansible-playbook wipe.yml && ansible-playbook apigateway.yml && ansible-playbook openwhisk.yml && ansible-playbook postdeploy.yml
cd
export OPENWHISK_HOME=/root/openwhisk
git clone https://github.com/apache/incubator-openwhisk-cli.git openwhisk-cli
cd openwhisk-cli
./gradlew compile -PnativeCompile
cp build/wsk /bin
cd
wsk property set --apihost 172.17.0.1 --insecure
cd openwhisk/
wsk property set --auth `cat ansible/files/auth.guest`
wsk property get --auth
wsk action invoke /whisk.system/utils/echo -p message hello --result --i
wsk action list -i
wsk action update hello hello.php -i
wsk action invoke hello -r -i
wsk action invoke hello -r -i -p name Andrew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment