Compare commits

...

3 Commits

3 changed files with 12 additions and 7 deletions

View File

@@ -24,6 +24,8 @@ app/nassella/lldap_postgres_password \
app/nassella/authelia_postgres_db \ app/nassella/authelia_postgres_db \
app/nassella/authelia_postgres_user \ app/nassella/authelia_postgres_user \
app/nassella/authelia_postgres_password \ app/nassella/authelia_postgres_password \
app/nassella/lldap_admin_password \
app/nassella/stripe_api_key \
app/nassella/nassella.env \ app/nassella/nassella.env \
app/nassella/authelia-config/configuration.yml \ app/nassella/authelia-config/configuration.yml \
app/nassella/lldap-config/lldap_config.toml app/nassella/lldap-config/lldap_config.toml

View File

@@ -197,7 +197,6 @@ returning users.user_id;"
(user-encrypt-for-db ssh-key-pub user-key user-iv user-id) (user-encrypt-for-db ssh-key-pub user-key user-iv user-id)
(user-encrypt-for-db restic-password user-key user-iv user-id))))) (user-encrypt-for-db restic-password user-key user-iv user-id)))))
(query conn "insert into user_service_configs(user_id, instance_id) values ($1, $2);" user-id instance-id) (query conn "insert into user_service_configs(user_id, instance_id) values ($1, $2);" user-id instance-id)
(query conn "insert into user_selected_apps(user_id, instance_id) values ($1, $2);" user-id instance-id)
(query conn "insert into user_app_configs(user_id, instance_id) values ($1, $2);" user-id instance-id) (query conn "insert into user_app_configs(user_id, instance_id) values ($1, $2);" user-id instance-id)
(query conn "insert into user_terraform_state(user_id, instance_id) values ($1, $2);" user-id instance-id) (query conn "insert into user_terraform_state(user_id, instance_id) values ($1, $2);" user-id instance-id)
instance-id))) instance-id)))

View File

@@ -742,10 +742,10 @@ h1, h2, h3, h4, h5, h6 {
"--password-file" "/restic-password" "--password-file" "/restic-password"
"--json"))) "--json")))
(else (else
(process* "timeout" (process* "/bin/timeout"
`("--preserve-status" "8s" "restic" "cat" "config" `("--preserve-status" "8s" "/bin/restic" "cat" "config"
"--repo" ,(conc "s3:" bucket-url) "--repo" ,(conc "s3:" bucket-url)
"--password-file" password-path "--password-file" ,(conc (current-directory) "/" password-path)
"--json") "--json")
`(("AWS_ACCESS_KEY_ID" . ,key-id) `(("AWS_ACCESS_KEY_ID" . ,key-id)
("AWS_SECRET_ACCESS_KEY" . ,application-key))))) ("AWS_SECRET_ACCESS_KEY" . ,application-key)))))
@@ -760,11 +760,14 @@ h1, h2, h3, h4, h5, h6 {
(if (= wait-pid 0) ;; wait-pid is 0 until the process has finished (if (= wait-pid 0) ;; wait-pid is 0 until the process has finished
(if (< i 12) ;; 12s timeout (if (< i 12) ;; 12s timeout
(loop (+ i 1)) (loop (+ i 1))
(error "timeout trying to connect to to backblaze")) `((success . #f)
(errors ((message . "timeout trying to connect to backblaze")))))
(if exit-normal (if exit-normal
(let ((res (with-input-from-port in-port read-json)) (let ((res (with-input-from-port in-port read-json))
(err (with-input-from-port err-port read-json))) (err (with-input-from-port err-port read-json)))
(if res ;; status 10 is what is returned if we can connect but the repo
;; is not initialized yet
(if (or res (and err (= status 10)))
`((success . #t) `((success . #t)
(result . ,res)) (result . ,res))
`((success . #f) `((success . #f)
@@ -774,7 +777,8 @@ h1, h2, h3, h4, h5, h6 {
)))))))) ))))))))
(thread-join! thread)))) (thread-join! thread))))
(lambda () (lambda ()
(delete-file password-path))))) (handle-exceptions exn 'ignore
(delete-file password-path))))))
(define (deployment-directory user-id instance-id) (define (deployment-directory user-id instance-id)
(string-append "deploy-" (number->string user-id) "-" (->string instance-id))) (string-append "deploy-" (number->string user-id) "-" (->string instance-id)))