هذا الالتزام موجود في:
2025-09-11 09:58:10 +03:00
التزام 6b544cb36e
4 ملفات معدلة مع 640 إضافات و0 حذوفات

ثنائية
__pycache__/doc_rag_app.cpython-313.pyc Normal file

ملف ثنائي غير معروض.

69
chatbot.html Normal file
عرض الملف

@@ -0,0 +1,69 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ghaymah Chatbot</title>
<style>
body { font-family: Arial, sans-serif; margin: 20px; background: #f4f4f9; }
#chatbox { border: 1px solid #ccc; border-radius: 8px; padding: 10px; height: 400px; overflow-y: auto; background: #fff; }
.message { margin: 5px 0; padding: 8px 12px; border-radius: 12px; max-width: 70%; }
.user { background: #d1e7ff; align-self: flex-end; margin-left: auto; }
.bot { background: #e9ecef; align-self: flex-start; }
.error { background: #ffe0e0; color: #b30000; }
#inputArea { display: flex; margin-top: 10px; }
input { flex: 1; padding: 8px; border-radius: 6px; border: 1px solid #ccc; }
button { margin-left: 5px; padding: 8px 15px; border: none; border-radius: 6px; background: #007bff; color: white; cursor: pointer; }
button:hover { background: #0056b3; }
</style>
</head>
<body>
<h2>🤖 Ghaymah Cloud Chatbot</h2>
<div id="chatbox"></div>
<div id="inputArea">
<input type="text" id="userInput" placeholder="Ask about Ghaymah Cloud...">
<button onclick="sendMessage()">Send</button>
</div>
<script>
async function sendMessage() {
const input = document.getElementById("userInput");
const chatbox = document.getElementById("chatbox");
const query = input.value.trim();
if (!query) return;
// Show user message
chatbox.innerHTML += `<div class="message user">${query}</div>`;
input.value = "";
chatbox.scrollTop = chatbox.scrollHeight;
try {
const response = await fetch("http://127.0.0.1:8000/query/", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ query, k: 5 })
});
const data = await response.json();
let botMessage = "";
if (response.ok && data.answer) {
botMessage = data.answer;
} else if (data.error && data.error.includes("quota")) {
botMessage = "⚠️ Your Ghaymah Cloud quota has been exceeded. Please upgrade your plan or wait until it resets.";
} else if (data.error) {
botMessage = "❌ Error: " + data.error;
} else {
botMessage = "🤔 Sorry, I couldn't understand that.";
}
chatbox.innerHTML += `<div class="message bot">${botMessage}</div>`;
chatbox.scrollTop = chatbox.scrollHeight;
} catch (err) {
chatbox.innerHTML += `<div class="message bot error">🚨 Connection error: Unable to reach backend. Is FastAPI running?</div>`;
chatbox.scrollTop = chatbox.scrollHeight;
}
}
</script>
</body>
</html>

257
doc_rag_app.py Normal file
عرض الملف

@@ -0,0 +1,257 @@
# doc_rag_app.py
import os
import json
import uvicorn
import requests
from dotenv import load_dotenv
from typing import Optional
from openai import OpenAI
from fastapi import FastAPI, HTTPException
from fastapi.responses import JSONResponse
from fastapi.middleware.cors import CORSMiddleware
from pydantic import BaseModel
from langchain.text_splitter import RecursiveCharacterTextSplitter
from langchain_community.embeddings import HuggingFaceEmbeddings
# Load .env
load_dotenv()
# -----------------------
# Configuration
# -----------------------
GITPASHA_HOST = os.getenv(
"GITPASHA_HOST",
"https://app1-f06df021060b.hosted.ghaymah.systems"
) # remote GitPasha endpoint you provided
OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") # used only for final LLM summarization if needed
DOC_FILE = os.getenv("DOC_FILE", "full_ghaymah_docs.txt")
# -----------------------
# FastAPI + client
# -----------------------
app = FastAPI(title="Ghaymah Docs RAG API (Restarted)", version="1.0")
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # or ["http://127.0.0.1:5500"] if serving HTML with Live Server
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
# optional remote LLM client (only required if you want final answer generation)
client = None
if OPENAI_API_KEY:
client = OpenAI(api_key=OPENAI_API_KEY, base_url="https://genai.ghaymah.systems")
# -----------------------
# Embedding model (512 dims)
# -----------------------
print("Initializing local embedding model (sentence-transformers/distiluse-base-multilingual-cased)...")
embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/distiluse-base-multilingual-cased")
print("Embedding model loaded.")
# -----------------------
# Request Models
# -----------------------
class QueryRequest(BaseModel):
query: str
k: Optional[int] = 10 # allow overriding k
class IngestRequest(BaseModel):
# keep for future if want dynamic file name content ingestion
filename: Optional[str] = None
# -----------------------
# Helpers
# -----------------------
def _embed_texts(texts):
"""Return list of embeddings for given texts."""
return embeddings.embed_documents(texts)
def _embed_query(text):
"""Return single embedding for query (list)."""
return embeddings.embed_query(text)
def store_text_chunks_remote(text: str) -> bool:
"""Split text, embed chunks, and insert to remote GitPasha."""
if not text:
print("No text provided to store.")
return False
# Split
splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
chunks = splitter.split_text(text)
print(f"[store] Split into {len(chunks)} chunks.")
# Create embeddings
try:
chunk_vectors = _embed_texts(chunks)
except Exception as e:
print(f"[store] Embedding creation error: {e}")
raise HTTPException(status_code=500, detail=f"Failed to create embeddings: {e}")
# Log embedding dimension sanity check
if chunk_vectors and isinstance(chunk_vectors[0], list):
print(f"[store] Embedding vector dimension: {len(chunk_vectors[0])}")
else:
print(f"[store] Unexpected embedding format. First vector: {type(chunk_vectors[0])}")
payloads = [{"text_chunk": chunk} for chunk in chunks]
# Send to GitPasha
try:
resp = requests.post(
f"{GITPASHA_HOST.rstrip('/')}/insert",
json={"vectors": chunk_vectors, "payloads": payloads},
headers={"Content-Type": "application/json"},
timeout=60
)
resp.raise_for_status()
print(f"[store] Remote insert status: {resp.status_code}")
return True
except requests.exceptions.RequestException as e:
print(f"[store] Error calling remote insert: {e} / Response: {getattr(e, 'response', None)}")
raise HTTPException(status_code=500, detail=f"Failed to insert to remote vector store: {e}")
def search_remote_by_vector(vector, k=10):
"""Call remote /search with given vector and return parsed JSON (raw)."""
try:
resp = requests.post(
f"{GITPASHA_HOST.rstrip('/')}/search",
json={"vector": vector, "k": k},
headers={"Content-Type": "application/json"},
timeout=30
)
resp.raise_for_status()
return resp.json()
except requests.exceptions.RequestException as e:
print(f"[search] Error calling remote search: {e}")
raise HTTPException(status_code=500, detail=f"Remote search failed: {e}")
def build_context_from_search_results(search_results, min_score: Optional[float] = None):
"""Given remote search results, optionally filter by min_score and return context text and metadata."""
if not search_results or "results" not in search_results:
return "", []
items = []
for r in search_results["results"]:
score = r.get("score", None)
payload = r.get("payload", {})
text_chunk = payload.get("text_chunk", "")
if min_score is None or (score is not None and score >= min_score):
items.append({"score": score, "text": text_chunk})
context = "\n\n".join([it["text"] for it in items])
return context, items
# -----------------------
# Startup: optionally auto-ingest file on startup
# -----------------------
@app.on_event("startup")
def startup_ingest():
"""On startup, attempt to ingest DOC_FILE automatically (non-fatal)."""
print(f"[startup] Attempting to ingest '{DOC_FILE}' on startup (if present).")
if not os.path.exists(DOC_FILE):
print(f"[startup] File '{DOC_FILE}' not found; skipping automatic ingestion.")
return
try:
with open(DOC_FILE, "r", encoding="utf-8") as f:
text = f.read()
ok = store_text_chunks_remote(text)
if ok:
print(f"[startup] Ingested '{DOC_FILE}' successfully.")
except Exception as e:
# do not prevent server from starting
print(f"[startup] Ingest error (non-fatal): {e}")
# -----------------------
# Endpoints
# -----------------------
@app.post("/ingest-docs/")
async def ingest_docs(req: IngestRequest = None):
"""Read full_ghaymah_docs.txt and store it remotely. Returns success message."""
filename = DOC_FILE
try:
with open(filename, "r", encoding="utf-8") as f:
text = f.read()
except FileNotFoundError:
raise HTTPException(status_code=404, detail=f"{filename} not found in working folder.")
ok = store_text_chunks_remote(text)
if ok:
return JSONResponse(content={"message": f"Successfully ingested '{filename}' into vector store."})
raise HTTPException(status_code=500, detail="Ingestion failed.")
@app.post("/query/")
async def query_docs(request: QueryRequest):
query = request.query
k = request.k or 10
print(f"[query] Received query: {query} (k={k})")
# Embed query
qvec = _embed_query(query)
# Remote vector search
search_results = search_remote_by_vector(qvec, k=k)
payloads = [p["text_chunk"] for p in search_results.get("payloads", [])]
if not payloads:
return {"answer": "No relevant chunks found.", "search_results": search_results}
# Deduplicate chunks (keep first occurrence)
seen = set()
context_chunks = []
for chunk in payloads:
if chunk not in seen:
context_chunks.append(chunk)
seen.add(chunk)
context = "\n\n".join(context_chunks)
# Use LLM if available
if client:
try:
completion = client.chat.completions.create(
model="DeepSeek-V3-0324",
messages=[
{"role": "system", "content": "You are a helpful assistant for Ghaymah Cloud. Answer the question using the context provided."},
{"role": "user", "content": f"Context:\n{context}\n\nQuestion: {query}"}
],
temperature=0.0,
)
answer = completion.choices[0].message.content
return {"answer": answer, "context": context_chunks, "scores": search_results.get("scores", [])}
except Exception as e:
print(f"[query] LLM failed: {e}")
return {"answer": context, "context": context_chunks, "scores": search_results.get("scores", [])}
else:
return {"answer": context, "context": context_chunks, "scores": search_results.get("scores", [])}
@app.post("/debug-search/")
async def debug_search(request: QueryRequest):
"""
Debug endpoint: returns raw search response from remote vector store for the provided query.
Use this to inspect exact 'results' and scores returned remotely.
"""
query = request.query
k = request.k or 10
print(f"[debug-search] Query: {query} (k={k})")
try:
qvec = _embed_query(query)
print(f"[debug-search] Query embedding length: {len(qvec)}")
except Exception as e:
raise HTTPException(status_code=500, detail=f"Embedding failed: {e}")
raw = search_remote_by_vector(qvec, k=k)
return JSONResponse(content={"search_response": raw})
@app.get("/")
def read_root():
return {"message": "Ghaymah Docs RAG API. Use /docs for interactive UI."}
# -----------------------
# Run
# -----------------------
if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8000)

314
full_ghaymah_docs.txt Normal file
عرض الملف

@@ -0,0 +1,314 @@
--- Page: https://docs.ghaymah.cloud/#/./README ---
بسم الله الرحمن الرحيم
Welcome to Ghaymah Cloud
Ghaymah Cloud empowers developers to build, deploy, and scale applications with ease. We provide a streamlined platform that handles the complexities of infrastructure, allowing you to focus on writing great code.
Who Should Use Ghaymah Cloud?
Ghaymah Cloud is ideal for developers and teams who:
Prioritize speed & simplicity: Deploy applications quickly and easily without wrestling with infrastructure.
Demand reliability & security: Benefit from a secure and dependable environment for your applications.
Embrace automation: Automate your deployments and streamline your workflows for maximum efficiency.
Utilize modern tools: Seamlessly integrate with existing Git workflows and Docker-based development.
Key Features
Ghaymah Cloud provides everything you need to get your applications live and running smoothly:
Project Management: Organize and manage your applications with intuitive Projects.
CI/CD Integration: Deploy directly from your favorite Git repositories (GitLab, GitHub) and container registries (Docker Hub).
Configuration Made Easy: Configure your applications with environment variables and connect custom domains.
Real-time Monitoring: Track the health and performance of your deployments with insightful monitoring tools.
Troubleshooting & Support: Quickly diagnose and resolve issues with comprehensive logs and helpful documentation.
What Youll Find in This Documentation
This documentation is your comprehensive guide to Ghaymah Cloud. Youll learn how to:
Create and manage Projects.
Deploy applications from GitLab, GitHub, and Docker Hub.
Configure your applications with environment variables and custom domains.
Monitor your deployments and troubleshoot issues.
Getting Started
This documentation will guide you through every step of using Ghaymah Cloud. Here are some key areas to explore:
Creating a Project: Learn how to set up your first Project and get ready to deploy.
Deploying from Git: Discover how to automatically deploy your applications from GitLab and GitHub.
Configuring Your Application: Manage environment variables, set up custom domains, and customize your applications configuration.
Monitoring and Troubleshooting: Understand how to monitor your deployments, access logs, and find solutions to common issues.
Were excited to help you build amazing things with Ghaymah Cloud!
--- Page: https://docs.ghaymah.cloud/#/./projects ---
Creating a Project
A Project in Ghaymah Cloud serves as the foundational organizational unit for your applications. Its a logical grouping of services that work together, allowing you to manage deployments, configurations, and access control in a structured manner. This guide provides a step-by-step walkthrough of creating a new Project within Ghaymah Cloud.
Overview
Creating a Project is the very first step in deploying your application to Ghaymah Cloud. A Project doesnt contain your code directly; instead, it defines the environment and settings where your application will run. You can think of it like creating a new folder on your computer to organize files it helps keep everything neat and manageable.
Prerequisites
Ghaymah Cloud Account: You must have a valid Ghaymah Cloud account and be logged in.
Step-by-Step Instructions
Navigate to the Projects Dashboard: From the Ghaymah Cloud main dashboard, click on the Projects option in the sidebar navigation menu. This will take you to the Projects overview page.
Initiate Project Creation: Click the Create Project button, typically located in the upper-right corner of the Projects dashboard.
Enter Project Name: A modal window will appear prompting you to enter a name for your new Project.
Project Name Field: Enter a descriptive name for your project. This name should clearly indicate the purpose or type of application youll be deploying.
Naming Conventions: While there are no strict rules, we recommend using lowercase letters, numbers, and hyphens (-) for project names. Avoid spaces and special characters. Example: my-web-app, api-backend, staging-environment.
Confirm Project Creation: After entering a Project Name, click the Create button within the modal window.
Project Created Confirmation: Ghaymah Cloud will process your request and create the new Project. You will be redirected to the Project Overview page for your newly created project. A success message will be displayed.
Whats Next?
Once your Project is created, you can begin deploying your applications using one of the supported deployment methods:
Deploy from GitLab: Deploying from GitLab (Using Integration)
Deploy from Docker Hub: Deploying from Docker Hub (Using Integration)
Deploy from Public GitHub: Deploying from Public GitHub
Troubleshooting
Problem Possible Solution
Project name is invalid Ensure the Project Name follows the recommended naming conventions (lowercase, numbers, hyphens). Avoid spaces and special characters.
Project creation fails Check your internet connection. If the issue persists, contact Ghaymah Cloud support.
Project not listed on the Projects Dashboard Refresh the page. If the project still doesnt appear, contact Ghaymah Cloud support.
--- Page: https://docs.ghaymah.cloud/#/./integrations ---
Integrations
Ghaymah Cloud significantly simplifies application deployment and management by integrating directly with popular developer platforms like GitLab and Docker Hub. These integrations streamline workflows, automate tasks, and enhance security. This page provides comprehensive information on configuring and utilizing these integrations.
Overview
Ghaymah Clouds integrations eliminate the need for manual credential management and repetitive configuration tasks. By connecting your existing accounts, you unlock:
Automated Access: Ghaymah Cloud can securely access your repositories and images, enabling automatic builds and deployments.
Simplified Deployment: The integration presents a streamlined interface for selecting and deploying your applications.
Enhanced Security: We utilize industry-standard OAuth 2.0 protocols and secure credential management practices.
Increased Efficiency: Automate your deployment pipeline and reduce manual errors.
GitLab Integration
The GitLab integration allows Ghaymah Cloud to access your GitLab repositories, enabling automated builds and deployments directly from your source code.
Connecting to GitLab
Navigate to the Integrations Page: In the Ghaymah Cloud dashboard, click on Integrations in the sidebar.
Select GitLab: Click the GitLab icon to begin the integration process.
Authorize Ghaymah Cloud: Youll be redirected to GitLabs authorization page.
Grant Permissions: Review the requested permissions (read access to your repositories) and click Authorize. Ghaymah Cloud only requests the necessary permissions to access your repositories and does not store your GitLab credentials directly.
Redirection: Upon successful authorization, you will be automatically redirected back to Ghaymah Cloud, and the GitLab integration will be activated.
Managing GitLab Access
After connecting your GitLab account, you can manage the integration within the Ghaymah Cloud Integrations page. You can:
View Connected Accounts: See a list of all connected GitLab accounts.
Revoke Access: Click the “Disconnect” or “Revoke Access” button to remove Ghaymah Clouds access to your GitLab account.
Add Additional Accounts: Connect multiple GitLab accounts if needed.
Troubleshooting GitLab Integration
Problem Possible Solution
Authorization fails Verify your GitLab account has the necessary permissions to authorize third-party applications. Ensure you have a valid GitLab account and are not experiencing any login issues.
Repositories not appearing after integration Refresh the Integrations page. If the repositories still dont appear, double-check that Ghaymah Cloud has the appropriate access permissions in your GitLab account settings.
“Unauthorized” error during deployment This indicates that the integration has been revoked or that your GitLab account no longer has permission to access the repository. Reconnect the integration.
Docker Hub Integration
The Docker Hub integration allows Ghaymah Cloud to access your Docker Hub repositories, simplifying deployments using pre-built container images. You have several options for providing your Docker Hub credentials.
Connecting to Docker Hub
Navigate to the Integrations Page: In the Ghaymah Cloud dashboard, click on Integrations in the sidebar.
Select Docker Hub: Click the Docker Hub icon to begin the integration process.
Choose Authentication Method: Select your preferred authentication method:
Username/Password: Enter your Docker Hub username and password. This is the most common method.
Email/Password: Enter your Docker Hub registered email address and password.
Email/Token: Enter your Docker Hub registered email address and an API token. (Recommended for enhanced security.)
Enter Credentials: Fill in the required fields based on your chosen authentication method.
Authorize Ghaymah Cloud: Click the Connect or Authorize button.
Redirection: Upon successful authentication, you will be automatically redirected back to Ghaymah Cloud, activating the Docker Hub integration.
Generating a Docker Hub API Token (Recommended)
For enhanced security, we recommend using an API token instead of your password. Heres how to generate a token:
Log in to your Docker Hub account at https://hub.docker.com/.
Go to Settings > Security.
Click New Access Token.
Give your token a descriptive name (e.g., “Ghaymah Cloud Access”).
Set an expiration date for the token (optional). Its good practice to set an expiration date for security reasons.
Click Create.
Important: Copy the generated token immediately. You will not be able to see it again.
Managing Docker Hub Access
Within the Ghaymah Cloud Integrations page, you can:
View Connected Accounts: See a list of all connected Docker Hub accounts.
Revoke Access: Remove Ghaymah Clouds access to your Docker Hub account.
Update/Change Credentials: If you change your Docker Hub password or API token, you can update the credentials within the Ghaymah Cloud Integrations page.
Troubleshooting Docker Hub Integration
Problem Possible Solution
Authentication fails Double-check that youve entered your credentials correctly. If using an API token, ensure its still valid and hasnt expired.
Repositories not appearing after integration Refresh the Integrations page. Ensure that the connected Docker Hub account has access to the repositories youre trying to deploy.
“Permission Denied” error during deployment Verify that your Docker Hub account has the necessary permissions to access the repositories.
Token not working Ensure you copied the token correctly and it hasnt been revoked on Docker Hub
--- Page: https://docs.ghaymah.cloud/#/./applications ---
Applications
Within Ghaymah Cloud, an Application represents the smallest deployable unit of your software. Understanding this core concept is crucial for effectively utilizing the platform. This page provides a comprehensive overview of Applications, their relationship to containers, and key aspects of their lifecycle.
What is an Application in Ghaymah Cloud?
In Ghaymah Cloud, an Application isnt simply a codebase or a set of files. Its a fully encapsulated, runnable instance of your software packaged within a Docker container. Think of it as a lightweight, self-contained execution environment that includes everything your application needs to run code, runtime, system tools, system libraries, and settings.
Why Containers?
Weve chosen containers as the fundamental building block of Ghaymah Cloud for several key reasons:
Portability: Containers ensure your application runs consistently across different environments (development, testing, production) without compatibility issues. “Build once, run anywhere.”
Isolation: Containers isolate your application from the underlying infrastructure and other applications, preventing conflicts and enhancing security.
Scalability: Containers are lightweight and start quickly, making it easy to scale your application up or down to meet demand.
Efficiency: Containers share the host operating system kernel, making them more efficient than traditional virtual machines.
The Application Lifecycle
An Application in Ghaymah Cloud typically goes through the following lifecycle stages:
Build: Ghaymah Cloud builds a Docker image based on your applications code (from a Git repository) or uses an existing image from Docker Hub. This process is automated through our CI/CD pipeline.
Deployment: Ghaymah Cloud deploys the built image to our container runtime environment, creating a running instance of your Application.
Scaling: You can easily scale your Application by increasing the number of container instances.
Monitoring: Monitor the health and performance of your Application through our comprehensive logging and monitoring tools.
Updates & Rollbacks: Deploy new versions of your application by building and deploying a new image. Easily rollback to previous versions if needed.
Key Characteristics of a Ghaymah Cloud Application
Containerized: Every Application runs within a Docker container.
Isolated: Applications run in isolated environments, preventing interference with other applications.
Stateless: we recommend designing your Applications to be stateless for optimal scalability and resilience. Store persistent data in external services (e.g., databases, object storage).
Single Process (Best Practice): Each container (and therefore Application) should ideally run a single primary process. This simplifies management and improves resource utilization.
How Applications Relate to Projects
Projects as Organizers: Projects in Ghaymah Cloud are higher-level organizational units. They group related Applications together.
One-to-Many Relationship: A single Project can contain multiple Applications. For example, a Project might contain a frontend Application, a backend API Application, and a database Application.
Private Networking: Applications within the same Project can communicate with each other securely over a private network.
Resources
Understanding Docker Containers (Official Docker Documentation)
CI/CD Pipeline Explained (More details on Ghaymah Clouds build process)
Configuration & Settings (Learn how to configure your applications.)
--- Page: https://docs.ghaymah.cloud/#/./application_configs ---
Application Configuration
Ghaymah Cloud allows you to configure several key aspects of your Applications, including their name, listening port, public accessibility, and environment variables. These settings control how your application behaves and interacts with the outside world.
Configuration Options
Application Name
Description: A unique, user-defined name for your application within Ghaymah Cloud. This name is used for identification in the dashboard, logs, and other management interfaces.
Requirements:
Must be unique within the Project.
Can contain alphanumeric characters, hyphens (-), and underscores (_).
Maximum length: 63 characters.
Best Practices: Choose a descriptive name that clearly indicates the purpose of the application.
Port Number
Description: The port number on which your application listens for incoming connections. This port must match the port specified in your applications code and the EXPOSE instruction in your Dockerfile.
Requirements:
Must be a valid port number (1-65535).
Common ports: 80 (HTTP), 443 (HTTPS), 3000 (Node.js), 8080 (Java).
Best Practices: Use standard ports for common applications to simplify configuration.
Troubleshooting: If your application isnt accessible, double-check that the Port Number matches the port your application is listening on within the container.
Public Access
Description: A toggle that controls whether your application is accessible from the public internet.
Options:
Enabled: Your application will be accessible via a publicly assigned hostname provided by Ghaymah Cloud.
Disabled: Your application will only be accessible from within the Ghaymah Cloud network. This is useful for internal services or applications that dont require public access.
Auto-Generated Domain: When “Public Access” is enabled, Ghaymah Cloud will automatically generate a unique subdomain for your application under the hosted.ghaymah.systems domain (e.g., my-app.hosted.ghaymah.systems).
SSL/TLS Certificates: Ghaymah Cloud automatically provisions and manages SSL/TLS certificates for applications with public access, ensuring secure HTTPS connections. You do not need to manually configure certificates.
Security Considerations: Carefully consider whether your application needs to be publicly accessible. If not, disable public access to enhance security.
Environment Variables
Description: Key-value pairs that provide configuration data to your application at runtime. Environment variables are a best practice for managing sensitive information (e.g., API keys, database passwords) and customizing application behavior without modifying the code.
How to Add Environment Variables:
In the Application Configuration section, click the “Add Environment Variable” button.
Enter a Key (the name of the environment variable) and a Value (the value of the environment variable).
Best Practices:
Store sensitive information (passwords, API keys) as environment variables.
Use environment variables to configure application behavior for different environments (development, staging, production).
Follow a consistent naming convention for environment variables.
Accessing Environment Variables in Your Application
The way you access environment variables within your application depends on the programming language and framework you are using. Here are some examples:
Node.js: process.env.VARIABLE_NAME
Python: os.environ.get('VARIABLE_NAME')
Java: System.getenv("VARIABLE_NAME")
Updating Application Configuration
You can update the configuration settings for your application at any time. Ghaymah Cloud will automatically apply the changes, typically requiring a restart of the application container.
--- Page: https://docs.ghaymah.cloud/#/./custom_domains ---
Custom Domains
Ghaymah Cloud allows you to use your own custom domain name for your applications, providing a branded and professional experience for your users.
Overview
By default, Ghaymah Cloud assigns a unique subdomain to your applications. However, you can configure your application to respond to requests made to your own custom domain name (e.g., www.yourdomain.com).
Prerequisites
Registered Domain Name: You must own or have control over a registered domain name.
DNS Access: You must have access to the DNS settings for your domain name.
Configuration Steps
Add Custom Domain: In the Application Configuration section, click the “Add Custom Domain” button.
Enter Domain Name: Enter the custom domain name you want to use (e.g., www.yourdomain.com).
Configure DNS Records: Ghaymah Cloud will provide you with the necessary DNS information to configure your domain. You must add an A record to your domains DNS settings, pointing to one of Ghaymah Clouds IP addresses.
Retrieve IP Address: You can find the required IP address(es) within the Application Dashboard for your application. This information is located in a dedicated section titled DNS Configuration.
Record Type Name Value
A @ or www [Ghaymah Cloud IP Address - Retrieved from Application Dashboard]
Verify DNS Propagation: After adding the DNS records, allow time for them to propagate across the internet. This can take up to 48 hours, although it typically happens much faster.
Activate Domain: Once DNS propagation is complete, return to the Application Configuration section in Ghaymah Cloud and click the “Verify and Activate” button. Ghaymah Cloud will verify that the DNS records are correctly configured and activate your custom domain.
SSL/TLS Certificates
Ghaymah Cloud automatically provisions and manages SSL/TLS certificates for your custom domains, ensuring secure HTTPS connections. You dont need to manually configure certificates.
Troubleshooting
Problem Possible Solution
Custom domain isnt working Verify that the A record is configured correctly and points to the correct Ghaymah Cloud IP address as displayed in your Application Dashboard. Ensure that DNS propagation is complete.
SSL certificate errors Ensure that your custom domain is correctly configured and that Ghaymah Cloud has successfully provisioned the SSL/TLS certificate.
Domain not verifying Double check for typos in your domain name and the A record settings. Verify the IP address is up to date in the Application Dashboard.
--- Page: https://docs.ghaymah.cloud/#/./deploy ---
Deployment
This section details the process of deploying your applications to Ghaymah Cloud. Ghaymah Cloud offers flexible deployment options to accommodate various development workflows and source code repositories.
Overview
Deploying an application to Ghaymah Cloud involves packaging your code into a container image (using Docker), uploading the image to our platform, and configuring the application settings. Ghaymah Cloud automates much of this process through its CI/CD pipeline, simplifying the deployment experience.
Important Limitation: Persistent Storage
Currently, Ghaymah Cloud does not support the deployment of applications that require Persistent Volume Claims (PVCs) or persistent storage solutions. This includes databases (e.g., PostgreSQL, MySQL, MongoDB) and other stateful applications that rely on storing data on persistent volumes. We are actively working on adding support for persistent storage in future releases. Applications requiring persistent storage should be deployed on platforms that offer PVC support.
Deployment Methods
Ghaymah Cloud supports the following deployment methods:
Git-Based Deployment: Deploy applications directly from your Git repositories. This method automatically builds a container image from your code whenever changes are pushed to the repository.
Deploying from GitLab (Using Integration)
Deploying from Public GitHub
Docker-Based Deployment: Deploy pre-built container images from Docker Hub. This method is ideal for applications that are already containerized or for leveraging publicly available images.
Deploying from Docker Hub (Using Integration)
Manual Docker Image Deployment (Public Repositories Only)
Choosing the Right Deployment Method
Method Use Cases Requirements Advantages Disadvantages
GitLab (Integrated) Continuous integration/continuous delivery (CI/CD), automated builds, tightly integrated with GitLab workflows. Ghaymah Cloud GitLab integration configured, valid GitLab repository Automated builds, simplified deployments, version control Requires a GitLab account and integration setup.
Public GitHub Simple deployments for open-source projects or quick prototyping. Publicly accessible GitHub repository, Dockerfile in the repository root Easy to get started, no integration required. Limited automation, manual updates required for code changes.
Docker Hub (Integrated) Deploying pre-built container images, leveraging existing Docker images. Ghaymah Cloud Docker Hub integration configured, valid Docker Hub repository Quick deployment, leverage existing container images. Relies on pre-built images; no automated builds from source code.
Manual Docker Image Deployment Deploying pre-built container images without integration. Publicly accessible Docker Hub repository, valid Docker image URL Quick deployment, bypasses integration setup Relies on pre-built images, requires manual image updates.
Deployment Steps (Common to All Methods)
Regardless of the chosen deployment method, the following general steps are involved:
Select a Project: Choose the Project within Ghaymah Cloud where you want to deploy your application.
Initiate Deployment: Click the “Deploy Application” button within your Project.
Choose Deployment Method: Select the appropriate deployment method based on your source code repository and workflow.
Configure Application Settings: Provide the necessary configuration details, such as Application Name, Port Number, Public Access, and Environment Variables.
Review and Deploy: Carefully review your settings and click the “Deploy” button to start the deployment process.
Monitoring Deployment Status
You can monitor the progress of your deployment in the Ghaymah Cloud dashboard. The dashboard provides real-time updates on the status of each stage in the CI/CD pipeline. See Monitoring & Logs for more information.
Troubleshooting
If you encounter issues during deployment, refer to the troubleshooting guide:
Troubleshooting
--- Page: https://docs.ghaymah.cloud/#/./monitoring-logs ---
Accessing Application Logs
Ghaymah Cloud provides access to real-time logs for your deployed applications, enabling you to monitor application behavior, troubleshoot issues, and gain insights into performance.
Overview
Application logs are a vital tool for understanding how your applications are running. Ghaymah Cloud captures and streams logs from your containerized applications in real-time, allowing you to observe events as they happen.
Viewing Real-Time Logs
Navigate to the Application Dashboard: From the Ghaymah Cloud dashboard, select the Project containing the application you want to monitor. Then, click on the application name to access its Application Dashboard.
Access the Logs Tab: Within the Application Dashboard, click on the Logs tab.
Real-Time Log Stream: The Logs tab will display a continuously updating stream of log messages generated by your application.
Log Messages: Each line represents a log message, including a timestamp and the log message itself.
Filtering (Future Enhancement): Currently, there are no filtering options available. We are planning to add filtering capabilities in future releases.
Search (Future Enhancement): Search functionality is planned for a future update.
Understanding Log Messages
The format of log messages will depend on your applications logging configuration. Generally, log messages include:
Timestamp: The date and time the log message was generated.
Log Level: (e.g., INFO, WARNING, ERROR, DEBUG) Indicates the severity of the message.
Message: A descriptive text providing information about the event.
Use Cases for Application Logs
Troubleshooting Errors: Identify and diagnose errors in your application.
Monitoring Performance: Track response times, resource usage, and other performance metrics.
Debugging Issues: Understand the flow of execution and identify the root cause of problems.
Auditing: Monitor application activity for security and compliance purposes.
Future Enhancements
We are actively working on enhancing the logging functionality in Ghaymah Cloud. Planned features include:
Log Filtering: Filter logs based on log level, timestamp, or keywords.
Log Search: Search for specific log messages.
Log Export: Export log data to external logging services or storage.
Log Retention: Store historical log data for analysis.
--- Page: https://docs.ghaymah.cloud/#/./usage-monitoring ---
Usage Monitoring
Ghaymah Cloud tracks resource usage at a minute level for all deployed applications, providing detailed insights into your consumption and helping you optimize costs. This information is accessible through the Usage Dashboard.
Overview
Understanding your applications resource usage is crucial for managing your Ghaymah Cloud costs and ensuring optimal performance. Ghaymah Cloud provides granular usage data, allowing you to see the instance type utilized and how long it was running.
Accessing the Usage Dashboard
Navigate to the Usage Dashboard: From the Ghaymah Cloud main dashboard, click on the Usage option in the sidebar navigation menu. This will take you to the Usage Dashboard.
Understanding the Usage Data
The Usage Dashboard displays a comprehensive overview of your resource consumption:
Current Applications: Displays the usage data for all currently active applications. This includes:
Instance Type: The type of instance running your application (e.g., t1, t2, t3).
Runtime: The duration for which the application has been running.
Terminated Applications: Displays historical usage data for all previously terminated applications. You can see:
Start Time: The date and time the application was deployed and started running.
End Time: The date and time the application was terminated.
Total Usage: Calculated based on the instance type and runtime.
Minute Granularity: Usage data is tracked at a minute level, providing a highly accurate representation of your resource consumption.
Interpreting Usage Data
Cost Optimization: Use usage data to identify applications utilizing higher instance types than necessary and consider optimizing.
Capacity Planning: Analyze historical usage data to estimate future resource requirements and plan for scalability.
Troubleshooting: Identify potential issues related to application runtime.
Billing Implications
Ghaymah Cloud billing is based on the resource usage data tracked in the Usage Dashboard. Understanding your usage patterns is essential for predicting and managing your monthly costs. Refer to our Pricing Page for detailed information about our pricing structure.