Deploying Your First App
Learn how to prepare, initialize, and deploy Docker applications with zero downtime
This guide walks you through preparing a codebase, generating an explita.json configuration, running your first production deployment, and monitoring logs.
1. Preparing Your Dockerfile
Explita Deploy builds your applications using standard Dockerfiles. Here is a production-ready example for a Next.js or Node.js application:
FROM node:22-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:22-alpine AS runner
WORKDIR /app
ENV NODE_ENV=production
COPY --from=builder /app ./
EXPOSE 3000
CMD ["npm", "start"]Tip: Explita automatically inspects the
EXPOSEdirective in your Dockerfile to auto-detect the default container port.
2. Initializing Project Config (eda init)
Run eda init inside your project root:
eda initThe command prompts you for:
- Application Name: Defaults to the name in your
package.jsonor current folder. - Container Port: Defaults to
3000(or the port detected in your Dockerfile). - Custom Domain(s): Optional domain names you wish to bind.
This creates an explita.json file in your repository:
{
"$schema": "https://infra.explita.ng/config/schema.json",
"name": "my-web-app",
"port": 3000,
"healthCheck": {
"path": "/",
"timeout": 15,
"interval": 2,
"retries": 10
},
"preDeploy": "npx prisma migrate deploy",
"domains": ["myapp.com"],
"tunnel": true
}Key Configuration Fields
| Field | Type | Description |
|---|---|---|
name | string | Unique application identifier registered on the server. |
port | number | Port your application listens on inside the container. |
healthCheck.path | string | HTTP endpoint probed by the deploy engine before routing traffic (default /). |
preDeploy | string | Command executed inside a temporary container before traffic swap (e.g. database migrations). |
domains | string[] | Array of production custom domains to attach with automated SSL. |
tunnel | boolean | Automatically provisions a public HTTPS tunnel under *.tunnel.explita.ng. |
volumes | string[] | Persistent host volume bindings (e.g. ["/var/data:/app/uploads"]). |
3. Deploying to the Server
Once explita.json is in place, deploy your code by simply running:
edaIf you are deploying for the first time without an existing explita.json:
eda -n my-web-app -p 3000 -tWhat Happens During Deployment:
- Source Archiving: Local source code (ignoring
.git,node_modules, and patterns in.dockerignore) is packed into a compressed tarball. - Uploading: The archive is streamed securely to the remote Explita Deploy server.
- Docker Build: Docker BuildKit compiles your image with layer caching (
web-app:v1.0.0). - Pre-Deploy Hook: If configured, commands like database migrations (
npx prisma migrate deploy) run in an ephemeral container. - Container Start: The new container starts on the internal
explita-netbridge network on a dynamically allocated port. - Health Check Probing: The control plane repeatedly probes
http://container:<port>/until it returns a2xxor3xxHTTP status code. - Zero-Downtime Traffic Swap: Once healthy, Caddy atomically shifts 100% of incoming domain and tunnel traffic to the new container. The previous container is kept alive for a brief grace period to finish active requests, then cleanly stopped.
4. Monitoring Logs & Live Stream
Build & Deploy Logs
View the build log from the most recent deployment:
eda logsLive Runtime Application Logs
Stream live container stdout/stderr over WebSocket in real time:
eda logs --livePrint the last 100 lines and continue streaming:
eda logs --live --tail 100Resource Utilization (eda stats / eda top)
Inspect CPU, memory, and network I/O in real time:
# Snapshot resource usage
eda stats
# Interactive live terminal dashboard
eda top5. Remote Container Shell & Execution
Need to run a command or inspect files inside the live container? You don't need SSH access to the host VPS:
Interactive Remote Shell (eda sh)
Open an interactive terminal directly inside your running container:
eda sh
# Or explicitly request bash:
eda sh -s bashOne-Off Command Execution (eda exec)
Run non-interactive administrative commands:
eda exec -- npm run db:seed
eda exec -- ls -la /app6. Lifecycle Management
Control the container state on the server:
# Restart the container
eda restart
# Temporarily stop the container
eda stop
# Start a stopped container
eda start
# Adjust resource quotas
eda set --memory 1g --cpus 1.5Now that you know how to deploy applications, learn how to run isolated branch previews with cloned databases!