adapt to nu 0.90
parent
afaf55b0f1
commit
55b79af44b
|
|
@ -0,0 +1,15 @@
|
||||||
|
export-env {
|
||||||
|
load-env {
|
||||||
|
MS_OCR_AUTHORITY: "https://otc-dev.aws.de.insiders.cloud/ocr/microsoft",
|
||||||
|
FLAIR_AUTHORITY: "http://localhost:8082",
|
||||||
|
XS_SF_URL: "https://api.test.de.insiders.cloud",
|
||||||
|
XS_URL: "https://xs-backend.test.de.insiders.cloud",
|
||||||
|
XS_SF_ACCOUNT: "xs.aws.test.tessi-admin",
|
||||||
|
KUBE_CONTEXT: "aws-dev"
|
||||||
|
HELM_KUBECONTEXT: "aws-dev"
|
||||||
|
XS_ENV_NAME: "AWS_DEV"
|
||||||
|
AWS_INFASTRUCTURE_ACCOUNT: "047349208615.dkr.ecr.eu-central-1.amazonaws.com"
|
||||||
|
XS_KAFKA_BOOSTRAP_SERVER: "localhost:9092"
|
||||||
|
AWS_PROFILE: "default"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -9,5 +9,6 @@ export-env {
|
||||||
HELM_KUBECONTEXT: "aws-prod"
|
HELM_KUBECONTEXT: "aws-prod"
|
||||||
XS_ENV_NAME: "AWS_PROD"
|
XS_ENV_NAME: "AWS_PROD"
|
||||||
AWS_INFASTRUCTURE_ACCOUNT: "047349208615.dkr.ecr.eu-central-1.amazonaws.com"
|
AWS_INFASTRUCTURE_ACCOUNT: "047349208615.dkr.ecr.eu-central-1.amazonaws.com"
|
||||||
|
AWS_PROFILE: "prod"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
export-env {
|
||||||
|
load-env {
|
||||||
|
MS_OCR_AUTHORITY: "https://otc-dev.aws.de.insiders.cloud/ocr/microsoft",
|
||||||
|
FLAIR_AUTHORITY: "http://localhost:8082",
|
||||||
|
XS_SF_URL: "https://api.production.de.insiders.cloud",
|
||||||
|
XS_URL: "https://xs-backend.production.de.insiders.cloud",
|
||||||
|
XS_SF_ACCOUNT: "xs.prod.paul",
|
||||||
|
KUBE_CONTEXT: "aws-staging"
|
||||||
|
HELM_KUBECONTEXT: "aws-staging"
|
||||||
|
XS_ENV_NAME: "AWS_STAGING"
|
||||||
|
AWS_INFASTRUCTURE_ACCOUNT: "047349208615.dkr.ecr.eu-central-1.amazonaws.com"
|
||||||
|
AWS_PROFILE: "prod"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,10 +5,11 @@ export-env {
|
||||||
XS_SF_URL: "https://api.test.de.insiders.cloud",
|
XS_SF_URL: "https://api.test.de.insiders.cloud",
|
||||||
XS_URL: "https://xs-backend.test.de.insiders.cloud",
|
XS_URL: "https://xs-backend.test.de.insiders.cloud",
|
||||||
XS_SF_ACCOUNT: "xs.aws.test.tessi-admin",
|
XS_SF_ACCOUNT: "xs.aws.test.tessi-admin",
|
||||||
KUBE_CONTEXT: "dev-test"
|
KUBE_CONTEXT: "aws-test"
|
||||||
HELM_KUBECONTEXT: "dev-test"
|
HELM_KUBECONTEXT: "aws-test"
|
||||||
XS_ENV_NAME: "AWS_TEST"
|
XS_ENV_NAME: "AWS_TEST"
|
||||||
AWS_INFASTRUCTURE_ACCOUNT: "047349208615.dkr.ecr.eu-central-1.amazonaws.com"
|
AWS_INFASTRUCTURE_ACCOUNT: "047349208615.dkr.ecr.eu-central-1.amazonaws.com"
|
||||||
XS_KAFKA_BOOSTRAP_SERVER: "localhost:9092"
|
XS_KAFKA_BOOSTRAP_SERVER: "localhost:9092"
|
||||||
|
AWS_PROFILE: "default"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
6
aws.nu
6
aws.nu
|
|
@ -1,5 +1,5 @@
|
||||||
def call_aws [args:list<string>] {
|
def call_aws [args:list<string>] {
|
||||||
run-external --redirect-stdout "aws" $args
|
run-external --redirect-stdout "aws" "--profile" $env.AWS_PROFILE ...$args
|
||||||
}
|
}
|
||||||
|
|
||||||
def comp-instanceId [] {
|
def comp-instanceId [] {
|
||||||
|
|
@ -17,7 +17,7 @@ export def login-into-docker [] {
|
||||||
|
|
||||||
export def login [] {
|
export def login [] {
|
||||||
call_aws ["sso", "login"]
|
call_aws ["sso", "login"]
|
||||||
login-into-docker
|
# login-into-docker
|
||||||
}
|
}
|
||||||
|
|
||||||
export def "restart instance" [instanceId:string@comp-instanceId] {
|
export def "restart instance" [instanceId:string@comp-instanceId] {
|
||||||
|
|
@ -51,7 +51,7 @@ export def alarm [alarm:string@comp-alarm-name] {
|
||||||
| update Timestamp { |r| $r.Timestamp | into datetime }
|
| update Timestamp { |r| $r.Timestamp | into datetime }
|
||||||
| select AlarmName Timestamp HistorySummary oldState newState
|
| select AlarmName Timestamp HistorySummary oldState newState
|
||||||
| rename name age summary old new
|
| rename name age summary old new
|
||||||
| insert date {|r| $r.age | date to-timezone "Europe/Berlin" | date format }
|
| insert date {|r| $r.age | date to-timezone "Europe/Berlin" | format date }
|
||||||
| where new == ALARM
|
| where new == ALARM
|
||||||
| reverse
|
| reverse
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,5 +24,5 @@ export def init [] {
|
||||||
|
|
||||||
export def main [] {
|
export def main [] {
|
||||||
let items = (list includes)
|
let items = (list includes)
|
||||||
^restic backup $items
|
^restic backup ...$items
|
||||||
}
|
}
|
||||||
15
br.nu
15
br.nu
|
|
@ -7,7 +7,7 @@ def read-settings [] {
|
||||||
}
|
}
|
||||||
|
|
||||||
def comp-name [] {
|
def comp-name [] {
|
||||||
read-settings | query db "SELECT * FROM formula" | select name desc | rename value description
|
read-settings | query db "SELECT * FROM main" | select name desc | rename value description
|
||||||
}
|
}
|
||||||
|
|
||||||
# update the info about the formulars
|
# update the info about the formulars
|
||||||
|
|
@ -15,16 +15,21 @@ export def update-cache [] {
|
||||||
let formulars = (http get https://formulae.brew.sh/api/formula.json)
|
let formulars = (http get https://formulae.brew.sh/api/formula.json)
|
||||||
let casks = (http get https://formulae.brew.sh/api/cask.json)
|
let casks = (http get https://formulae.brew.sh/api/cask.json)
|
||||||
rm -f (settings-db)
|
rm -f (settings-db)
|
||||||
$formulars | select name full_name desc | insert type "formula" | into sqlite --table_name "formula" (settings-db)
|
$formulars | select name full_name desc | insert type "formula" | into sqlite --table-name "formula" (settings-db)
|
||||||
$casks | select token full_token desc | rename name full_name desc | insert type "cask" | into sqlite --table_name "formula" (settings-db)
|
$casks
|
||||||
|
| select token full_token desc
|
||||||
|
| rename name full_name desc
|
||||||
|
| insert type "cask"
|
||||||
|
| default "" "desc"
|
||||||
|
| into sqlite --table-name "formula" (settings-db)
|
||||||
}
|
}
|
||||||
|
|
||||||
export def search [pattern:string,--exact] {
|
export def search [pattern:string,--exact] {
|
||||||
let settings = (read-settings)
|
let settings = (read-settings)
|
||||||
if $exact {
|
if $exact {
|
||||||
$settings | query db $"SELECT * FROM formula WHERE name = '($pattern)'"
|
$settings | query db $"SELECT * FROM main WHERE name = '($pattern)'"
|
||||||
} else {
|
} else {
|
||||||
$settings | query db $"SELECT * FROM formula WHERE name LIKE '%($pattern)%'"
|
$settings | query db $"SELECT * FROM main WHERE name LIKE '%($pattern)%'"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
# drops all tables for current environment. You should restart the backend to execute the migration
|
||||||
|
export def "drop database" [] {}
|
||||||
14
hl.nu
14
hl.nu
|
|
@ -1,23 +1,27 @@
|
||||||
export def helm-projects [] {
|
export def helm-projects [] {
|
||||||
[{
|
[{
|
||||||
value: "xs-backend",
|
value: "xs-backend",
|
||||||
description: "/Volumes/extreme/projects/xtraction-factory/XtractionStudioBackend/src/main/helm/xs-backend"
|
# description: "/Volumes/extreme/projects/xtraction-factory/XtractionStudioBackend/src/main/helm/xs-backend"
|
||||||
|
description: "/Volumes/extreme/projects/xtraction-factory/XtractionStudioBackend/products/xs-backend/src/main/helm"
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
export def hist [project:string@helm-projects] {
|
export def hist [project:string@helm-projects, --max:int=10] {
|
||||||
let helm_project_path = (helm-projects | where value == $project | first | get description | parse-helm-path)
|
let helm_project_path = (helm-projects | where value == $project | first | get description | parse-helm-path)
|
||||||
cd $helm_project_path.directory
|
cd $helm_project_path.directory
|
||||||
helm history ($helm_project_path.name) -o json | from json | update updated { |row| $row.updated | into datetime }
|
helm history $project --max $max -o json
|
||||||
|
| from json
|
||||||
|
| update updated { |row| $row.updated | into datetime }
|
||||||
|
# helm history $project -o json | from json
|
||||||
}
|
}
|
||||||
|
|
||||||
export def rollback [project:string@helm-projects, revision?:int] {
|
export def rollback [project:string@helm-projects, revision?:int] {
|
||||||
let helm_project_path = (helm-projects | where value == $project | first | get description | parse-helm-path)
|
let helm_project_path = (helm-projects | where value == $project | first | get description | parse-helm-path)
|
||||||
cd $helm_project_path.directory
|
cd $helm_project_path.directory
|
||||||
if $revision == null {
|
if $revision == null {
|
||||||
helm rollback ($helm_project_path.name)
|
helm rollback $project
|
||||||
} else {
|
} else {
|
||||||
helm rollback ($helm_project_path.name) $revision
|
helm rollback $project $revision
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
26
sc.nu
26
sc.nu
|
|
@ -41,19 +41,19 @@ def sc-delete [path:string] {
|
||||||
^xh delete -A bearer -a $"(provide-access-token)" (ht with-path $env.XS_SF_URL $path) | from json
|
^xh delete -A bearer -a $"(provide-access-token)" (ht with-path $env.XS_SF_URL $path) | from json
|
||||||
}
|
}
|
||||||
|
|
||||||
export def-env update-access-token [] {
|
# export def-env update-access-token [] {
|
||||||
print -e $"Login as (ansi pb)($env.XS_SF_ACCOUNT)(ansi reset)"
|
# print -e $"Login as (ansi pb)($env.XS_SF_ACCOUNT)(ansi reset)"
|
||||||
let token_response = (request-token)
|
# let token_response = (request-token)
|
||||||
if "ErrorCode" in $token_response {
|
# if "ErrorCode" in $token_response {
|
||||||
print "ERROR"
|
# print "ERROR"
|
||||||
let error_msg = $"Could not login into smart cloud as user ($env.XS_SF_ACCOUNT): ($token_response | get Message)"
|
# let error_msg = $"Could not login into smart cloud as user ($env.XS_SF_ACCOUNT): ($token_response | get Message)"
|
||||||
error make {
|
# error make {
|
||||||
msg: $error_msg
|
# msg: $error_msg
|
||||||
}
|
# }
|
||||||
}
|
# }
|
||||||
$token_response | credm update-token-response (token-name)
|
# $token_response | credm update-token-response (token-name)
|
||||||
$token_response.token
|
# $token_response.token
|
||||||
}
|
# }
|
||||||
|
|
||||||
export def provide-access-token [] {
|
export def provide-access-token [] {
|
||||||
let token = (credm get (token-name))
|
let token = (credm get (token-name))
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,3 @@
|
||||||
|
export def "view log" [] {
|
||||||
|
lines | filter { |line| $line | str starts-with '{' } | each { |line| try { $line | from json } catch {{}} } | flatten
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue