Skip to content

Commit

Permalink
Merge 0ce545c into 2909e92
Browse files Browse the repository at this point in the history
  • Loading branch information
mvidalgarcia authored Sep 3, 2020
2 parents 2909e92 + 0ce545c commit d0b6b28
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ deploy: # Deploy/redeploy previously built REANA cluster.
sleep ${TIMECHECK}; \
fi;\
done && \
source ${PWD}/scripts/create-admin-user.sh ${TRUNC_INSTANCE_NAME} && \
source ${PWD}/scripts/create-admin-user.sh ${TRUNC_INSTANCE_NAME} admin@reana.io mysecretpassword && \
eval $$(reana-dev client-setup-environment $(addprefix --server-hostname , ${SERVER_URL}))

example: # Run one or several demo examples.
Expand Down
2 changes: 1 addition & 1 deletion helm/reana/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ If you are installing REANA for the first time, there are a few steps left to fi

3. Create your administrator user and store the token:

$ kubectl exec $REANA_SERVER -- flask reana-admin create-admin-user john.doe@example.org
$ kubectl exec $REANA_SERVER -- flask reana-admin create-admin-user --email john.doe@example.org --password mysecretpassword
<reana-admin-access-token-value>
$ read -s REANA_ADMIN_ACCESS_TOKEN # paste the secret here
$ kubectl create secret generic {{ .Release.Name }}-admin-access-token \
Expand Down
25 changes: 23 additions & 2 deletions reana/reana_dev/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,33 @@ def cluster_build(
default="",
help="Which components to exclude from build? [c1,c2,c3]",
)
@click.option(
"--admin-email", required=True, help="Admin user email address",
)
@click.option(
"--admin-password", required=True, help="Admin user password",
)
@click.option(
"--instance-name", default="reana", help="REANA instance name",
)
def cluster_deploy(
namespace, job_mounts, mode, values, exclude_components
namespace,
job_mounts,
mode,
values,
exclude_components,
admin_email,
admin_password,
instance_name,
): # noqa: D301
"""Deploy REANA cluster.
\b
Example:
$ reana-dev cluster-deploy --mode debug
--exclude-components=r-ui
--admin-email john.doe@example.org
--admin-password mysecretpassword
"""

def job_mounts_to_config(job_mounts):
Expand Down Expand Up @@ -301,7 +319,10 @@ def job_mounts_to_config(job_mounts):
"helm dep update helm/reana",
helm_install,
"kubectl config set-context --current --namespace={}".format(namespace),
os.path.join(get_srcdir("reana"), "scripts/create-admin-user.sh"),
os.path.join(
get_srcdir("reana"),
f"scripts/create-admin-user.sh {instance_name} {admin_email} {admin_password}",
),
]
if mode in ("latest", "debug"):
cmds.append("reana-dev git-submodule --update")
Expand Down
13 changes: 10 additions & 3 deletions scripts/create-admin-user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
# Two parameters: instance name and email address of the admin
instance_name=$1
if [ -z "$instance_name" ]; then
instance_name=reana
echo 'Instance name missing.'
exit 1
fi
email_address=$2
if [ -z "$email_address" ]; then
email_address=root@localhost
echo 'Email address missing.'
exit 1
fi
password=$3
if [ -z "$password" ]; then
echo 'Password missing.'
exit 1
fi

# Get REANA Server pod name
Expand All @@ -28,7 +35,7 @@ kubectl exec "$REANA_SERVER" -- ./scripts/setup

# Create admin user
admin_access_token=$(kubectl exec "$REANA_SERVER" -- \
flask reana-admin create-admin-user $email_address)
flask reana-admin create-admin-user --email $email_address --password $password)

# Add token to secrets
kubectl create secret generic "$instance_name"-admin-access-token \
Expand Down

0 comments on commit d0b6b28

Please sign in to comment.