fix: umami template
This commit is contained in:
		
							parent
							
								
									b7303a0828
								
							
						
					
					
						commit
						de13f65a24
					
				| @ -1861,6 +1861,215 @@ | |||||||
|       defaultValue: $$generate_password |       defaultValue: $$generate_password | ||||||
|       description: "" |       description: "" | ||||||
|       showOnConfiguration: true |       showOnConfiguration: true | ||||||
|  | - templateVersion: 1.0.0 | ||||||
|  |   ignore: true | ||||||
|  |   defaultVersion: postgresql-v1.38.0 | ||||||
|  |   documentation: https://umami.is/docs/getting-started | ||||||
|  |   type: umami | ||||||
|  |   name: Umami | ||||||
|  |   subname: (PostgreSQL) | ||||||
|  |   description: >- | ||||||
|  |     A simple, easy to use, self-hosted web analytics solution. | ||||||
|  |   services: | ||||||
|  |     $$id: | ||||||
|  |       name: Umami | ||||||
|  |       documentation: "Official docs are [here](https://umami.is/docs/getting-started)" | ||||||
|  |       depends_on: | ||||||
|  |         - $$id-postgresql | ||||||
|  |       image: "ghcr.io/umami-software/umami:$$core_version" | ||||||
|  |       volumes: [] | ||||||
|  |       environment: | ||||||
|  |         - ADMIN_PASSWORD=$$secret_admin_password | ||||||
|  |         - DATABASE_URL=$$secret_database_url | ||||||
|  |         - DATABASE_TYPE=$$config_database_type | ||||||
|  |         - HASH_SALT=$$secret_hash_salt | ||||||
|  |       ports: | ||||||
|  |         - "3000" | ||||||
|  |     $$id-postgresql: | ||||||
|  |       name: PostgreSQL | ||||||
|  |       documentation: "Official docs are [here](https://umami.is/docs/getting-started)" | ||||||
|  |       depends_on: [] | ||||||
|  |       image: "postgres:12-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: [] | ||||||
|  |       files: | ||||||
|  |         - location: /docker-entrypoint-initdb.d/schema.postgresql.sql | ||||||
|  |           content: |2- | ||||||
|  | 
 | ||||||
|  |                                           -- CreateTable | ||||||
|  |                                   CREATE TABLE "account" ( | ||||||
|  |                                       "user_id" SERIAL NOT NULL, | ||||||
|  |                                       "username" VARCHAR(255) NOT NULL, | ||||||
|  |                                       "password" VARCHAR(60) NOT NULL, | ||||||
|  |                                       "is_admin" BOOLEAN NOT NULL DEFAULT false, | ||||||
|  |                                       "created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP, | ||||||
|  |                                       "updated_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP, | ||||||
|  |                                    | ||||||
|  |                                       PRIMARY KEY ("user_id") | ||||||
|  |                                   ); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateTable | ||||||
|  |                                   CREATE TABLE "event" ( | ||||||
|  |                                       "event_id" SERIAL NOT NULL, | ||||||
|  |                                       "website_id" INTEGER NOT NULL, | ||||||
|  |                                       "session_id" INTEGER NOT NULL, | ||||||
|  |                                       "created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP, | ||||||
|  |                                       "url" VARCHAR(500) NOT NULL, | ||||||
|  |                                       "event_type" VARCHAR(50) NOT NULL, | ||||||
|  |                                       "event_value" VARCHAR(50) NOT NULL, | ||||||
|  |                                    | ||||||
|  |                                       PRIMARY KEY ("event_id") | ||||||
|  |                                   ); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateTable | ||||||
|  |                                   CREATE TABLE "pageview" ( | ||||||
|  |                                       "view_id" SERIAL NOT NULL, | ||||||
|  |                                       "website_id" INTEGER NOT NULL, | ||||||
|  |                                       "session_id" INTEGER NOT NULL, | ||||||
|  |                                       "created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP, | ||||||
|  |                                       "url" VARCHAR(500) NOT NULL, | ||||||
|  |                                       "referrer" VARCHAR(500), | ||||||
|  |                                    | ||||||
|  |                                       PRIMARY KEY ("view_id") | ||||||
|  |                                   ); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateTable | ||||||
|  |                                   CREATE TABLE "session" ( | ||||||
|  |                                       "session_id" SERIAL NOT NULL, | ||||||
|  |                                       "session_uuid" UUID NOT NULL, | ||||||
|  |                                       "website_id" INTEGER NOT NULL, | ||||||
|  |                                       "created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP, | ||||||
|  |                                       "hostname" VARCHAR(100), | ||||||
|  |                                       "browser" VARCHAR(20), | ||||||
|  |                                       "os" VARCHAR(20), | ||||||
|  |                                       "device" VARCHAR(20), | ||||||
|  |                                       "screen" VARCHAR(11), | ||||||
|  |                                       "language" VARCHAR(35), | ||||||
|  |                                       "country" CHAR(2), | ||||||
|  |                                    | ||||||
|  |                                       PRIMARY KEY ("session_id") | ||||||
|  |                                   ); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateTable | ||||||
|  |                                   CREATE TABLE "website" ( | ||||||
|  |                                       "website_id" SERIAL NOT NULL, | ||||||
|  |                                       "website_uuid" UUID NOT NULL, | ||||||
|  |                                       "user_id" INTEGER NOT NULL, | ||||||
|  |                                       "name" VARCHAR(100) NOT NULL, | ||||||
|  |                                       "domain" VARCHAR(500), | ||||||
|  |                                       "share_id" VARCHAR(64), | ||||||
|  |                                       "created_at" TIMESTAMPTZ(6) DEFAULT CURRENT_TIMESTAMP, | ||||||
|  |                                    | ||||||
|  |                                       PRIMARY KEY ("website_id") | ||||||
|  |                                   ); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE UNIQUE INDEX "account.username_unique" ON "account"("username"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE INDEX "event_created_at_idx" ON "event"("created_at"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE INDEX "event_session_id_idx" ON "event"("session_id"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE INDEX "event_website_id_idx" ON "event"("website_id"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE INDEX "pageview_created_at_idx" ON "pageview"("created_at"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE INDEX "pageview_session_id_idx" ON "pageview"("session_id"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE INDEX "pageview_website_id_created_at_idx" ON "pageview"("website_id", "created_at"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE INDEX "pageview_website_id_idx" ON "pageview"("website_id"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE INDEX "pageview_website_id_session_id_created_at_idx" ON "pageview"("website_id", "session_id", "created_at"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE UNIQUE INDEX "session.session_uuid_unique" ON "session"("session_uuid"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE INDEX "session_created_at_idx" ON "session"("created_at"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE INDEX "session_website_id_idx" ON "session"("website_id"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE UNIQUE INDEX "website.website_uuid_unique" ON "website"("website_uuid"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE UNIQUE INDEX "website.share_id_unique" ON "website"("share_id"); | ||||||
|  |                                    | ||||||
|  |                                   -- CreateIndex | ||||||
|  |                                   CREATE INDEX "website_user_id_idx" ON "website"("user_id"); | ||||||
|  |                                    | ||||||
|  |                                   -- AddForeignKey | ||||||
|  |                                   ALTER TABLE "event" ADD FOREIGN KEY ("session_id") REFERENCES "session"("session_id") ON DELETE CASCADE ON UPDATE CASCADE; | ||||||
|  |                                    | ||||||
|  |                                   -- AddForeignKey | ||||||
|  |                                   ALTER TABLE "event" ADD FOREIGN KEY ("website_id") REFERENCES "website"("website_id") ON DELETE CASCADE ON UPDATE CASCADE; | ||||||
|  |                                    | ||||||
|  |                                   -- AddForeignKey | ||||||
|  |                                   ALTER TABLE "pageview" ADD FOREIGN KEY ("session_id") REFERENCES "session"("session_id") ON DELETE CASCADE ON UPDATE CASCADE; | ||||||
|  |                                    | ||||||
|  |                                   -- AddForeignKey | ||||||
|  |                                   ALTER TABLE "pageview" ADD FOREIGN KEY ("website_id") REFERENCES "website"("website_id") ON DELETE CASCADE ON UPDATE CASCADE; | ||||||
|  |                                    | ||||||
|  |                                   -- AddForeignKey | ||||||
|  |                                   ALTER TABLE "session" ADD FOREIGN KEY ("website_id") REFERENCES "website"("website_id") ON DELETE CASCADE ON UPDATE CASCADE; | ||||||
|  |                                    | ||||||
|  |                                   -- AddForeignKey | ||||||
|  |                                   ALTER TABLE "website" ADD FOREIGN KEY ("user_id") REFERENCES "account"("user_id") ON DELETE CASCADE ON UPDATE CASCADE; | ||||||
|  |                                    | ||||||
|  |                                           insert into account (username, password, is_admin) values ('admin', '$$hashed$$secret_admin_password', true); | ||||||
|  |   variables: | ||||||
|  |     - id: $$secret_database_url | ||||||
|  |       name: DATABASE_URL | ||||||
|  |       label: Database URL for PostgreSQL | ||||||
|  |       defaultValue: >- | ||||||
|  |         postgresql://$$config_postgres_user:$$secret_postgres_password@$$id-postgresql:5432/$$config_postgres_db | ||||||
|  |       description: "" | ||||||
|  |     - id: $$secret_hash_salt | ||||||
|  |       name: HASH_SALT | ||||||
|  |       label: Hash Salt | ||||||
|  |       defaultValue: $$generate_hex(64) | ||||||
|  |       description: "" | ||||||
|  |     - id: $$config_database_type | ||||||
|  |       name: DATABASE_TYPE | ||||||
|  |       label: Database Type | ||||||
|  |       defaultValue: "postgresql" | ||||||
|  |       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: $$generate_password | ||||||
|  |       description: "" | ||||||
|  |     - id: $$config_postgres_db | ||||||
|  |       name: POSTGRES_DB | ||||||
|  |       label: PostgreSQL Database | ||||||
|  |       defaultValue: umami | ||||||
|  |       description: "" | ||||||
|  |     - id: $$secret_admin_password | ||||||
|  |       name: ADMIN_PASSWORD | ||||||
|  |       label: Initial Admin Password | ||||||
|  |       defaultValue: $$generate_password | ||||||
|  |       description: "" | ||||||
|  |       showOnConfiguration: true | ||||||
| - templateVersion: 1.0.0 | - templateVersion: 1.0.0 | ||||||
|   defaultVersion: v0.29.1 |   defaultVersion: v0.29.1 | ||||||
|   documentation: https://docs.meilisearch.com/learn/getting_started/quick_start.html |   documentation: https://docs.meilisearch.com/learn/getting_started/quick_start.html | ||||||
|  | |||||||
| @ -238,7 +238,6 @@ async function hasura(service: any, template: any) { | |||||||
| async function umami(service: any, template: any) { | async function umami(service: any, template: any) { | ||||||
|     const { postgresqlUser, postgresqlPassword, postgresqlDatabase, umamiAdminPassword, hashSalt } = service.umami |     const { postgresqlUser, postgresqlPassword, postgresqlDatabase, umamiAdminPassword, hashSalt } = service.umami | ||||||
|     const { id } = service |     const { id } = service | ||||||
| 
 |  | ||||||
|     const secrets = [ |     const secrets = [ | ||||||
|         `HASH_SALT@@@${hashSalt}`, |         `HASH_SALT@@@${hashSalt}`, | ||||||
|         `POSTGRES_PASSWORD@@@${postgresqlPassword}`, |         `POSTGRES_PASSWORD@@@${postgresqlPassword}`, | ||||||
|  | |||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user