mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-08 11:01:35 +00:00
Deploy backend to AWS Elastic Beanstalk (EBS)
- Docker configs for AWS EBS - Script to build artifact containing the Rust binary, configs, wav files, and Docker configs. - Add documentation.
This commit is contained in:
1 parent
2d92776c3a
commit
a04174cfda
10 files changed
+79
-4
No files matched your search
@@ -2,6 +2,8 @@
|
||||
.idea/libraries/Cargo__trumpet_.xml
|
||||
.idea/workspace.xml
|
||||
bower_components/
|
||||
docker/*zip
|
||||
docker/files/
|
||||
node_modules/
|
||||
sounds/
|
||||
target/
|
||||
|
||||
@@ -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
|
||||
--------------------
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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?"
|
||||
|
||||
@@ -2,6 +2,7 @@ These words aren't in the dictionary
|
||||
------------------------------------
|
||||
= (equals symbol)
|
||||
HN
|
||||
anime
|
||||
banjo-tooie
|
||||
batshit
|
||||
charizard
|
||||
|
||||
@@ -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 <bt@brand.io>
|
||||
EXPOSE 8000
|
||||
# Mount files inside container.
|
||||
ADD files/ ./
|
||||
# Go, go, go!
|
||||
CMD ./trumpet -p 8000
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"AWSEBDockerrunVersion": "1",
|
||||
"Ports": [
|
||||
{
|
||||
"ContainerPort": "8080"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
testing bar
|
||||
@@ -0,0 +1 @@
|
||||
testing foo
|
||||
Executable
+23
@@ -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
|
||||
|
||||
Reference in new issue
Block a user