This project builds a software infrastructure for a new Function-as-a-Service (FaaS) platform called Func, and on top of Func we build the infrastructure for a social network platform we’ll call Warble. Func is intended to provide a very basic FaaS platform like AWS Lambda or Google Cloud Functions, and Warble is intended to have the same basic functionality of Twitter.
Install virtual environment.
Visit https://www.vagrantup.com/downloads.html to download and install vagrant(>= 2.2.6)
After adding vagrant box. This command will start and login to the virtual machine.
$ vagrant up && vagrant ssh
$ cd /vagrant
$ git clone https://github.com/HAOYU-LI/csci499_haoyuli.git
$ cd csci499_haoyuli
$ mkdir third_party
$ cd third_party
$ wget https://cmake.org/files/v3.17/cmake-3.17.0-rc1.tar.gz
$ tar cmake-3.17.0-rc1.tar.gz
$ cd cmake-3.17.0-rc1
$ ./configure --prefix=/usr/local
$ [sudo] make
$ [sudo] make install
$ cd ..
$ cd csci499_haoyuli/third_party
$ [sudo] apt-get update
$ [sudo] apt-get install build-essential autoconf libtool pkg-config libc-ares-dev automake golang
Before building, you need to clone the gRPC github repository and download submodules containing source code
for gRPC's dependencies (that's done by the submodule
command or --recursive
flag). The following commands will clone the gRPC
repository at the latest stable version.
$ [sudo] git clone -b $(curl -L https://grpc.io/release) https://github.com/grpc/grpc
$ cd grpc
$ [sudo] git submodule update --init
In grpc repo
$ mkdir -p cmake/build
$ cd cmake/build
$ [sudo] cmake ../..
$ [sudo] make
$ cd ..
$ cd csci499_haoyuli/third_party
$ [sudo] git clone https://github.com/google/glog.git
$ cd glog
$ [sudo] ./autogen.sh
$ [sudo] ./configure
$ [sudo] cmake .
$ [sudo] make
$ [sudo] make install
$ cd ..
$ cd csci499_haoyuli/third_party
$ [sudo] git clone https://github.com/google/googletest.git
cd googletest
$ [sudo] cmake .
$ [sudo] make
$ [sudo] make install
$ cd ..
$ cd csci499_haoyuli/third_party
$ [sudo] git clone https://github.com/gflags/gflags.git
$ [sudo] cmake .
$ [sudo] make
$ [sudo] make install
$ cd ../..
$ cd key_value_store
$ cmake .
$ make
$ ./key_value_service
Persistent storage mode can be activated by setting store flag. Once activated, key value server will load commands from log file and execute sequentially. Users' input will also be saved into designated log file.
$ ./key_value_service --store "[LOG_FILE]"
Create another terminal window. Run following commands.
$ cd warble
$ cmake .
$ make
$ cd ..
$ cd func
$ cmake .
$ make
$ ./func_service_impl
$ cd command-line-tool
$ cmake .
$ make
Go to command-line-tool repo
$ cd command-line-tool
$ ./warble --registeruser "user1" # Register a user called user1.
$ ./warble --registeruser "user2" # Register a user called user2.
$ ./warble --user "user1" --warble "hello from user1" # A warble is posted by user1
$ ./warble --user "user2" --warble "hello from user2" --reply "<ID_OF_WARBLE_TO_REPLY>" # Reply to a warble
$ ./warble --user "user1" --read "<ID_OF_WARBLE_TO_READ>" # Read a warble thread that ends at warble id.
$ ./warble --user "user1" --follow "user2" # User1 starts to follow user2
$ ./warble --user "user1" --profile # Show following and followers of user1.
$ cd key_value_store
$ ./unittest_key_value_data_structure
$ cd warble
$ ./unittest_warble_service