Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hollsteinm
Last active December 27, 2017 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hollsteinm/bb6b0dc5632d160b4198b947cdb493aa to your computer and use it in GitHub Desktop.
Save hollsteinm/bb6b0dc5632d160b4198b947cdb493aa to your computer and use it in GitHub Desktop.
Automate the creation of a NodeBB instance using S3 for uploads, redis database, and an application load balancer (Simple, insecure PoC)
#!/bin/bash
set -e
echo "Update Services..."
yum -y update
echo "Install Dependencies..."
yum -y install epel-release
yum -y groupinstall "Development Tools"
yum -y install git ImageMagick npm
echo "Install NodeJS..."
curl https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm list-remote
nvm install v6.11.0
echo "Install NodeBB..."
cd /var/opt/
git clone -b v1.5.x https://github.com/NodeBB/NodeBB nodebb
chmod 754 ./nodebb
cd nodebb
npm install --production
npm install nodebb-plugin-s3-uploads-updated --production
npm install -g forever --production
echo "Configure Environment..."
export S3_UPLOADS_BUCKET="{my-bucket-name}"
export S3_UPLOADS_HOST="{my-bucket-host}"
export S3_UPLOADS_PATH="{my-bucket-path}"
echo "Start Server..."
url={my-alb-url} port=80 database=redis redis__password={my-redis-password} redis__database=0 redis__host={my-redis-endpoint} redis__port=6379 node app --setup
./nodebb activate nodebb-plugin-s3-uploads-updated
forever start loader.js
echo "===NodeBB LIVE==="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment