import via sql

main
kevinzcf 3 years ago
parent af1b38f37a
commit 24cd27b5e4

@ -5,9 +5,21 @@ metadata:
data:
init.sh: |
#!/bin/bash
PGPASSWORD=YOUR_PASSWORD psql -v ON_ERROR_STOP=1 -h statping-postgres -p 5432 -U statping --dbname "statping" <<-EOSQL
PGPASSWORD=YOUR_PASSWORD psql -v ON_ERROR_STOP=1 -h statping-postgres -p 5432 -U statping --dbname "statping" -f /init.d/init.sql
init.sql: |
TRUNCATE core;
INSERT INTO "core" ("name", "description", "config", "api_secret", "style", "footer", "domain", "version", "language", "migration_id", "use_cdn", "allow_reports", "created_at", "updated_at", "oauth_providers", "gh_client_id", "gh_client_secret", "gh_users", "gh_orgs", "google_client_id", "google_client_secret", "google_users", "slack_client_id", "slack_client_secret", "slack_team", "slack_users", "custom_name", "custom_client_id", "custom_client_secret", "custom_endpoint_auth", "custom_endpoint_token", "custom_scopes", "custom_open_id") VALUES
('demo status', 'This status page has sample data included', '', 'Siwo6GTDxM2wwl65K4kHKgu9QgmS7n6Q', '', '', 'http://localhost:8080', '0.90.74', 'en', 1674599079, 'f', 'f', '2023-01-24 22:24:39.291738+00', '2023-01-24 22:43:59.697317+00', 'local', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', NULL);
TRUNCATE groups;
INSERT INTO "groups" ("id", "name", "public", "order_id", "created_at", "updated_at") VALUES
(1, 'Main Services', 't', 1, '2023-01-24 22:24:39.616202+00', '2023-01-24 22:24:39.616202+00');
TRUNCATE services;
COPY core FROM '/initdb/core.csv' DELIMITER ',' CSV HEADER;
COPY services FROM '/initdb/services.csv' DELIMITER ',' CSV HEADER;
EOSQL
INSERT INTO "services" ("id", "name", "domain", "expected", "expected_status", "check_interval", "check_type", "method", "post_data", "port", "timeout", "order_id", "verify_ssl", "grpc_health_check", "public", "group_id", "tls_cert", "tls_cert_key", "tls_cert_root", "headers", "permalink", "redirect", "created_at", "updated_at", "notify_after", "allow_notifications", "notify_all_changes") VALUES
(2, 'gitea', 'https://gitea.superzach.de', '', 200, 30, 'http', 'GET', '', 0, 20, 2, 't', 'f', 't', 1, '', '', '', '', '', 'f', '2022-10-26 22:24:39.294125+00', '2023-01-24 22:24:39.306641+00', 1, 't', 't'),
(1, 'status', 'https://status.superzach.de', '', 200, 10, 'http', 'GET', '', 0, 10, 1, 't', 'f', 't', 1, '', '', '', '', '', 't', '2022-10-26 22:24:39.294125+00', '2023-01-24 22:24:39.294254+00', 3, 't', 't');
TRUNCATE users;
INSERT INTO "users" ("id", "username", "password", "email", "api_key", "scopes", "administrator", "created_at", "updated_at") VALUES
(1, 'mystatping', '$2a$14$r7n8uEuWgRegyu9Efa5mwuyazFQSejltE/xuJSB0ae6gufPV6O6oa', 'info@admin.com', '7d8b24cebdfaf57b4cd57c3b6fd803c95a5d4f838b4f7d0544842444809e2cf5', 'admin', 't', '2023-01-24 22:24:39.238789+00', '2023-01-24 22:52:19.360722+00');

@ -1,2 +0,0 @@
name,description,config,api_secret,style,footer,domain,version,language,migration_id,use_cdn,allow_reports,created_at,updated_at,oauth_providers,gh_client_id,gh_client_secret,gh_users,gh_orgs,google_client_id,google_client_secret,google_users,slack_client_id,slack_client_secret,slack_team,slack_users,custom_name,custom_client_id,custom_client_secret,custom_endpoint_auth,custom_endpoint_token,custom_scopes,custom_open_id
hello world,This status page has sample data included,"",CIxDV7OmcTyWhdlBMnRHTBAkxrQ3h12I,"","",http://localhost:8080,"0.90.74",en,1674076161,f,f,2023-01-18 21:09:21.301778+00,2023-01-18 21:09:21.963744+00,local,"","","","","","","","","","","","","","","","","",
1 name description config api_secret style footer domain version language migration_id use_cdn allow_reports created_at updated_at oauth_providers gh_client_id gh_client_secret gh_users gh_orgs google_client_id google_client_secret google_users slack_client_id slack_client_secret slack_team slack_users custom_name custom_client_id custom_client_secret custom_endpoint_auth custom_endpoint_token custom_scopes custom_open_id
2 hello world This status page has sample data included CIxDV7OmcTyWhdlBMnRHTBAkxrQ3h12I http://localhost:8080 0.90.74 en 1674076161 f f 2023-01-18 21:09:21.301778+00 2023-01-18 21:09:21.963744+00 local

@ -1,3 +0,0 @@
id,name,domain,expected,expected_status,check_interval,check_type,method,post_data,port,timeout,order_id,verify_ssl,grpc_health_check,public,group_id,tls_cert,tls_cert_key,tls_cert_root,headers,permalink,redirect,created_at,updated_at,notify_after,allow_notifications,notify_all_changes
1,demo,https://status.superzach.de,"",200,10,http,GET,"","0",10,1,t,f,t,1,"","","","",google,t,2022-10-20 21:09:21.302969+00,2023-01-18 21:09:21.303144+00,3,t,t
2,something,https://github.com/statping/statping,"",200,30,http,GET,"","0",20,2,t,f,t,"0","","","","",statping_github,f,2022-10-20 21:09:21.302969+00,2023-01-18 21:09:21.30423+00,1,t,t
1 id name domain expected expected_status check_interval check_type method post_data port timeout order_id verify_ssl grpc_health_check public group_id tls_cert tls_cert_key tls_cert_root headers permalink redirect created_at updated_at notify_after allow_notifications notify_all_changes
2 1 demo https://status.superzach.de 200 10 http GET 0 10 1 t f t 1 google t 2022-10-20 21:09:21.302969+00 2023-01-18 21:09:21.303144+00 3 t t
3 2 something https://github.com/statping/statping 200 30 http GET 0 20 2 t f t 0 statping_github f 2022-10-20 21:09:21.302969+00 2023-01-18 21:09:21.30423+00 1 t t

@ -61,12 +61,7 @@ spec:
volumeMounts:
- name: postgres-persistent-storage
mountPath: /var/lib/postgresql/data
- name: host-mount
mountPath: /initdb
volumes:
- name: host-mount
hostPath:
path: /k8s/statping/initdb
- name: postgres-persistent-storage
persistentVolumeClaim:
claimName: postgres-pv-claim

Loading…
Cancel
Save