The following instructions provide an overview for setting up a new Amazon AWS EC2 instance. They can be adapted for other Linux distributions. You can run this locally on Ubuntu for testing purposes.
- t2.large (working on making it run on t2.medium)
- 20GB at least; 50GB recommended
- Go to the AWS Management Console and navigate to EC2
- Click "Launch Instance"
- Choose a name for your instance (e.g., "brainstorm-test")
- Select "Ubuntu Server 22.04 LTS" as the AMI
- Choose an instance type (t2.large or larger recommended for Neo4j and Strfry)
- Configure instance details:
- Network: Default VPC
- Subnet: Any availability zone
- Auto-assign Public IP: Enable
- Add storage (at least 20GB, recommended 50GB)
- Configure security group:
- Allow SSH (port 22) from your IP
- Allow HTTP (port 80) from anywhere
- Allow HTTPS (port 443) from anywhere
- Allow custom TCP (port 7474) for Neo4j Browser
- Allow custom TCP (port 7687) for Neo4j Bolt
- Allow custom TCP (port 7778) for Brainstorm Control Panel
- Review and launch
- Select or create a key pair for SSH access
- Launch the instance
- Associate an Elastic IP (optional but recommended) and point your domain to it
ssh -i /path/to/your-key.pem ubuntu@your-ec2-public-dnsYour instance console has a "Connect" button that will provide you with the connection command.
Have the following 3 pieces of information ready:
- Your domain name (e.g., "relay.myCoolDomain.com"). This will be used for:
- relay websocket:
wss://relay.myCoolDomain.com - Strfry information:
https://relay.myCoolDomain.com - Neo4j browser:
http://relay.myCoolDomain.com:7474(note: not https!!) - Brainstorm control panel:
https://relay.myCoolDomain.com/control
- relay websocket:
- Your pubkey, e.g.
e5272de914bd301755c439b88e6959a43c9d2664831f093c51e9c799a16a102f, i.e. the "owner" of the personal Webs of Trust relay. (TODO: give option of entering npub instead) - A Neo4j password. Important! After installation, the first thing you will do is change the Neo4j password in the Neo4j browser (initial login: neo4j / neo4j). Brainstorm will need to know what this is. (TODO: ability to change password in the control panel.)
# Update system packages
sudo apt update
sudo apt upgrade -y
# Install necessary dependencies
sudo apt install -y curl git pv
sudo apt-get install -y bc jq sysstat
# Install JDK for enhanced Neo4j monitoring (heap usage, GC metrics)
# This provides jstat and other Java monitoring tools for system health monitoring
# Neo4j 5.26.3 requires Java 17 or later
sudo apt install -y openjdk-17-jdk-headless
# Install a minimal Node.js/npm to bootstrap our installation
# This will be replaced by the NVM installation
sudo apt install -y nodejs npm# Clone the Brainstorm repository
git clone https://github.com/Pretty-Good-Freedom-Tech/brainstorm.git
cd brainstorm
# Install dependencies and set up NVM for your user (WITHOUT sudo)
npm install
# Run the installation script (WITH sudo; system installation components require root privileges)
# You will need to enter your domain name, owner pubkey, and a Neo4j password
sudo npm run install-brainstormAfter you enter the above-mentioned 3 pieces of information, get some coffee. This takes a while! (About 8 minutes in total for me using an AWS EC2 t2.large instance.)
TROUBLESHOOTING: If you can access neo4j and strfry but you get a 502 error trying to access the Brainbstrom UX, you may need to troubleshoot and/or restart the brainstorm-control-panel service with one or more of the following commands:
sudo systemctl status brainstorm-control-panel
sudo journalctl -u brainstorm-control-panel
sudo systemctl restart brainstorm-control-panelIf you're running locally, at this point, the server should run at http://localhost, http://localhost:7778 or http://localhost:7778/index.html. If desired, you can generate a self-signed certificate to start brainstorm-control-panel systemd service in HTTPS and access via https://localhost.
First, generate the certificate.
# Create a directory for your certificates
mkdir -p ~/.ssl
# Go to the directory
cd ~/.ssl
# Generate a private key and certificate
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout localhost.key -out localhost.crtNext, run the development server:
# Run the development server
npm run devNow go to https://localhost, https://localhost:7778 or https://localhost:7778/index.html. NIP-07 ought to work now.
- Access the strfry relay at
https://your-domain - Access the Neo4j Browser at
http://your-domain:7474(note: not https!!)- Default credentials:
neo4j/neo4j - Change password after first login to the password that you entered during installation
- Default credentials:
- Access the Brainstorm landing page at:
https://your-domainorhttps://your-domain/index.html
If these steps don't work for you, see Troubleshooting
Upon installation, three systemd services should be running:
-
Neo4j:
sudo systemctl status neo4j
-
Strfry:
sudo systemctl status strfry
Verify events are being input (only do this after loading up strfry with some events using the control panel):
sudo strfry scan --count '{"kinds":[3, 1984, 10000]}' -
Brainstorm Control Panel:
sudo systemctl status brainstorm-control-panel
After successful installation:
-
Populate databases: Populate Databases
-
Calculate owner scores: Calculate Owner Scores
-
Calculate customer scores: Calculate Customer Scores
Documentation in progress.
If you encounter any issues:
-
Check the logs:
sudo journalctl -u neo4j sudo journalctl -u strfry sudo journalctl -u brainstorm-control-panel
-
Verify the configuration files:
sudo cat /etc/brainstorm.conf sudo cat /etc/graperank.conf sudo cat /etc/blacklist.conf sudo cat /etc/whitelist.conf sudo cat /etc/strfry.conf sudo cat /etc/neo4j/neo4j.conf sudo cat /etc/neo4j/apoc.conf
-
Check for any error messages in the installation output
Note that the NEO4J_PASSWORD variable in /etc/brainstorm.conf is set during setup. If you change your neo4j password afterwards, you'll need to manually update this file.
There are some additional troubleshooting ideas in Troubleshooting
To update Brainstorm, see the update instructions.