-
Notifications
You must be signed in to change notification settings - Fork 28
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
Auto import, figure, wheel, etc. #21
base: master
Are you sure you want to change the base?
Changes from all commits
c5767b5
c6ad6bc
2267456
e061111
b0274b6
eb93998
2846ca9
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
REPO=test | ||
PREFIX=test | ||
TCP_PORT= | ||
SSL_PORT=4064: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
FROM centos:centos7 | ||
ARG CREATED=unknown | ||
ARG REVISION=unknown | ||
LABEL maintainer="[email protected]" | ||
LABEL org.opencontainers.image.created="unknown" | ||
LABEL org.opencontainers.image.revision="unknown" | ||
LABEL org.opencontainers.image.source="https://github.com/openmicroscopy/omero-server-docker" | ||
LABEL org.opencontainers.image.created="${CREATED}" | ||
LABEL org.opencontainers.image.revision="${REVISION}" | ||
LABEL org.opencontainers.image.source="https://github.com/ome/omero-server-docker" | ||
|
||
RUN mkdir /opt/setup | ||
WORKDIR /opt/setup | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
version: "3.3" | ||
# | ||
# Compose for the development of this docker image | ||
# | ||
services: | ||
database: | ||
image: "postgres:9.6" | ||
environment: | ||
- POSTGRES_USER=omero | ||
- POSTGRES_DB=omero | ||
- POSTGRES_PASSWORD=omero | ||
networks: | ||
- omero | ||
volumes: | ||
- "database:/var/lib/postgresql/data" | ||
|
||
minimal: | ||
image: ${REPO}/omero-server-minimal:${PREFIX} | ||
build: | ||
context: . | ||
args: | ||
- OMEGO_ADDITIONAL_ARGS="--ci=https://merge-ci.openmicroscopy.org/jenkins/" | ||
- OMERO_VERSION="OMERO-build" | ||
entrypoint: "true" | ||
|
||
omero: | ||
image: ${REPO}/omero-server:${PREFIX} | ||
build: | ||
context: extended | ||
args: | ||
- PARENT_IMAGE=${REPO}/omero-server-minimal:${PREFIX} | ||
environment: | ||
- CONFIG_omero_db_host=database | ||
- CONFIG_omero_db_user=omero | ||
- CONFIG_omero_db_pass=omero | ||
- CONFIG_omero_db_name=omero | ||
- ROOTPASS=omero | ||
networks: | ||
- omero | ||
ports: | ||
- "${TCP_PORT}4063" | ||
- "${SSL_PORT}4064" | ||
volumes: | ||
- "omero:/OMERO" | ||
- "./:/src:ro" | ||
depends_on: | ||
- minimal | ||
|
||
networks: | ||
omero: | ||
|
||
volumes: | ||
database: | ||
omero: |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
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. What does 95 mean in the name? 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. All the startup scripts are numbered to be run in order. "95" means "pretty close to the end but give the user a few slots (96-98) before the final script (99) runs. 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. Thanks |
||
|
||
set -eu | ||
|
||
omero=/opt/omero/server/OMERO.server/bin/omero | ||
cd /opt/omero/server | ||
echo "Running importer in the background" | ||
sh -c "/tools/wait-on-login && /tools/import-all" & | ||
echo "Starting OMERO.server" | ||
exec $omero admin start --foreground |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ARG PARENT_IMAGE=openmicroscopy/omero-server-minimal:latest | ||
FROM ${PARENT_IMAGE} | ||
|
||
USER root | ||
ADD wait-on-login import-all /tools/ | ||
ADD 95-background.sh /startup/ | ||
RUN mkdir /import && touch /import/test.fake | ||
USER omero-server |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
|
||
import atexit | ||
import os | ||
import socket | ||
import sys | ||
import time | ||
|
||
|
||
OMERO_DIST = os.environ.get("OMERO_DIST", "/opt/omero/server/OMERO.server") | ||
if not os.path.exists(OMERO_DIST): | ||
OMERO_DIST = "/opt/omero/web/OMERO.web" | ||
|
||
sys.path.append("/".join([OMERO_DIST, "lib/python"])) | ||
import omero | ||
from omero.cli import cli_login | ||
from omero.util.import_candidates import as_dictionary | ||
|
||
|
||
OMERO_HOST = os.environ.get("OMERO_HOST", "localhost") | ||
OMERO_USER = os.environ.get("OMERO_USER", "root") | ||
OMERO_PASS = os.environ.get("OMERO_PASS", "omero") | ||
OMERO_PORT = int(os.environ.get("OMERO_PORT", "4064")) | ||
SLEEP_TIME = int(os.environ.get("SLEEP_TIME", "30")) | ||
|
||
|
||
with cli_login("-s", OMERO_HOST, | ||
"-u", OMERO_USER, | ||
"-p", str(OMERO_PORT), | ||
"-w", OMERO_PASS) as cli: | ||
|
||
for k, v in as_dictionary(("/import",)).items(): | ||
cli.onecmd(["import", k]) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env python | ||
|
||
import atexit | ||
import os | ||
import socket | ||
import sys | ||
import time | ||
|
||
|
||
OMERO_DIST = os.environ.get("OMERO_DIST", "/opt/omero/server/OMERO.server") | ||
if not os.path.exists(OMERO_DIST): | ||
OMERO_DIST = "/opt/omero/web/OMERO.web" | ||
|
||
sys.path.append("/".join([OMERO_DIST, "lib/python"])) | ||
import omero | ||
|
||
OMERO_HOST = os.environ.get("OMERO_HOST", "localhost") | ||
OMERO_USER = os.environ.get("OMERO_USER", "root") | ||
OMERO_PASS = os.environ.get("OMERO_PASS", "omero") | ||
OMERO_PORT = int(os.environ.get("OMERO_PORT", "4064")) | ||
SLEEP_TIME = int(os.environ.get("SLEEP_TIME", "30")) | ||
|
||
|
||
def end(): | ||
print "travis_fold:end:wait-on-login" | ||
|
||
atexit.register(end) | ||
|
||
print "travis_fold:start:wait-on-login" | ||
|
||
|
||
def port_is_open(): | ||
rc = socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect_ex((OMERO_HOST, OMERO_PORT)) | ||
return (rc == 0) | ||
|
||
|
||
for x in range(1, 31): | ||
if port_is_open(): | ||
break | ||
else: | ||
time.sleep(1.0) | ||
print "waiting on port: #%s" % x | ||
|
||
|
||
# HACK: This 'ready' detection is still not working. Adding a hard sleep to be safe. | ||
print "Sleeping for", SLEEP_TIME | ||
time.sleep(SLEEP_TIME) | ||
|
||
# Second: try to login | ||
for x in range(1, 6): | ||
# https://trello.com/c/rPstbt4z/216-open-ssl-110 | ||
client = omero.client(OMERO_HOST, OMERO_PORT) | ||
try: | ||
client.createSession(OMERO_USER, OMERO_PASS) | ||
break | ||
except: | ||
print "Login attempt %s failed. Trying again in %s seconds" % (x, x+1) | ||
time.sleep(x+1) | ||
finally: | ||
client.__del__() |
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.
shouldn't it be moved to 10?
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.
Eventually, definitely. I'd suggest handling that across all repositories once the upgrade docs are in place.