Server Management & Dashboard Setup
Overview
A step-by-step tutorial for connecting to AWS EC2, managing Node.js servers, and setting up Grafana dashboards if you are using NC State’s data service.
Requirements
- Access to NC State University network (either on-campus WiFi or VPN connection)
- The SSH private key file
- The Node.js server code
- Visual Studio Code installed on your computer
Getting Connected to Your EC2 Instance
Step 1: Ensure Network Access
- If you’re on campus: Connect to NC State Wi-Fi
- If you’re remote: Connect to NC State VPN
- This document explains how to connect to the NC State VPN if it is your first time
Step 2: Open VS Code and Set Up SSH Connection

- Launch Visual Studio Code

- Open the Command Palette
- Windows/Linux: Press Ctrl + Shift + P
- Mac: Press Cmd + Shift

- Add New SSH Host
- Type: Remote-SSH: Add New SSH Host…
- Select it from the dropdown

- Enter the SSH Connection Command
- Type:
ssh -i "C:\user\rsa.pem" ubuntu@12.345.678.90 - Press Enter
- Replace the path with your actual key file location
- Type:

- You’re now connected! VS Code is running directly on the EC2 server.
Step 3: Connect and Open Your Project

- Connect to the Server
- Select your newly added SSH from the SSH Targets list
- Choose “Connect to Host in Current Window”
- Open Your Project Folder
Managing Your Node.js Server
Think of your EC2 server as having two main parts:
- Your Node.js application – managed by PM2
- Background services (database, monitoring tools) – managed by Docker
Let’s handle them one at a time.
Managing Background Services with Docker
Starts your database (InfluxDB) and other supporting services
Starting Your Services
- Navigate to the main directory
- cd /home/ubuntu/v1
- Start all services in the background
- docker-compose up -d
Monitoring Your Services
- See status of all services
- docker-compose ps
- Check logs for a specific service (e.g., InfluxDB)
- docker-compose logs influxdb
- Follow logs in real-time
- docker-compose logs -f influxdb
Stopping Services
- Stop all services
- docker-compose down
Managing Your Node.js App with PM2
Runs your actual application code and keeps it running even if it crashes
Initial Setup (One-time only)
- Install the PM2 tool
- npm install -g pm2
Daily Server Operations
- Navigate to your server code
- cd /home/ubuntu/NotorioS/Middleware/Server
- Start your server
- pm2 start server.js –name server2
- Check running processes
- pm2 list
- View server logs
- pm2 logs server2
- Restart server without downtime
- pm2 reload server2
Setting Up Grafana Dashboards
Grafana creates charts and graphs from your data. Instead of building charts from scratch, you can use pre-made templates and modify them.
Step 1: Find a Dashboard
- Visit Grafana Labs Dashboard Library
- Search for dashboards relevant to your data (e.g., “InfluxDB”, “System Monitoring”)
- Click on a dashboard that fits your needs or use the StormPack RTC dashboard
Step 2: Export the Dashboard
- Click the Share icon on the dashboard page
- Select “Export” from the dropdown
- Click “Save JSON” to download the dashboard file
Step 3: Import into Your Grafana
- Access your Grafana instance (usually at
http://your-server:3000) - Click the “+” button in the left sidebar
- Select “Import”
- Upload your JSON file or paste the JSON content
- Click “Load”
Step 4: Customize for Your Data
- Click on any chart panel you want to modify
- Select “Edit”
- Update the InfluxDB query to match your database structure:
- SELECT mean(“your_field”) FROM “your_measurement” WHERE $timeFilter GROUP BY time($__interval)
Getting Help
- For EC2 Issues: Check AWS Console or contact your system administrator
- For Docker Problems: Review logs with docker-compose logs
- For Node.js Errors: Check PM2 logs with pm2 logs server2
- For Grafana Questions: Check the official Grafana Documentation