# 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
## 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
sudo apt-get -y install curl
sudo apt-get -y install net-tools
sudo apt-get -y install jq
sudo apt-get -y install netcat
sudo apt-get -y install unzip
sudo apt-get -y install wget
sudo apt-get -y install git
sudo apt-get -y install vim
sudo apt-get -y install fail2ban
sudo apt-get -y install imagemagick-6.q16
sudo apt-get -y install build-essential
sudo apt-get -y install sqlite3
sudo apt-get -y install openssh-client
apt-get -y install npm
apt-get -y upgrade
npm install --global yarn
npm install -g n
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 mkdir /app
cd /app
git clone https://github.com/balzack/databag.git
cd /app/databag/net/web
yarn config set network-timeout 300000
yarn --cwd /app/databag/net/web install
yarn --cwd /app/databag/net/web build
cd /app/databag/net/server
/usr/local/go/bin/go build databag
## Step 5: setup databag paths mkdir -p /var/lib/databag/assets
mkdir -p /opt/databag/transform
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/assets
## 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');"
sqlite3 /var/lib/databag/databag.db "insert into configs (config_id, str_value) values ('asset_path', '/var/lib/databag/assets');"
sqlite3 /var/lib/databag/databag.db "insert into configs (config_id, str_value) values ('script_path', '/opt/databag/transform/');"
## Step 8: launch the server cd /app/databag/net/server
nohup nice -n -5 /usr/local/go/bin/go run databag [dns name] &
## Step 9: configure the server Open your brower to the pi hostname
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