Update README.md
Browse files
README.md
CHANGED
|
@@ -1,10 +1,39 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: docker
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: My New API Deployment
|
| 3 |
+
emoji: 🚀
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: green
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 3000 # Corresponds to "3000:3000" in your docker-compose.yml for the new-api service's container port
|
| 8 |
+
persistent_storage:
|
| 9 |
+
new_api_data: # This is a name for your persistent storage volume
|
| 10 |
+
mount_path: /data # Mounts the persistent storage to /data inside the container (for ./data:/data)
|
| 11 |
+
new_api_logs: # Persistent storage for logs
|
| 12 |
+
mount_path: /app/logs # Mounts to /app/logs inside the container (for ./logs:/app/logs)
|
| 13 |
---
|
| 14 |
|
| 15 |
+
## New API Deployment on Hugging Face Spaces
|
| 16 |
+
|
| 17 |
+
This Space runs the `new-api` application.
|
| 18 |
+
|
| 19 |
+
**IMPORTANT SETUP REQUIRED:**
|
| 20 |
+
|
| 21 |
+
This application relies on external Redis and MySQL services. You **must** configure these yourself and then set the appropriate connection strings in this Space's "Settings" tab, under "Secrets".
|
| 22 |
+
|
| 23 |
+
1. **Provision External Services:**
|
| 24 |
+
* Create a **Redis** instance (e.g., on Aiven, Upstash, or your preferred cloud provider).
|
| 25 |
+
* Create a **MySQL 8.2+** instance (e.g., on Aiven, PlanetScale, or your preferred cloud provider). Ensure you create a database named `new-api` (or whatever your `SQL_DSN` will point to) and have the root password or a dedicated user/password.
|
| 26 |
+
|
| 27 |
+
2. **Configure Space Secrets:**
|
| 28 |
+
In this Space's "Settings" > "Secrets", add the following:
|
| 29 |
+
* `REDIS_CONN_STRING`: The full connection string for your external Redis.
|
| 30 |
+
* Example: `redis://your-redis-host:your-redis-port` or `redis://user:password@host:port`
|
| 31 |
+
* `SQL_DSN`: The DSN for your external MySQL database.
|
| 32 |
+
* **Crucially, replace `mysql:3306` with your actual external MySQL host and port.**
|
| 33 |
+
* Example: `root:YOUR_MYSQL_ROOT_PASSWORD@your-external-mysql-host:3306/new-api`
|
| 34 |
+
* Ensure the password (`YOUR_MYSQL_ROOT_PASSWORD`) matches the one you set for your external MySQL.
|
| 35 |
+
* `TZ`: (Can be a Variable or Secret) `Asia/Shanghai`
|
| 36 |
+
* `SESSION_SECRET`: (Secret, if you plan to scale or for security) A long random string.
|
| 37 |
+
* `CRYPTO_SECRET`: (Secret, if needed by your configuration) Another long random string.
|
| 38 |
+
|
| 39 |
+
Once the `Dockerfile`, `README.md` are pushed, and the secrets are configured, Hugging Face Spaces will attempt to build and run your `new-api` container.
|