-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinvenio_rdm_machine.bash
More file actions
executable file
·98 lines (80 loc) · 2.67 KB
/
invenio_rdm_machine.bash
File metadata and controls
executable file
·98 lines (80 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
INSTANCE_NAME="invenio-rdm"
#
# This script generates a "RDM Machine" using Multipass.
#
# Multipass is launching a Ubuntu 22.04 LTS machine (jammy) as that
# works with the current release of RDM (v11). Not sure the specs for
# the upcoming v12 release yet (expecting an announcement at
# Open Repositories, June, 2024.
#
echo "Launch ${INSTANCE_NAME}"
if ! multipass launch jammy \
--verbose \
--name "${INSTANCE_NAME}" \
--memory 8G \
--disk 150G \
--cpus 2 \
--cloud-init invenio-rdm.yaml; then
echo
echo "Failed to create ${INSTANCE_NAME}."
echo
exit 1
fi
if ! multipass info "${INSTANCE_NAME}"; then
echo
echo 'failed to create ${INSTANCE_NAME}, aborting'
echo
exit 1
fi
echo "Installing RDM required software"
if ! multipass exec "${INSTANCE_NAME}" -- /usr/local/bin/install_rdm_nvm.bash; then
echo
echo 'WARNING: failed to to install nvm'
echo 'Access your VM and run /usr/local/bin/install_rdm_nvm.bash'
echo 'Access your VM and run /usr/local/bin/install_rdm_node.bash'
echo
exit 1
fi
if ! multipass exec "${INSTANCE_NAME}" -- /usr/local/bin/install_rdm_node.bash; then
echo
echo 'WARNING: failed to to install, nvm, nodejs and npm'
echo 'Access your VM and run /usr/local/bin/install_rdm_node.bash'
echo
exit 1
fi
if ! multipass restart "${INSTANCE_NAME}"; then
# Finally we need to restart the machine.
echo
echo 'WARNING: restart failed, check logs on VM restart'
echo
exit 1
fi
# FIXME: This is where I would want to map the instance name to the
# RDM instance and run setup_rdm_instance.bash remotely passing in the
# Instance name and version id.
RDM_IP_ADDRESS=$(multipass list | grep "${INSTANCE_NAME}" | cut -c 43-58)
cat <<EOT
Welcome to the RDM Machine. You can access if with
multipass shell ${INSTANCE_NAME}
There are some additional steps to take to get RDM working
on your virtual machine. If you want a vanilla instance
run
setup_rdm_instance.bash INSTANCE_NAME v11.0
If you want to run a copy of CaltechAUTHORS run
setup_rdm_caltechauthors.bash
Additional scripts are available for experimentation and
development of your custom RDM instance. To get the list of
scripts run
menu_of_scripts.bash
You can grant yourself SSH access with the following
command when you connect using multipass shell.
ssh-keygen
curl -L -o - https://github.com/${USER}.keys \\
>>.ssh/authorized_keys
This is handy so you can setup port forward for local
services like.
This is handy so you can setup port forward for local
services like.
ssh -L 8011:localhost:8011 ubuntu@${RDM_IP_ADDRESS}
EOT