Deploying Para
Introduction
Para is a self-hosted backend server designed for building web and mobile applications quickly. It provides essential backend services including authentication, database operations, full-text search, and REST APIs out of the box, allowing developers to focus on building their applications rather than infrastructure.
Built with Java and designed for scalability, Para can serve as the complete backend for your applications or integrate alongside existing systems.
Key highlights of Para:
- Multi-Tenant Architecture: Support multiple applications from a single Para instance
- Built-in Authentication: OAuth 2.0, social logins, LDAP, and custom authentication providers
- Flexible Data Storage: Support for multiple databases including MongoDB, Cassandra, and DynamoDB
- Full-Text Search: Integrated Elasticsearch or Lucene for powerful search capabilities
- REST API: Complete RESTful API for all operations
- Caching: Built-in caching with support for Redis and Hazelcast
- Webhooks: Trigger external services on data changes
- Plugins: Extend functionality with the plugin system
- Admin Console: Web-based interface for managing applications and data
- Open Source: Licensed under Apache 2.0
This guide walks through deploying Para on Klutch.sh using Docker, configuring the backend for your applications, and setting up persistent storage.
Why Deploy Para on Klutch.sh
Deploying Para on Klutch.sh provides several advantages for your backend needs:
Simplified Deployment: Klutch.sh automatically detects your Dockerfile and builds Para without complex orchestration. Push to GitHub, and your backend deploys automatically.
Persistent Storage: Attach persistent volumes for your data and search indices. Your data survives container restarts and redeployments.
HTTPS by Default: Klutch.sh provides automatic SSL certificates for secure API access.
Environment Variable Management: Securely store database credentials, API keys, and secrets through Klutch.sh’s environment variable system.
Scalable Resources: Allocate CPU and memory based on your application load and data volume.
Custom Domains: Assign a professional domain to your Para API endpoints.
Prerequisites
Before deploying Para on Klutch.sh, ensure you have:
- A Klutch.sh account
- A GitHub account with a repository for your Para configuration
- Basic familiarity with Docker and containerization concepts
- (Optional) External database service for production deployments
Understanding Para Architecture
Para consists of several components:
Core Server: The main Java application handling API requests and business logic.
Data Access Object (DAO): Abstraction layer for database operations, supporting multiple backends.
Search: Full-text search engine integration with Elasticsearch or embedded Lucene.
Cache: Distributed caching layer for improved performance.
Authentication Module: Handles user authentication and authorization.
Preparing Your Repository
Create a GitHub repository containing your Dockerfile for Para deployment.
Repository Structure
para-deploy/├── Dockerfile└── .dockerignoreCreating the Dockerfile
Create a Dockerfile in the root of your repository:
FROM erudikaltd/para:latest
# Set environment variablesENV PARA_PORT=8080ENV PARA_ENV=production
# Create data directoriesRUN mkdir -p /para/data /para/lucene
# Expose the API portEXPOSE 8080
# Start ParaCMD ["java", "-jar", "/para/para-war.jar"]Advanced Dockerfile with Custom Configuration
For more control, use this extended Dockerfile:
FROM erudikaltd/para:latest
# Set environment variablesENV PARA_PORT=8080ENV PARA_ENV=productionENV PARA_SEARCH=luceneENV PARA_DAO=h2
# Create data directoriesRUN mkdir -p /para/data /para/lucene
# Health checkHEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \ CMD wget --no-verbose --tries=1 --spider http://localhost:8080/v1/_health || exit 1
# Expose the API portEXPOSE 8080
# Start ParaCMD ["java", "-jar", "/para/para-war.jar"]Creating the .dockerignore File
Create a .dockerignore file:
.git.github*.mdLICENSE.gitignore*.log.DS_Store.env.env.localEnvironment Variables Reference
| Variable | Required | Default | Description |
|---|---|---|---|
PARA_SECRET_KEY | Yes | - | Secret key for JWT signing |
PARA_ACCESS_KEY | No | - | Root access key |
PARA_DAO | No | h2 | Database adapter (h2, mongodb, cassandra, dynamodb) |
PARA_SEARCH | No | lucene | Search adapter (lucene, elasticsearch) |
PARA_CACHE | No | caffeine | Cache adapter (caffeine, hazelcast, redis) |
PARA_PORT | No | 8080 | Server port |
PARA_APP_NAME | No | para | Application name |
Deploying Para on Klutch.sh
- Select HTTP as the traffic type
- Set the internal port to 8080
- Detect your Dockerfile automatically
- Build the container image
- Attach the persistent volumes
- Start the Para container
- Provision an HTTPS certificate
Generate Secret Keys
Generate secure keys for your Para deployment:
openssl rand -base64 32Push Your Repository to GitHub
Initialize your repository and push to GitHub with your Dockerfile.
Create a New Project on Klutch.sh
Navigate to the Klutch.sh dashboard and create a new project. Give it a descriptive name like “para” or “backend-server”.
Create a New App
Within your project, create a new app. Connect your GitHub account if you haven’t already, then select the repository containing your Para Dockerfile.
Configure HTTP Traffic
In the deployment settings:
Set Environment Variables
Add the following environment variables:
| Variable | Value |
|---|---|
PARA_SECRET_KEY | Your generated secret key |
PARA_ACCESS_KEY | Your root access key |
PARA_DAO | h2 (or your preferred database) |
PARA_SEARCH | lucene (or elasticsearch) |
Attach Persistent Volumes
Add the following volumes:
| Mount Path | Recommended Size | Purpose |
|---|---|---|
/para/data | 10 GB | Database storage (for H2) |
/para/lucene | 10 GB | Search indices |
Deploy Your Application
Click Deploy to start the build process. Klutch.sh will:
Access Para
Once deployment completes, access your Para API at https://your-app-name.klutch.sh/v1/.
Using Para
Creating Your First App
Para supports multiple applications. Create an app through the API:
curl -X POST "https://your-para-instance/v1/_setup" \ -H "Content-Type: application/json"API Authentication
Para uses JWT tokens for API authentication. Obtain a token:
curl -X POST "https://your-para-instance/v1/_token" \ -H "Content-Type: application/json" \ -d '{"accessKey": "your-access-key", "secretKey": "your-secret-key"}'Creating Objects
Store data in Para using the REST API:
curl -X POST "https://your-para-instance/v1/users" \ -H "Authorization: Bearer your-token" \ -H "Content-Type: application/json" \ -d '{"name": "John Doe", "email": "john@example.com"}'Searching Data
Use Para’s search capabilities:
curl "https://your-para-instance/v1/users?q=John" \ -H "Authorization: Bearer your-token"Admin Console
Para includes a web-based admin console for managing your applications:
- Access the console at
https://your-para-instance/admin/ - Log in with your access and secret keys
- Browse and manage data, users, and settings
Integrating with Applications
Para provides client libraries for various platforms:
- JavaScript:
para-client-js - Java:
para-client - Python:
para-client-python - iOS: Para Swift client
- Android: Para Java client
Additional Resources
- Para Official Website
- Para Documentation
- Para GitHub Repository
- Klutch.sh Persistent Volumes
- Klutch.sh Deployments
Conclusion
Deploying Para on Klutch.sh gives you a powerful, self-hosted backend server with authentication, database, and search capabilities built in. The combination of Para’s feature-rich platform and Klutch.sh’s deployment simplicity means you can focus on building applications rather than managing infrastructure.
With multi-tenant support, flexible storage options, and comprehensive APIs, Para provides the foundation for building web and mobile applications quickly and efficiently.