Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

add weblate

Andras Bacsaib4f17ac3c664
diff --git a/apps/api/src/lib.ts b/apps/api/src/lib.ts
index 4ad53f14d1..ef92db42f6 100644
--- a/apps/api/src/lib.ts
+++ b/apps/api/src/lib.ts
@@ -21,6 +21,7 @@ export async function migrateServicesToNewTemplate() {
if (service.type === 'hasura' && service.hasura) await hasura(service)
if (service.type === 'glitchTip' && service.glitchTip) await glitchtip(service)
if (service.type === 'searxng' && service.searxng) await searxng(service)
+ if (service.type === 'weblate' && service.weblate) await weblate(service)
await createVolumes(service);
}
@@ -29,6 +30,28 @@ export async function migrateServicesToNewTemplate() {
}
}
+async function weblate(service: any) {
+ const { adminPassword, postgresqlUser, postgresqlPassword, postgresqlDatabase } = service.weblate
+
+ const secrets = [
+ `WEBLATE_ADMIN_PASSWORD@@@${adminPassword}`,
+ `POSTGRES_PASSWORD@@@${postgresqlPassword}`,
+ ]
+
+ const settings = [
+ `WEBLATE_SITE_DOMAIN@@@$$generate_domain`,
+ `POSTGRES_USER@@@${postgresqlUser}`,
+ `POSTGRES_DATABASE@@@${postgresqlDatabase}`,
+ `POSTGRES_HOST@@@$$id-postgres`,
+ `POSTGRES_PORT@@@5432`,
+ `REDIS_HOST@@@$$id-redis`,
+ ]
+ await migrateSecrets(secrets, service);
+ await migrateSettings(settings, service);
+
+ // Remove old service data
+ // await prisma.service.update({ where: { id: service.id }, data: { wordpress: { delete: true } } })
+}
async function searxng(service: any) {
const { secretKey, redisPassword } = service.searxng
@@ -150,8 +173,8 @@ async function ghost(service: any) {
`MARIADB_USER@@@${mariadbUser}`,
`MARIADB_DATABASE@@@${mariadbDatabase}`,
`MARIADB_ROOT_USER@@@${mariadbRootUser}`,
- `GHOST_HOST@@@${getDomain(fqdn)}`,
- `url@@@${fqdn}`,
+ `GHOST_HOST@@@$$generate_domain`,
+ `url@@@$$generate_fqdn`,
`GHOST_ENABLE_HTTPS@@@${isHttps ? 'yes' : 'no'}`
]
await migrateSecrets(secrets, service);
diff --git a/apps/api/src/lib/templates.ts b/apps/api/src/lib/templates.ts
index 4df0f5f2c9..8c171875e2 100644
--- a/apps/api/src/lib/templates.ts
+++ b/apps/api/src/lib/templates.ts
@@ -1,4 +1,98 @@
export default [
+ {
+ "templateVersion": "1.0.0",
+ "serviceDefaultVersion": "latest",
+ "name": "weblate",
+ "displayName": "Weblate",
+ "description": "",
+ "services": {
+ "$$id": {
+ "name": "Weblate",
+ "depends_on": [
+ "$$id-postgresql",
+ "$$id-redis"
+ ],
+ "image": "weblate/weblate:$$core_version",
+ "volumes": [
+ "$$id-data:/app/data",
+ ],
+ "environment": [
+ `WEBLATE_SITE_DOMAIN=$$config_weblate_site_domain`,
+ `WEBLATE_ADMIN_PASSWORD=$$secret_weblate_admin_password`,
+ `POSTGRES_PASSWORD=$$secret_postgres_password`,
+ `POSTGRES_USER=$$config_postgres_user`,
+ `POSTGRES_DATABASE=$$config_postgres_db`,
+ `POSTGRES_HOST=$$id-postgres`,
+ `POSTGRES_PORT=5432`,
+ `REDIS_HOST=$$id-redis`,
+ ],
+ "ports": [
+ "8080"
+ ]
+ },
+ "$$id-postgresql": {
+ "name": "PostgreSQL",
+ "depends_on": [],
+ "image": "postgres:14-alpine",
+ "volumes": [
+ "$$id-postgresql-data:/var/lib/postgresql/data",
+ ],
+ "environment": [
+ "POSTGRES_USER=$$config_postgres_user",
+ "POSTGRES_PASSWORD=$$secret_postgres_password",
+ "POSTGRES_DB=$$config_postgres_db",
+ ],
+ "ports": []
+ },
+ "$$id-redis": {
+ "name": "Redis",
+ "depends_on": [],
+ "image": "redis:7-alpine",
+ "volumes": [
+ "$$id-redis-data:/data",
+ ],
+ "environment": [],
+ "ports": [],
+ }
+ },
+ "variables": [
+ {
+ "id": "$$config_weblate_site_domain",
+ "name": "WEBLATE_SITE_DOMAIN",
+ "label": "Weblate domain",
+ "defaultValue": "$$generate_domain",
+ "description": "",
+ },
+ {
+ "id": "$$secret_weblate_admin_password",
+ "name": "WEBLATE_ADMIN_PASSWORD",
+ "label": "Weblate Admin Password",
+ "defaultValue": "$$generate_password",
+ "description": "",
+ },
+ {
+ "id": "$$config_postgres_user",
+ "name": "POSTGRES_USER",
+ "label": "PostgreSQL User",
+ "defaultValue": "$$generate_username",
+ "description": "",
+ },
+ {
+ "id": "$$secret_postgres_password",
+ "name": "POSTGRES_PASSWORD",
+ "label": "PostgreSQL Password",
+ "defaultValue": "",
+ "description": "",
+ },
+ {
+ "id": "$$config_postgres_db",
+ "name": "POSTGRES_DB",
+ "label": "PostgreSQL Database",
+ "defaultValue": "hasura",
+ "description": "",
+ },
+ ]
+ },
{
"templateVersion": "1.0.0",
"serviceDefaultVersion": "2022.10.14-1a5b0965",