Skip to content

Latest commit

 

History

History
82 lines (68 loc) · 3.3 KB

aws.md

File metadata and controls

82 lines (68 loc) · 3.3 KB

Install Databag in AWS

These instructions assume you have the following setup:

  • an AMD64 Ubuntu EC2 instance with incoming ports 443 and 80
  • an EFS instance
  • a domain name pointing the the IP of your EC2 instance
  • security group of EFS must have security group of EC2 as incomping

Step 1: obtain cert

sudo apt-get install certbot
sudo certbot certonly --standalone -d [dns name]

Step 2: install databag dependencies

sudo apt-get -y install ffmpeg curl net-tools jq netcat unzip wget git vim fail2ban imagemagick-6.q16 build-essential sqlite3 openssh-client npm
sudo apt-get -y upgrade
sudo npm install --global yarn
sudo npm install -g n
sudo n stable

Step 3: download and install golang

wget https://go.dev/dl/go1.19.3.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.19.3.linux-amd64.tar.gz

Step 4: clone and build the server

sudo mkdir /app
cd /app
sudo git clone https://github.com/balzack/databag.git
cd /app/databag/net/web
sudo yarn config set network-timeout 300000
sudo yarn --cwd /app/databag/net/web install
sudo yarn --cwd /app/databag/net/web build
cd /app/databag/net/server
sudo /usr/local/go/bin/go build databag

Step 5: setup databag paths

sudo mkdir -p /var/lib/databag
sudo mkdir -p /opt/databag/transform
sudo cp /app/databag/net/container/transform/* /opt/databag/transform/

Step 6: mount EFS to store assets

sudo apt-get update
sudo apt-get -y install git binutils
git clone https://github.com/aws/efs-utils
cd efs-utils
./build-deb.sh
sudo apt-get -y install ./build/amazon-efs-utils*deb
sudo mount -t efs file-system-id /var/lib/databag

Step 7: initialize the internal datbase

sqlite3 /var/lib/databag/databag.db "VACUUM;"
sqlite3 /var/lib/databag/databag.db "CREATE TABLE IF NOT EXISTS 'configs' ('id' integer NOT NULL UNIQUE,'config_id' text NOT NULL,'str_value' text,'num_value' integer,'bool_value' numeric,'bin_value' blob,PRIMARY KEY ('id'));"
sqlite3 /var/lib/databag/databag.db "CREATE UNIQUE INDEX IF NOT EXISTS 'idx_configs_config_id' ON 'configs'('config_id');"

Step 8: launch the server

cd /app/databag/net/server
nohup nice -n -5 /usr/local/go/bin/go run databag -p 443 -s /var/lib/databag -w /app/databag/net/web/build -t /opt/databag/transform -c /etc/letsencrypt/live//fullchain.pem -k /etc/letsencrypt/live//privkey.pem &

Step 9: configure the server

Open your brower to https://[dns name]
Click the 'cog' in the upper right
Set an admin password
Select the 'cog' to bring up the settings modal
- set your hostname as [dns name]
- set the key to RSA 2048
- enable push notifications
- enable images
- disable audio
- disable video

Step 10: create accounts

Still in the admin dashboard
Click the 'add-user' button
Open the link in a new tab
Set a username and password
Setup your profile
Connect with contacts on other federated instances

Step 11: host for your friends and family

Back in the admin dashboard
Click the 'add-user' and send the link to anyone you want to host