Guide: Install CCS on Ubuntu 14.04 LTS
These are the instructions for installing Canopy Cloud Service from
source on a fresh Ubuntu 14.04 LTS machine.
If you need an Ubuntu 14.04 server, you can use an Amazon EC2
instance. See:
Guide: Setup EC2 Instance.
Step 1: Install Dependencies
Canopy requires Cassandra, Oracle Java 1.7, and Go-lang in order to run.
1.1 Install Cassandra:
Using the text editor of your choice, edit
/etc/apt/sources.list.d/cassandra.sources.list
:
sudo vim /etc/apt/sources.list.d/cassandra.sources.list
Add the following line:
deb http://debian.datastax.com/community stable main
Save and exit. Then run:
curl -L http://debian.datastax.com/debian/repo_key | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y cassandra=2.0.7
1.2 Install Oracle Java 1.7:
Run:
sudo apt-get install -y python-software-properties
sudo add-apt-repository ppa:webupd8team/java
Press ENTER when prompted. The run:
sudo apt-get update
sudo apt-get install -y oracle-java7-installer
When prompted, press ENTER. Then select "Yes"
and press ENTER.
1.3 Install Go-lang
sudo apt-get install -y golang git make mercurial
Step 2: Install Canopy Cloud Service
Clone the repository:
git clone https://github.com/canopy-project/canopy-cloud
Build the project:
cd canopy-cloud
make
You should see this output:
make -C src/canopy go_get_deps
make[1]: Entering directory `/home/ubuntu/canopy-cloud/src/canopy'
mkdir -p ~/.canopy/golang
GOPATH=$(cd ~/.canopy/golang; pwd):$(cd ../../; pwd) go get code.google.com/p/go.net/websocket
GOPATH=$(cd ~/.canopy/golang; pwd):$(cd ../../; pwd) go get github.com/gocql/gocql
GOPATH=$(cd ~/.canopy/golang; pwd):$(cd ../../; pwd) go get github.com/gorilla/sessions
GOPATH=$(cd ~/.canopy/golang; pwd):$(cd ../../; pwd) go get github.com/gorilla/context
GOPATH=$(cd ~/.canopy/golang; pwd):$(cd ../../; pwd) go get github.com/gorilla/mux
GOPATH=$(cd ~/.canopy/golang; pwd):$(cd ../../; pwd) go get github.com/sendgrid/sendgrid-go
GOPATH=$(cd ~/.canopy/golang; pwd):$(cd ../../; pwd) go get code.google.com/p/go.crypto/bcrypt
make[1]: Leaving directory `/home/ubuntu/canopy-cloud/src/canopy'
make -C src/canopy all
make[1]: Entering directory `/home/ubuntu/canopy-cloud/src/canopy'
mkdir -p ~/.canopy/golang
GOPATH=$(cd ~/.canopy/golang; pwd):$(cd ../../; pwd) go build canopy-cloud-service.go canopy_cloud.go canopy_json.go
mkdir -p build/
mv canopy-cloud-service build/
mkdir -p ~/.canopy/golang
GOPATH=$(cd ~/.canopy/golang; pwd):$(cd ../../; pwd) go build canopy_cmd.go
mkdir -p build/
mv canopy_cmd build/canodevtool
make[1]: Leaving directory `/home/ubuntu/canopy-cloud/src/canopy'
Install it:
sudo make install
You should see this output:
src/canopy install
make[1]: Entering directory `/home/ubuntu/canopy-cloud/src/canopy'
cp build/canopy-cloud-service build/canodevtool /usr/local/bin
cp ../../scripts/canopy-cloud-service /etc/init.d
mkdir -p /etc/canopy
cp ../../scripts/ccs-env.sh /etc/canopy
../../scripts/create-canopy-group-user.sh
id: canopy: no such user
Adding group `canopy' (GID 114) ...
Done.
id: canopy: no such user
Adding system user `canopy' (UID 108) ...
Adding new user `canopy' (UID 108) with group `canopy' ...
Not creating home directory `/home/canopy'.
mkdir -p /var/log/canopy
touch /var/log/canopy/ccs.log
touch /var/log/canopy/ccs-errors.log
chown canopy /var/log/canopy
chgrp canopy /var/log/canopy
chown canopy /var/log/canopy/ccs.log
chgrp canopy /var/log/canopy/ccs.log
chown canopy /var/log/canopy/ccs-errors.log
chgrp canopy /var/log/canopy/ccs-errors.log
make[1]: Leaving directory `/home/ubuntu/canopy-cloud/src/canopy'
Start Cassandra running:
sudo cassandra
You should see a bunch of text scroll, ending with:
INFO 17:24:59,576 Completed flushing /var/lib/cassandra/data/system/local/system-local-jb-3-Data.db (114 bytes) for commitlog position ReplayPosition(segmentId=1410197098396, position=91604)
INFO 17:24:59,644 CFS(Keyspace='system', ColumnFamily='local') liveRatio is 27.44988344988345 (just-counted was 3.515151515151515). calculation took 5ms for 257 cells
INFO 17:24:59,644 Enqueuing flush of Memtable-local@414544706(10098/277188 serialized/live bytes, 259 ops)
INFO 17:24:59,645 Writing Memtable-local@414544706(10098/277188 serialized/live bytes, 259 ops)
INFO 17:24:59,677 Completed flushing /var/lib/cassandra/data/system/local/system-local-jb-4-Data.db (5275 bytes) for commitlog position ReplayPosition(segmentId=1410197098396, position=103603)
INFO 17:24:59,693 Compacting [SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-jb-1-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-jb-3-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-jb-4-Data.db'), SSTableReader(path='/var/lib/cassandra/data/system/local/system-local-jb-2-Data.db')]
INFO 17:24:59,780 Node localhost/127.0.0.1 state jump to normal
Press ENTER to return to the command-line.
Create the database:
canodevtool create-db
Don't worry if there are errors. You should see this output:
Error opening file /var/log/canopy/ccs.log: open /var/log/canopy/ccs.log: permission denied
Falling back to STDOUT for logging
WARN 2014/09/08 17:28:24 cass_datalayer.go:340: (IGNORED) line 6:19 mismatched input '(' expecting ')'
Step 3: Configure, Run and Test
One last step before running Canopy Cloud Service. We must configure it.
Edit the file
/etc/canopy/ccs-env.sh
CCS_ALLOW_ORIGIN=http://devel.canopy.link
CCS_HOSTNAME=54.68.36.105
CCS_DEFAULT_PROXY_TARGET=http://74.93.13.249:8080
Change the CCS_HOSTNAME to match the IP address or hostname of your server.
Now, you can start the Canopy Cloud Service
sudo /etc/init.d/canopy-cloud-service start
To check that it is working, go to
http://<ip_address>/me
in your web browser. You
should see the following response:
{"result" : "error", "error_type" : "not_logged_in"}
If you see anything other than that, there was most likely a problem. You
can view the log file by typing:
cat /var/log/canopy/ccs.log