Deploy Your First App
Learn how to deploy a simple single-container application to Flux in under 30 minutes
What You'll Learn
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
Create a Simple Application
Let's start with a simple Node.js web application. Create a new directory and add these files:
{
"name": "hello-flux",
"version": "1.0.0",
"main": "server.js",
"scripts": {
"start": "node server.js"
},
"dependencies": {
"express": "^4.18.0"
}
}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}`);
});FROM node:20-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install --production
COPY server.js ./
EXPOSE 3000
CMD ["npm", "start"]Build and Push Docker Image
Build your Docker image and push it to Docker Hub. Replace yourusername with your Docker Hub username:
docker build -t yourusername/hello-flux:latest .docker logindocker push yourusername/hello-flux:latestPro Tip
Make sure your image is public on Docker Hub so Flux nodes can pull it.
Create Deployment Specification
Create a flux-spec.json file with your deployment configuration:
{
"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
Deploy to Flux
Now it's time to deploy! Go to the Flux web interface:
- 1
Navigate to https://home.runonflux.io
- 2
Login with Zelcore wallet
- 3
Navigate to "Applications" → "Management" → "Register New App"
- 4
Fill in the form using values from your
flux-spec.json - 5
Review the estimated cost (should be ~calculating... FLUX/month)
- 6
Click "Deploy App" and approve the transaction in Zelcore
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:
Access Your Application
Once your app is running, you can access it through the Flux-provided URL. Test these endpoints:
curl https://your-app-url.app.runonflux.iocurl https://your-app-url.app.runonflux.io/healthCongratulations!
You've successfully deployed your first application to Flux's decentralized cloud network!