Skip to Content
Quick Start

Quick Start Guide

Get up and running with Asantiya in minutes! This guide will walk you through deploying your first application.

Prerequisites

Before starting, ensure you have:

  • ✅ Asantiya installed (Installation Guide)
  • ✅ Docker running on your system
  • ✅ A simple application or Dockerfile to deploy

Step 1: Create Your Project

Let’s start with a simple web application:

# Create a new project directory mkdir my-first-asantiya-app cd my-first-asantiya-app

Step 2: Create a Simple Application

Option A: Simple HTML Application

Create a basic HTML file:

# Create index.html cat > index.html << 'EOF' <!DOCTYPE html> <html> <head> <title>My Asantiya App</title> <style> body { font-family: Arial, sans-serif; margin: 40px; } .container { max-width: 600px; margin: 0 auto; } h1 { color: #333; } .success { color: #28a745; } </style> </head> <body> <div class="container"> <h1>🚀 Welcome to Asantiya!</h1> <p class="success">Your application is successfully deployed!</p> <p>This is a simple static website served by Nginx.</p> <p><strong>Deployed with:</strong> Asantiya + Docker + Nginx</p> </div> </body> </html> EOF

Option B: Node.js Application

Create a simple Node.js app:

# Create package.json cat > package.json << 'EOF' { "name": "my-asantiya-app", "version": "1.0.0", "description": "A simple Node.js app for Asantiya", "main": "server.js", "scripts": { "start": "node server.js" }, "dependencies": { "express": "^4.18.2" } } EOF # Create server.js cat > server.js << 'EOF' const express = require('express'); const app = express(); const port = process.env.PORT || 3000; app.get('/', (req, res) => { res.send(` <html> <head><title>My Asantiya App</title></head> <body style="font-family: Arial, sans-serif; margin: 40px;"> <h1>🚀 Welcome to Asantiya!</h1> <p style="color: #28a745;">Your Node.js application is successfully deployed!</p> <p>This is a simple Express.js application running in Docker.</p> <p><strong>Deployed with:</strong> Asantiya + Docker + Node.js</p> </body> </html> `); }); app.listen(port, '0.0.0.0', () => { console.log(`Server running on port ${port}`); }); EOF

Step 3: Create a Dockerfile

For HTML Application (Nginx):

cat > Dockerfile << 'EOF' FROM nginx:alpine # Copy HTML files to nginx web directory COPY index.html /usr/share/nginx/html/ # Expose port 80 EXPOSE 80 # Nginx starts automatically EOF

For Node.js Application:

cat > Dockerfile << 'EOF' FROM node:18-alpine # Set working directory WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm install # Copy application code COPY . . # Expose port EXPOSE 3000 # Start the application CMD ["npm", "start"] EOF

Step 4: Initialize Asantiya Configuration

Create the Asantiya configuration file:

# Initialize Asantiya configuration asantiya init

This creates a basic deploy.yaml file. Let’s customize it:

# deploy.yaml service: my-first-app image: my-first-app-image server: 127.0.0.1 app_ports: "8080:80" # For Nginx (HTML app) # app_ports: "8080:3000" # For Node.js app host: false # Builder configuration builder: arch: amd64 local: true build_args: NODE_ENV: production # For Node.js app

Step 5: Deploy Your Application

Now let’s deploy your application:

# Deploy the application asantiya deploy

You should see output similar to:

🚀 Building Docker image... 📦 Image built successfully: my-first-app-image 🐳 Starting container... ✅ Application deployed successfully! 🌐 Access your app at: http://localhost:8080

Step 6: Verify Deployment

Open your browser and navigate to http://localhost:8080 to see your deployed application!

Check container status:

# List running containers docker ps # Check container logs docker logs my-first-app

Step 7: Managing Your Application

Stop the application:

asantiya stop

Start the application:

asantiya start

Restart the application:

asantiya restart

View logs:

asantiya logs

Remove the application:

asantiya remove

Adding a Database (Optional)

Let’s enhance your application with a database using Asantiya accessories:

1. Update your deploy.yaml:

service: my-first-app image: my-first-app-image server: 127.0.0.1 app_ports: "8080:3000" host: false builder: arch: amd64 local: true build_args: NODE_ENV: production # Add PostgreSQL as an accessory accessories: postgres: service: my-first-app-postgres image: postgres:15-alpine ports: "5432:5432" env: POSTGRES_DB: myapp POSTGRES_USER: user POSTGRES_PASSWORD: password volumes: - postgres_data:/var/lib/postgresql/data network: my-app-network options: restart: always

2. Deploy with database:

# Deploy main application and accessories asantiya deploy # Or start accessories separately asantiya accessory up

Next Steps

Congratulations! You’ve successfully deployed your first application with Asantiya. Here’s what you can do next:

1. Explore Configuration Options

2. Deploy to Remote Server

  • Configure SSH access to your server
  • Update the server field in deploy.yaml
  • Deploy to production: asantiya deploy

3. Advanced Features

4. Best Practices

  • Use environment variables for sensitive data
  • Implement health checks in your applications
  • Set up proper logging and monitoring
  • Use version control for your configurations

Common Commands Reference

# Initialize new project asantiya init # Deploy application asantiya deploy # Start accessories asantiya accessory up # Check application status asantiya accessory ls # View logs asantiya accessory logs <name> # Stop application asantiya app stop # Start application asantiya app start # Remove application asantiya app remove # Get help asantiya --help

Ready for more advanced features? Check out the Configuration Reference to learn about all the options available in Asantiya.

Last updated on