Deploy Your First App

Learn how to deploy a simple single-container application to Flux in under 30 minutes

What You'll Learn

    Deploy a single-container application
    Understand Flux deployment specifications
    Monitor deployment status
    Access your deployed application

Before You Start

  • ✓ Docker installed and running
  • ✓ Docker Hub account created
  • ✓ Zelcore wallet with FLUX tokens (~calculating... FLUX for this tutorial)
  • ✓ Basic understanding of Docker
1

Create a Simple Application

Let's start with a simple Node.js web application. Create a new directory and add these files:

package.jsonjson
{
  "name": "hello-flux",
  "version": "1.0.0",
  "main": "server.js",
  "scripts": {
    "start": "node server.js"
  },
  "dependencies": {
    "express": "^4.18.0"
  }
}
server.jsjavascript
const express = require('express');
const app = express();
const PORT = process.env.PORT || 3000;

app.get('/', (req, res) => {
  res.send('<h1>Hello from Flux!</h1><p>This app is running on Flux decentralized cloud.</p>');
});

app.get('/health', (req, res) => {
  res.json({ status: 'healthy', timestamp: new Date().toISOString() });
});

app.listen(PORT, '0.0.0.0', () => {
  console.log(`Server running on port ${PORT}`);
});
Dockerfiledockerfile
FROM node:20-alpine

WORKDIR /app

COPY package*.json ./
RUN npm install --production

COPY server.js ./

EXPOSE 3000

CMD ["npm", "start"]
2

Build and Push Docker Image

Build your Docker image and push it to Docker Hub. Replace yourusername with your Docker Hub username:

Build the image
docker build -t yourusername/hello-flux:latest .
Login to Docker Hub
docker login
Push the image
docker push yourusername/hello-flux:latest

Pro Tip

Make sure your image is public on Docker Hub so Flux nodes can pull it.

3

Create Deployment Specification

Create a flux-spec.json file with your deployment configuration:

flux-spec.jsonjson
{
  "version": 8,
  "name": "helloflux",
  "description": "My first Flux deployment",
  "owner": "YOUR_ZELID_HERE",
  "instances": 3,
  "staticip": false,
  "enterprise": "",
  "compose": [
    {
      "name": "hello",
      "description": "Simple Node.js web server",
      "repotag": "yourusername/hello-flux:latest",
      "ports": [3000],
      "containerPorts": [3000],
      "domains": [""],
      "environmentParameters": [
        "NODE_ENV=production",
        "PORT=3000"
      ],
      "commands": [],
      "containerData": "/appdata",
      "cpu": 1.0,
      "ram": 2000,
      "hdd": 5,
      "tiered": false
    }
  ]
}

Understanding the Spec (Version 8)

  • version: Spec version (use 8 for latest features)
  • name: App name (alphanumeric only, no hyphens or spaces)
  • instances: Number of redundant copies (minimum 3)
  • staticip: Require static IP nodes (costs extra $2/month)
  • enterprise: Enable enterprise features ("enabled" or "")
  • ports: Array of external ports (valid range: 0-65535)
  • containerPorts: Array of ports your app listens on (valid range: 0-65535)
  • domains: Array of custom domains (leave empty for Flux default)
  • containerData: Persistent data volume path
  • cpu: Number of CPU cores (1.0 = 1 core)
  • ram: Memory in MB (2000 = 2GB)
  • hdd: Disk space in GB
4

Deploy to Flux

Now it's time to deploy! Go to the Flux web interface:

  1. 1
  2. 2

    Login with Zelcore wallet

  3. 3

    Navigate to "Applications""Management""Register New App"

  4. 4

    Fill in the form using values from your flux-spec.json

  5. 5

    Review the estimated cost (should be ~calculating... FLUX/month)

  6. 6

    Click "Deploy App" and approve the transaction in Zelcore

5

Monitor Your Deployment

After deploying, monitor your application's status:

Deployment Stages

  • Pending: Waiting for nodes to accept deployment
  • Starting: Nodes are pulling your Docker image
  • Running: App is live and accessible!

This typically takes 5-10 minutes. You'll receive a URL like:

https://hello-flux-abc123.app.runonflux.io
6

Access Your Application

Once your app is running, you can access it through the Flux-provided URL. Test these endpoints:

Test the home page
curl https://your-app-url.app.runonflux.io
Test the health endpoint
curl https://your-app-url.app.runonflux.io/health

Congratulations!

You've successfully deployed your first application to Flux's decentralized cloud network!