A Tian Jiu Pai (Tien Gow Pai, 天九牌) game server written in Sesterl, Erlang, and Elm.
The following is a capture video of playing the game:
- make
- Sass
- Erlang/OTP
- Rebar3
- Elm
- APBuf
- Used for generating a JSON encoder/decoder from
model.apbuf
. - Can be installed via OPAM pin:
$ git clone git@github.com:gfngfn/apbuf $ cd apbuf $ opam pin add apbuf .
- Used for generating a JSON encoder/decoder from
- Sesterl
- A statically-typed Erlang.
- Can be installed via OPAM pin.
$ git clone git@github.com:gfngfn/Sesterl $ cd Sesterl $ opam pin add sesterl .
Just invoke make
.
Invoke make test
.
Invoke make run
.
See model.apbuf
for the definition of the formats of request/response bodies.
Client Server
| POST /users |
| <create_user_request> |
|--------------------------------->|
| |
| 201 <create_user_response> |
|<---------------------------------|
| |
| /websocket/users/<user_id> |
|--------------------------------->|
| |
| 100 |
|<---------------------------------|
| |
| GET /rooms |
|--------------------------------->|
| |
| 200 <get_all_rooms_response> |
|<---------------------------------|
Client Server
| |
| PATCH /rooms |
| RoomRequestToEnterRoom(<enter_room_request>) |
|------------------------------------------------->|
| |
| 200 <enter_room_response> |
|<-------------------------------------------------|
Client 1 Server Client 2, 3, and 4
| | | | |
| PATCH /rooms | | | |
| RoomRequestToSubmitCards(<submit_cards_request>) | | | |
|----------------------------------------------------->| | | |
| | NotifySubmission(<submission>) | | |
| |---------------------------------->| | |
| |--------------------------------------->| |
| 200 <submit_cards_response> |-------------------------------------------->|
|<-----------------------------------------------------| | | |
| | | | |
| | CommandAck(<snapshot_id>) | | |
| |<----------------------------------| | |
| | CommandAck(<snapshot_id>) | | |
| CommandAck(<snapshot_id>) |<--------------------------------------------|
|----------------------------------------------------->| | | |
| | CommandAck(<snapshot_id>) | | |
| NotifyNextStep |<---------------------------------------| |
|<-----------------------------------------------------| NotifyNextStep | | |
| |---------------------------------->| | |
| |--------------------------------------->| |
| |-------------------------------------------->|
| | | | |
-
Make branch
temp-deploy
which contains the build targets generated by APBuf, Elm, and Sesterl.- This step shall be removed in the future; the pipeline scripts for building programs written in APBuf, Elm, and Sesterl will be needed.
-
Generate your key pair (the name of which is written as
〈NameOfYourKey〉
hereafter). -
Create an IAM role
CloudWatchAgentServerRole
to whichCloudWatchAgentServerPolicy
is assigned. -
Invoke the following command to deploy on an EC2 instance (this step takes approximately 10 minutes):
$ cd 〈RootOfThisRepository〉 $ aws cloudformation deploy --stack-name "〈NameOfYourStack〉" --template-file aws/cloud-formation.template.yaml --parameter-overrides "KeyName=〈NameOfYourKey〉"
-
Then you can access the instance by using SSH like the following:
$ ssh -i ~/.ssh/〈NameOfYourKey〉.pem ubuntu@〈AssignedIPAddress〉
-
-
Get the IP address
〈AssignedIPAddress〉
assigned to the instance and visit the address by using a browser.
- The cloudFormation template in the following repository has been largely used as a reference: