The moss-communication-server
is a simple server application that provides API routes for Stable Diffusion tasks and includes health check endpoints. It uses middleware for API key verification and handles text-to-image and image-to-image transformations.
This server provides authenticated routes for performing image transformation tasks using Stable Diffusion. It includes endpoints for generating images from text and modifying images based on existing ones. The server also has a health check route to ensure it's running correctly.
-
Clone the Repository
git clone https://github.com/your-repo/moss-communication-server.git cd moss-communication-server
-
Install Dependencies
Ensure you have Go installed and run:
go mod tidy
-
Set Up Environment Variables
Create a
.env
file in the root directory and fill it with your configuration details. An example.env
file is provided below.
Create a .env
file in the root directory of the project with the following variables:
# Server config
PORT=8080
ENV=development
# DB config
databaseHost=localhost
databasePort=5432
databaseName=mydatabase
databaseUsername=myuser
databasePassword=mypassword
# Hashing config
hashSalt=your_hash_salt
passwordSecret=your_password_secret
# Demo config
demoAPIKey=your_demo_api_key
runpodAPIKey=your_runpod_api_key
Replace the placeholder values with your actual configuration settings.
-
Start the Server
With the environment variables set, you can start the server with:
go run main.go
The server will start and listen on the port specified in the
.env
file. -
Verify API Key Middleware
Ensure that the API key used for authentication matches the
demoAPIKey
provided in the.env
file.
-
Create a Runpods.io Account
Sign up or log in to your account at Runpods.io.
-
Create a New Pod
- Go to your dashboard and click on "Create New Pod".
- Choose a suitable runtime environment (e.g., Node.js, Python) depending on your application's requirements.
- Set up the environment to match the configuration of your server.
-
Upload Your Code
- Upload the project files or connect a Git repository.
- Ensure that the
.env
file is included or properly configured in the environment settings.
-
Configure Environment Variables
- In the Runpods.io settings, configure the environment variables according to the
.env
file.
- In the Runpods.io settings, configure the environment variables according to the
-
Deploy and Run
- Start the pod and ensure it is running correctly.
- Check the logs and health checks to verify that the server is functioning as expected.
-
Access Your Server
- Obtain the URL provided by Runpods.io and use it to interact with your server's endpoints.
This project is licensed under the MIT License. See the LICENSE file for more details.