-
Notifications
You must be signed in to change notification settings - Fork 133
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
[WIP] Instructions for using compose setup with minikube. #313
base: dev
Are you sure you want to change the base?
Changes from all commits
254a0d5
93788a3
b805504
a7400b8
fde887c
191c59f
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
version: '2' | ||
services: | ||
# proftpd container | ||
proftpd: | ||
galaxy-proftpd: | ||
# build: galaxy-proftpd | ||
image: quay.io/galaxy/proftpd:compose | ||
environment: | ||
|
@@ -15,8 +15,8 @@ services: | |
- proftpd_passive_port_high=30010 | ||
container_name: galaxy-proftpd | ||
hostname: galaxy-proftpd | ||
volumes: | ||
- ./galaxy-storage/ftp:/export/ftp | ||
volumes_from: | ||
- galaxy-web | ||
expose: | ||
- 21 | ||
- 22 | ||
|
@@ -25,11 +25,13 @@ services: | |
- "8022:22" | ||
- "30000-30010:30000-30010" | ||
restart: always | ||
labels: | ||
kompose.service.type: nodeport | ||
|
||
# Using the official postgres image. This needs to be populated by calling | ||
# docker-compose run galaxy install_db.sh | ||
# on first run | ||
postgres: | ||
galaxy-postgres: | ||
# image: postgres | ||
# This comes with an initialization to quickly populate the database on first start | ||
# build: galaxy-postgres | ||
|
@@ -50,21 +52,23 @@ services: | |
ports: | ||
- "5050:5050" | ||
links: | ||
- postgres | ||
- galaxy-postgres | ||
volumes: | ||
- ./pgadmin:/pgadmin | ||
restart: unless-stopped | ||
labels: | ||
kompose.service.type: nodeport | ||
|
||
|
||
# slurm container | ||
slurm: | ||
galaxy-slurm: | ||
# build: galaxy-slurm | ||
image: quay.io/galaxy/slurm:compose | ||
environment: {} | ||
container_name: galaxy-slurm | ||
hostname: galaxy-slurm | ||
volumes: | ||
- ./galaxy-storage/:/export | ||
volumes_from: | ||
- galaxy-web | ||
restart: always | ||
|
||
# This container initializes the galaxy export. | ||
|
@@ -73,10 +77,8 @@ services: | |
image: quay.io/bgruening/galaxy-init:compose | ||
container_name: galaxy-init | ||
hostname: galaxy-init | ||
volumes: | ||
# This is the directory where all your files from Galaxy will be stored | ||
# on your host system | ||
- ./galaxy-storage/:/export/ | ||
volumes_from: | ||
- galaxy-web | ||
|
||
# This container provides the galaxy uwsgi webhandlers, job handlers, nginx | ||
galaxy-web: | ||
|
@@ -99,14 +101,15 @@ services: | |
- [email protected] | ||
- GALAXY_CONFIG_MASTER_API_KEY=HSNiugRFvgT574F43jZ7N9F3 | ||
container_name: galaxy-web | ||
hostname: galaxy | ||
ports: | ||
- "8080:80" # nginx | ||
volumes: | ||
# This is the directory where all your files from Galaxy will be stored | ||
# on your host system | ||
- ./galaxy-storage/:/export/ | ||
privileged: True | ||
labels: | ||
kompose.service.type: nodeport | ||
|
||
# Use the monolith galaxy container instead | ||
# galaxy: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env python | ||
|
||
# Install kompose (e.g. brew install kompose). | ||
# Install minikube (e.g. brew install minikube). | ||
# $ minikube start # Build a k8 cluster in a VM. | ||
# $ eval $(minikube docker-env) # Target Docker commands at the VM's Docker host. | ||
# $ cd ..; bash buildlocal.sh; cd k8 # Build Docker containers required for k8 setup. | ||
# $ python convert.py # Execute this wrapper around kompose to build native k8 artifacts. | ||
# $ kompose -f docker-compose-for-kompose.yml up | ||
|
||
import os | ||
import subprocess | ||
import yaml | ||
|
||
DIRECTORY = os.path.abspath(os.path.dirname(__file__)) | ||
COMPOSE_TARGET = os.path.abspath(os.path.join(DIRECTORY, "..", "docker-compose.yml")) | ||
KOMPOSE_TARGET = os.path.join(DIRECTORY, "docker-compose-for-kompose.yml") | ||
|
||
|
||
def main(): | ||
with open(COMPOSE_TARGET, "r") as f: | ||
raw_compose_def = yaml.load(f) | ||
|
||
_hack_for_kompose(raw_compose_def) | ||
with open(KOMPOSE_TARGET, "w") as f: | ||
yaml.dump(raw_compose_def, f) | ||
|
||
subprocess.check_call(["kompose", "-f", KOMPOSE_TARGET, "convert"]) | ||
|
||
|
||
def _hack_for_kompose(raw_compose_def): | ||
ftp_ports = raw_compose_def["services"]["galaxy-proftpd"]["ports"] | ||
del ftp_ports[2] | ||
for i in range(10): | ||
# Replace "30000-30010:30000-30010" with individual entries. | ||
ftp_ports.append("%d:%d" % (30000 + i, 30000 + i)) | ||
|
||
# pgadmin can run without volumes and gets permission errors if not started this way in | ||
# minikube. | ||
del raw_compose_def["services"]["pgadmin4"]["volumes"] | ||
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. We should remove the volume than from compose if it's not needed. 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. It is useful in the compose setup I'd imagine because it persists the configuration. It just didn't work when I tried under k8 - I think it could be made to though we just need to fix the permission errors. 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. Strange I'm hitting now the same problem in a normal compose setup :( 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. Maybe the image got updated? 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 checked that, also an older one from 2 month ago does not work, very strange. Same permission errors that you got. |
||
|
||
services = raw_compose_def["services"] | ||
for service_name in list(services.keys()): | ||
service_def = services[service_name] | ||
if "hostname" in service_def: | ||
hostname = service_def["hostname"] | ||
# These need to be same for Kompose it seems | ||
if hostname != service_name: | ||
services[hostname] = service_def | ||
del services[service_name] | ||
for service in services.values(): | ||
links = service.get("links", []) | ||
if service_name in links: | ||
links.remove(service_name) | ||
links.append(hostname) | ||
|
||
del service_def["hostname"] | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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.
Ah, interesting!