Stoxello Ubuntu 24.04 + MySQL 8.0.

🧱 STEP 1: Install & start MySQL (Ubuntu side)

sudo apt update
sudo apt install mysql-server -y

Verify it’s running:

sudo systemctl status mysql

If needed:

sudo systemctl enable mysql
sudo systemctl start mysql

πŸ” STEP 2: Secure MySQL (recommended)

sudo mysql_secure_installation

Use:

  • Password validation: Yes
  • Strength: Medium
  • Remove anonymous users: Yes
  • Disallow root remote login: Yes
  • Remove test DB: Yes
  • Reload privileges: Yes

πŸ§‘β€πŸ’» STEP 3: Log in as MySQL root (Ubuntu socket auth)

sudo mysql

You should see:

mysql>

πŸ—„οΈ STEP 4: Create the Pulse database

CREATE DATABASE pulse
  CHARACTER SET utf8mb4
  COLLATE utf8mb4_unicode_ci;

Verify:

SHOW DATABASES;

πŸ‘€ STEP 5: Create a Pulse DB user (IMPORTANT)

Do not use root for apps.

CREATE USER 'pulse'@'localhost'
IDENTIFIED BY 'StrongPasswordHere';

Grant rights:

GRANT ALL PRIVILEGES ON pulse.* TO 'pulse'@'localhost';
FLUSH PRIVILEGES;

Exit:

EXIT;

πŸ§ͺ STEP 6: Test the Pulse user

mysql -u pulse -p pulse

If you see:

mysql>

βœ… User + DB are working.


🧬 STEP 7: Create the schema (TWO OPTIONS)


βœ… OPTION A (RECOMMENDED): Let EF Core create tables

From your Pulse.Api or Pulse.Data project on Ubuntu:

Install EF tools (once)

dotnet tool install --global dotnet-ef

Ensure path:

export PATH="$PATH:$HOME/.dotnet/tools"

Run migrations

dotnet ef migrations add InitialPulseSchema
dotnet ef database update

πŸ‘‰ EF will now create all Pulse tables in MySQL.


βš™οΈ OPTION B: Manual SQL schema (no EF)

If you’re not ready for EF migrations yet:

mysql -u pulse -p pulse

Paste the schema SQL I gave earlier:

-- nodes
CREATE TABLE nodes ( ... );
-- agent_heartbeats
CREATE TABLE agent_heartbeats ( ... );
-- etc

Exit when done.


πŸ”— STEP 8: Configure Pulse connection string (CRITICAL)

appsettings.json

{
  "ConnectionStrings": {
    "PulseDb": "Server=localhost;Port=3306;Database=pulse;User=pulse;Password=StrongPasswordHere;SslMode=Preferred;"
  }
}

πŸ”„ STEP 9: Verify tables exist

mysql -u pulse -p pulse
SHOW TABLES;

You should see:

nodes
agent_heartbeats
network_interfaces
services
service_status
metrics
alerts
api_keys

🧠 STEP 10: Common Ubuntu/MySQL gotchas (read this)

❌ Can’t connect?

sudo systemctl restart mysql

❌ EF migration fails?

Make sure Pomelo is installed:

dotnet add package Pomelo.EntityFrameworkCore.MySql

❌ Remote agents later?

Edit:

sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf

Set:

bind-address = 0.0.0.0

Then:

sudo systemctl restart mysql sudo ufw allow 3306

πŸ’Ύ Populate tables in the database.

Run:

dotnet pulse.Api --migrate

dotnet pulse.Web --migrate-auth

If Pulse starts without DB errors, you’re done.