diff --git a/.gitignore b/.gitignore index 2c261467f8..f2d785db75 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ .idea/libraries/Cargo__trumpet_.xml .idea/workspace.xml bower_components/ +docker/*zip +docker/files/ node_modules/ sounds/ target/ diff --git a/README.md b/README.md index 56f7edffe0..addedf83c0 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,39 @@ Running the server 1. Install Rust >= 1.1.0 2. `cargo run` -### On the Remote Server +### On the Remote Dedicated Server (non-AWS) 1. Install and configure nginx as a reverse HTTP proxy. 2. SCP Rust server app binaries and start on required ports, ie. `trumpet -p PORT`. +### On AWS Infrastructure. + +1. The frontend is hosted on AWS + Cloudfront. +2. The backend is hosted on Elastic Beanstalk (EBS). + +The AWS setup is divided into two buckets: one that houses simply index.html, +which is hosted from `jungle.horse`. The other assets are distributed via +Cloudfront, and are loaded from `cdn.jungle.horse`. There is some CORS header +setup work to do. + +The backend is a docker image containing the compiled Rust binary, config file, +and sound files. It can be built into a zip with the `./ebs-deployable` script. +This is then uploaded via the EBS panel's front page (the "Upload and Deploy" +button). This is hosted from `api.jungle.horse`. + +Docker Notes +------------ +Some notes for local management and testing of Docker images: + +Build docker image from Dockerfile (in same working directory): + + `sudo docker build -t TAGNAME .` + +Run docker image interactively with port forwarding to host machine: + + `sudo docker run -t -p 8000:8000 -i TAGNAME /bin/bash` + Misc Notes on Speech -------------------- diff --git a/TODO.md b/TODO.md index f34aab4302..ba85f61738 100644 --- a/TODO.md +++ b/TODO.md @@ -5,10 +5,10 @@ Last Minute Burndown -------------------- - AWS / Cloudfront Hosting - Backend + - Containerize + - ECS + - Elastic Beanstalk - Frontend - - Bucket - - Cloudfront - - Static HTML gen (remote: asset hash, local: local path) - DNS entries: - api.junglehorse.com -> jungle horse server - junglehorse.com -> AWS diff --git a/dictionary/IMPROVE.md b/dictionary/IMPROVE.md index 16d7a8813f..52b53f334e 100644 --- a/dictionary/IMPROVE.md +++ b/dictionary/IMPROVE.md @@ -4,11 +4,13 @@ These words need improvement "^^ hillary's "^^ obama's "^^^ again (BAD) +"^^^ by "^^^ by (BAD) "^^^ ha, haha, hahaha" "^^^ how (THIS IS SO BAD) "^^^ rigging "^^^ then (BAD) +"^^^ wall" "do you?" "for you" "really?" diff --git a/dictionary/NEEDED.md b/dictionary/NEEDED.md index 5a8a8b4be6..ff8af71cae 100644 --- a/dictionary/NEEDED.md +++ b/dictionary/NEEDED.md @@ -2,6 +2,7 @@ These words aren't in the dictionary ------------------------------------ = (equals symbol) HN +anime banjo-tooie batshit charizard diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000000..f42cd4fa7d --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,10 @@ +# See `ebs-deployable.sh` in the root directory to create the AWS +# EBS-deployable zip file that contains all of the artifact files. +FROM ubuntu:14.04 +MAINTAINER bt +EXPOSE 8000 +# Mount files inside container. +ADD files/ ./ +# Go, go, go! +CMD ./trumpet -p 8000 + diff --git a/docker/Dockerrun.aws.json b/docker/Dockerrun.aws.json new file mode 100644 index 0000000000..eb8d0a23e5 --- /dev/null +++ b/docker/Dockerrun.aws.json @@ -0,0 +1,8 @@ +{ + "AWSEBDockerrunVersion": "1", + "Ports": [ + { + "ContainerPort": "8080" + } + ] +} diff --git a/docker/bar.html b/docker/bar.html new file mode 100644 index 0000000000..3b9ea3ff24 --- /dev/null +++ b/docker/bar.html @@ -0,0 +1 @@ +testing bar diff --git a/docker/foo.html b/docker/foo.html new file mode 100644 index 0000000000..9a79b47ee3 --- /dev/null +++ b/docker/foo.html @@ -0,0 +1 @@ +testing foo diff --git a/ebs-deployable.sh b/ebs-deployable.sh new file mode 100755 index 0000000000..eccfcd488a --- /dev/null +++ b/ebs-deployable.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# This creates a Dockerfile in the AWS EBS format that is ready for deployment. +# Dockerfile, Dockerrun.aws.json, and packaged artifact files. +# In this case, the Rust server is packaged with the other dependencies. + +set -ex +declare -r artifact_dir_name="files/" +declare -r artifact_dir="./docker/${artifact_dir_name}" + +# Copy binary, sound samples, and configs (only if updated). +# No need to copy web files as these are hosted on AWS/EC2 instead. +mkdir -p $artifact_dir +rsync -utrv ./target/release/trumpet $artifact_dir +rsync -utrv ~/Dropbox/jungle.horse/sounds $artifact_dir +rsync -utrv {dictionary,config.toml} $artifact_dir + +declare -r artifact_zip="./docker_image.zip" + +pushd docker +zip -r $artifact_zip Dockerfile Dockerrun.aws.json +zip -r $artifact_zip $artifact_dir_name +popd +