Skip to content

Commit

Permalink
adapt cockroachdb for license & init job
Browse files Browse the repository at this point in the history
  • Loading branch information
bxy4543 committed Mar 15, 2024
1 parent ae252be commit 4c9a0ff
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions deploy/cloud/etc/sealos/desktop-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ spec:
jwt_secret_region: <your-jwt-secret-region-base64>
region_database_url: <your-region-database-url-base64>
global_database_url: <your-global-database-url-base64>
region_uid: <your-local-region-uid-base64>
2 changes: 2 additions & 0 deletions deploy/cloud/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ retryPullImage ghcr.io/labring/sealos-cloud-license-frontend:latest
retryPullImage ghcr.io/labring/sealos-cloud-cronjob-frontend:latest

retryPullImage ghcr.io/labring/sealos-cloud-database-service:latest
retryPullImage ghcr.io/labring/sealos-cloud-account-service:latest
retryPullImage ghcr.io/labring/sealos-cloud-job-init-controller:latest
retryPullImage ghcr.io/labring/sealos-cloud-job-heartbeat-controller:latest

Expand All @@ -61,5 +62,6 @@ sealos save -o tars/frontend-license.tar ghcr.io/labring/sealos-cloud-license-fr
sealos save -o tars/frontend-cronjob.tar ghcr.io/labring/sealos-cloud-cronjob-frontend:latest

sealos save -o tars/database-service.tar ghcr.io/labring/sealos-cloud-database-service:latest
sealos save -o tars/account-service.tar ghcr.io/labring/sealos-cloud-account-service:latest
sealos save -o tars/job-init.tar ghcr.io/labring/sealos-cloud-job-init-controller:latest
sealos save -o tars/job-heartbeat.tar ghcr.io/labring/sealos-cloud-job-heartbeat-controller:latest
16 changes: 11 additions & 5 deletions deploy/cloud/scripts/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ mongodbUri=""
cockroachdbUri=""
cockroachdbLocalUri=""
cockroachdbGlobalUri=""
defaultLocalRegionUID="ed257b4d-6832-437a-9e06-d683e7edb320"

tlsCrtPlaceholder="<tls-crt-placeholder>"
tlsKeyPlaceholder="<tls-key-placeholder>"
Expand Down Expand Up @@ -142,6 +143,7 @@ function mutate_desktop_config() {
sed -i -e "s;<your-password-salt-base64>;$saltKey;" etc/sealos/desktop-config.yaml
sed -i -e "s;<your-region-database-url-base64>;$(echo -n "${cockroachdbLocalUri}" | base64 -w 0);" etc/sealos/desktop-config.yaml
sed -i -e "s;<your-global-database-url-base64>;$(echo -n "${cockroachdbGlobalUri}" | base64 -w 0);" etc/sealos/desktop-config.yaml
sed -i -e "s;<your-global-database-url-base64>;$(echo -n "${defaultLocalRegionUID}" | base64 -w 0);" etc/sealos/desktop-config.yaml
}

function create_tls_secret {
Expand Down Expand Up @@ -181,16 +183,20 @@ function sealos_run_controller {
--env MONGO_URI="$mongodbUri" \
--env cloudDomain="$cloudDomain" \
--env cloudPort="$cloudPort" \
--env DEFAULT_NAMESPACE="account-system"
--env DEFAULT_NAMESPACE="account-system" \
--env GLOBAL_COCKROACH_URI="$cockroachdbGlobalUri" \
--env LOCAL_COCKROACH_URI="$cockroachdbLocalUri" \
--env LOCAL_REGION="$defaultLocalRegionUID"

sealos run tars/account-service.tar

# run license controller
# sealos run tars/license.tar \
# --env MONGO_URI="$mongodbUri"
sealos run tars/license.tar
}


function sealos_authorize {
sealos run tars/job-init.tar
sealos run tars/job-init.tar --env PASSWORD_SALT="$(echo -n "$saltKey" | base64 -d)"
sealos run tars/job-heartbeat.tar

# wait for admin user create
Expand All @@ -212,7 +218,7 @@ function sealos_run_frontend {

# sealos authorize !!must run after sealos_run_controller frontend-desktop.tar and before sealos_run_frontend
# TODO fix sealos_authorize in controller/job/init
# sealos_authorize
sealos_authorize

echo "run applaunchpad frontend"
sealos run tars/frontend-applaunchpad.tar \
Expand Down
3 changes: 0 additions & 3 deletions frontend/desktop/deploy/manifests/secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ data:
# base64 encoded provider jwt secret, required
jwt_secret_app: ""

# base64 encoded current region , required
# default value is "ed257b4d-6832-437a-9e06-d683e7edb320"
region_uid: "ZWQyNTdiNGQtNjgzMi00MzdhLTllMDYtZDY4M2U3ZWRiMzIw"
# base64 encoded password salt, required if env PASSWORD_ENABLED is true
# please use a random string and do not change it after deployment
password_salt: ""
Expand Down

0 comments on commit 4c9a0ff

Please sign in to comment.