Skip to content
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

Update default values for ACCP #17

Merged
merged 4 commits into from
Feb 3, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update default values for ACCP
afgane committed Jan 28, 2025
commit 3b4c4ac29fea0f94e93612f396f2c29eb87200c8
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.idea/
.venv/
.vscode/
.prettierignore
k3s/outputs/
ansible.cfg
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -62,22 +62,42 @@ If running the playbook on the server itself, there is `inventories/locahost` fi

### Installing Galaxy

Once the inventory file is created, we can run the playbooks to deploy the Kubernetes cluster and the Galaxy instance. The playbook takes the arguments
Once the inventory file is created, we can run the playbooks to deploy the
Kubernetes cluster and the Galaxy instance. The playbook takes the arguments:

- `kube_cloud_provider`: must be one of `gcp`, `aws`, or `openstack`
- `cloud_provider`: must be one of `gcp`, `aws`, or `openstack`
- `chart_values_file`: Optional. Path relative to `values` subfolder containing
values that will be used to configure the Galaxy Helm chart. The default is
`accp.yml`.

```bash
ansible-playbook -i inventories/my-server.ini playbook.yml --extra-vars "kube_cloud_provider=aws" --extra-vars "application=galaxy" --extra-vars "galaxy_api_key=changeme" --extra-vars "[email protected]"
ansible-playbook -i inventories/my-server.ini playbook.yml --extra-vars "cloud_provider=aws" --extra-vars "application=galaxy" --extra-vars "galaxy_api_key=changeme" --extra-vars "[email protected]"
```

Once the playbook completes, the Galaxy instance will be available at `http://<server-ip>/` after a few minutes.

### Adding users

By default, user registration is disabled on the Galaxy instance. To add users, you can use the `bin/add_user.sh` script. The script takes the following arguments:

- `host`: The IP address of the Galaxy server
- `galaxy_api_key`: The API key for the Galaxy admin user
- `email`: The email address of the Galaxy user to be added
- `password`: The password for the Galaxy user
- `username`: The username for the Galaxy user

Run the script with:

```bash
bin/add_user.sh <host> <galaxy_api_key> <email> <password> <username>
```

### Installing Pulsar

The playbook can set up a Pulsar node instead of Galaxy. The invocation process is the same with the only difference being the `application` variable.

```bash
ansible-playbook -i inventories/my-server.ini playbook.yml --extra-vars "kube_cloud_provider=aws" --extra-vars "application=pulsar" --extra-vars "pulsar_api_key=changeme"
ansible-playbook -i inventories/my-server.ini playbook.yml --extra-vars "cloud_provider=aws" --extra-vars "application=pulsar" --extra-vars "pulsar_api_key=changeme"
```


32 changes: 32 additions & 0 deletions bin/add_user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

# Check if all required arguments are provided
if [ "$#" -ne 5 ]; then
echo "Usage: $0 <host> <galaxy_api_key> <email> <password> <username>"
echo "Example: $0 localhost:8080 ADMIN_API_KEY [email protected] userpass username"
exit 1
fi

host="$1"
galaxy_api_key="$2"
email="$3"
password="$4"
username="$5"

json_data=$(cat <<EOF
{
"username": "$username",
"email": "$email",
"password": "$password"
}
EOF
)

curl -s -X POST \
-H "x-api-key: $galaxy_api_key" \
-H "Content-Type: application/json" \
-d "$json_data" \
"http://$host/api/users"

# Add a newline for better formatting
echo
2 changes: 1 addition & 1 deletion bin/init_script.sh
Original file line number Diff line number Diff line change
@@ -24,4 +24,4 @@ cd galaxy-k8s-boot

sed -i "s|extra_server_args=\"--tls-san localhost --disable traefik --v=4\"|extra_server_args=\"--tls-san $(curl -s http://169.254.169.254/latest/meta-data/public-ipv4) --disable traefik --v=4\"|" inventories/localhost

ansible-playbook -i inventories/localhost playbook.yml --extra-vars "kube_cloud_provider=aws" --extra-vars "job_max_cores=$(($(nproc) - $RESERVED_CORES))" --extra-vars "job_max_mem=$(($(free -m | awk '/^Mem:/{print $2}') - $RESERVED_MEM_MB))" --extra-vars "application=$APPLICATION" --extra-vars "galaxy_api_key=$GALAXY_API_KEY" --extra-vars "pulsar_api_key=$PULSAR_API_KEY"
ansible-playbook -i inventories/localhost playbook.yml --extra-vars "cloud_provider=aws" --extra-vars "job_max_cores=$(($(nproc) - $RESERVED_CORES))" --extra-vars "job_max_mem=$(($(free -m | awk '/^Mem:/{print $2}') - $RESERVED_MEM_MB))" --extra-vars "application=$APPLICATION" --extra-vars "galaxy_api_key=$GALAXY_API_KEY" --extra-vars "pulsar_api_key=$PULSAR_API_KEY"
3 changes: 3 additions & 0 deletions galaxy_app.yml
Original file line number Diff line number Diff line change
@@ -47,5 +47,8 @@
k8s:
max_cores: "{{ job_max_cores }}"
max_mem: "{{ job_max_mem }}"
service:
type: "{{ 'LoadBalancer' if cloud_provider == 'gcp' else 'ClusterIP' }}"
port: 80
# postgresql:
# galaxyDatabasePassword: galaxydbpassword
8 changes: 3 additions & 5 deletions playbook.yml
Original file line number Diff line number Diff line change
@@ -12,17 +12,15 @@

- name: Configure Ingress
import_playbook: ingress.yml
when: kube_cloud_provider == "aws" or kube_cloud_provider == "openstack"
when: cloud_provider == "aws" or cloud_provider == "openstack"

- name: Configure storage
import_playbook: storage.yml
vars:
kube_cloud_provider: "{{ kube_cloud_provider }}"

- name: Install Galaxy on {{ kube_cloud_provider }}
- name: Install Galaxy
import_playbook: galaxy_app.yml
vars:
values_file: "values/{{ kube_cloud_provider }}.yml"
values_file: "values/{{ chart_values_file | default('accp.yml') }}"
gxy_admin_users: "{{ galaxy_admin_users | default('') }}"
gxy_api_key: "{{ galaxy_api_key }}"
when: application == "galaxy"
2 changes: 1 addition & 1 deletion setup.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
update_cache: true
become: true
vars:
install_packages: "{{ base_packages + (gcp_packages if kube_cloud_provider == 'gcp' else []) }}"
install_packages: "{{ base_packages + (gcp_packages if cloud_provider == 'gcp' else []) }}"
base_packages:
- python3
- python3-pip
75 changes: 75 additions & 0 deletions values/accp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
ingress:
enabled: true
ingressClassName: ""
canary:
enabled: false
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
hosts:
- host: ~
paths:
- path: /
path: /

persistence:
storageClass: nfs
size: 20Gi

cvmfs:
deployPostInstallFix: true
cvmfscsi:
cache:
local:
enabled: true
pvc:
storageClass: nfs
name: cvmfs-local-cache
alien:
enabled: false
pvc:
name: cvmfs-alien-cache
logVerbosityLevel: 5

postgresql:
persistence:
storageClass: blockstorage

rabbitmq:
persistence:
storageClassName: blockstorage

configs:
galaxy.yml:
galaxy:
require_login: true
show_welcome_with_login: true
allow_user_creation: false

extraFileMappings:
/galaxy/server/static/welcome.html:
applyToWeb: true
applyToNginx: true
content: |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="dist/base.css" type="text/css" />
</head>
<body class="m-0">
<div class="py-4">
<div class="container">
<div class="row mb-4">
<div class="col-md-12">
<h2>Welcome to Galaxy on ACCP</h2>
<p>
Galaxy is an interactive and workflow analysis
platform providing a graphical user interface
for computational tools. This is your own
Galaxy instance running on the ACCP platform
that you can customize and use for your own
research. You can also add others users to
this Galaxy instance via the ACCP portal.
</p>
</div>
</div>
35 changes: 12 additions & 23 deletions values/gcp.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
configs:
galaxy.yml:
galaxy:
admin_users: [email protected],[email protected]
master_api_key: galaxypassword
brand: Google

# Temporary values for the development
jobs:
rules:
tpv_rules_local.yml:
destinations:
k8s:
max_cores: 1
max_mem: 4

service:
type: LoadBalancer
port: 80
ingress:
enabled: false
ingressClassName: ""
@@ -27,11 +8,13 @@ ingress:
hosts:
- host: ~
paths:
- path: /galaxy
path: /galaxy
- path: /
Copy link
Member

@nuwang nuwang Jan 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great to see all this simplification. Should the gcp.yml file be removed as well, since there's no cloud provider specific differentiation?

path: /

persistence:
storageClass: nfs
size: 20Gi

cvmfs:
deployPostInstallFix: true
cvmfscsi:
@@ -46,9 +29,15 @@ cvmfs:
pvc:
name: cvmfs-alien-cache
logVerbosityLevel: 5

postgresql:
persistence:
storageClass: nfs
storageClass: blockstorage

rabbitmq:
persistence:
storageClassName: nfs
storageClassName: blockstorage

service:
type: LoadBalancer
port: 80