-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow setting MIQ admin password during deployment #250
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,6 +120,15 @@ function migrate_db() { | |
) 2>&1 | tee ${PV_MIGRATE_DB_LOG} | ||
} | ||
|
||
# Set EVM admin pwd | ||
function set_admin_pwd() { | ||
echo "== Setting admin password ==" | ||
|
||
cd ${APP_ROOT} && bin/rails runner -e production "EvmDatabase.seed_primordial; user = User.find_by_userid('admin'); user.password = ENV['APPLICATION_ADMIN_PASSWORD']; user.save; exit;" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can simplify the ruby here. EvmDatabase.seed_primordial; User.find_by_userid('admin').update_attributes!(:password => ENV['APPLICATION_ADMIN_PASSWORD']) @bdunne this look good to you? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @carbonin Yep , will go ahead and test with the simplied version. |
||
|
||
[ "$?" -ne "0" ] && echo "ERROR: Failed to set admin password, please check appliance logs" | ||
} | ||
|
||
# Process DATA_PERSIST_FILE which contains the desired files/dirs to store on the PV | ||
# Use rsync to transfer files/dirs, log output and check return status | ||
# Ensure we always store an initial data backup on PV | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ objects: | |
name: "${NAME}-secrets" | ||
stringData: | ||
pg-password: "${DATABASE_PASSWORD}" | ||
admin-password: "${APPLICATION_ADMIN_PASSWORD}" | ||
database-url: postgresql://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_SERVICE_NAME}/${DATABASE_NAME}?encoding=utf8&pool=5&wait_timeout=5 | ||
v2-key: "${V2_KEY}" | ||
- apiVersion: v1 | ||
|
@@ -387,6 +388,11 @@ objects: | |
secretKeyRef: | ||
name: "${NAME}-secrets" | ||
key: v2-key | ||
- name: APPLICATION_ADMIN_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
name: "${NAME}-secrets" | ||
key: admin-password | ||
- name: ANSIBLE_ADMIN_PASSWORD | ||
valueFrom: | ||
secretKeyRef: | ||
|
@@ -888,6 +894,12 @@ parameters: | |
displayName: Application Database Region | ||
description: Database region that will be used for application. | ||
value: '0' | ||
- name: APPLICATION_ADMIN_PASSWORD | ||
displayName: Application Admin Password | ||
required: true | ||
description: Admin password that will be set on the application. | ||
from: "[a-zA-Z0-9]{8}" | ||
generate: expression | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like we should keep the default value here rather than using a generator. If someone wants to change the password on deploy they can set the parameter, otherwise I think we should just keep "smartvm" |
||
- name: ANSIBLE_DATABASE_NAME | ||
displayName: Ansible PostgreSQL database name | ||
required: true | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment hardly seems necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chessbyte Surely , already commented and working on requested changes..