Skip to content

Instantly share code, notes, and snippets.

@a96lex
Last active July 19, 2022 10:25
Show Gist options
  • Save a96lex/2d36a4e7b418f9450bdcc4c29bd375f6 to your computer and use it in GitHub Desktop.
Save a96lex/2d36a4e7b418f9450bdcc4c29bd375f6 to your computer and use it in GitHub Desktop.
How to deploy w3l

Deploy w3l

In order for the w3l infra to work we will need a couple of things

1. S3 buckets

  • soccomm-videos-<stage>-db
  • soccomm-videos-<stage>-input
  • soccomm-videos-<stage>-output (make this one public for reading and no cors)
  • soccomm-videos-<stage>-process
  • w2l-checkpoints (same for any stage)

2. Get a server instance

We now use the g5-impaired template on aws

  • OS is Amazon Linux 2 (based on centos)

Make sure to add inbound rules to expose ports.

On AWS, create or edit the instance security group and add the following inbound rule:

  • Port range: 0 - 65535
  • protocol: TCP
  • Source: 0.0.0.0/0

3. Set up the environment

We need the following environment variables (ask Alex for those you dont have)

AWS_SECRET_ACCESS_KEY
AWS_ACCESS_KEY_ID

AWS_S3_BUCKET_DB
AWS_S3_BUCKET_INPUT
AWS_S3_BUCKET_OUTPUT

ALANA_SUBSCRIPTION_KEY
CHATBOT2GO_SUBSCRIPTION_KEY
VOICEFLOW_SUBSCRIPTION_KEY
OPENAI_SUBSCRIPTION_KEY

APIAUDIO_SUBSCRIPTION_KEY
APIAUDIO_SUBSCRIPTION_KEY_STAGING
AZURE_SUBSCRIPTION_KEY

4. Get the code

Clone both of these repos and their gitmodules. You will need to configure git on the instance or forward your key through ssh when connecting to it.

git clone --recurse-submodules git@github.com:aflorithmic/soccomm_api_container.git

Mount storage on /space

Note: This space directory is ephemeral, which means that it will not preserve state on reboot or shut down.

mkdir space
sudo mkfs.ext4 /dev/nvme1n1
sudo mount /dev/nvme1n1 space
cd space
git clone --recurse-submodules git@github.com:aflorithmic/soccomm-w2l-test.git

5. Set up certificates:

sudo yum install certbot
sudo certbot certonly --standalone --register-unsafely-without-email

If not able to install directly, refer here

The certificate will be under /etc/letsencrypt/live/<domain>/

add permissions

sudo chmod 755 /etc/letsencrypt/*
sudo chmod 644 /etc/letsencrypt/archive/<domain>/privkey1.pem

6. Redirect port 443 to 8000:

sudo iptables -t nat -I PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8000 

7. Run the API

screen
cd soccomm_api_container
sh build.sh
mkdir index demo2 
sh devel.sh
cd soccomm_api
vi run.sh (edit the file and change the certificate paths to point to the correct domain)
sh run.sh

8. run w3l

press ctrl+a then c to create a new screen (you can now switch between them using ctrl+a then n

cd space/soccomm-w2l-test
sh build.sh
mkdir alpha_transitions inputs outputs processed
sh devel.sh
cd devel
sh install-w3l.sh
sh start.sh

9. Deploy the frontends

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment