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

sed defined to enable running bulk load under modern perl #12

Merged
merged 14 commits into from
Feb 23, 2024
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test

concurrency:
group: ci-${{ github.head_ref }}
cancel-in-progress: true

on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
paths:
- *.sh
- *.sql
- Dockerfile

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build container
run: |
docker build -t chado .

- name: Test Running Container
run: |
container_id=$(docker run -it -e INSTALL_YEAST_DATA=1 -d --name chado chado)

while true; do
date

# Check that it's ready to run
start_count=$(docker logs $container_id | grep 'database system is ready to accept connections' | wc -l)
if (( start_count > 1 )); then
break
fi

# If it's not output some logs
docker logs $container_id | tail

# And wait a bit
sleep 5
done

# Check that yeast is, in fact loaded.
docker exec $container_id psql -U postgres -c "select * from organism where common_name = 'yeast' " | grep '1 row'

# Dump something useful
docker exec $container_id psql -U postgres -c "select type_id, count(*) from feature group by type_id ;"

docker kill $container_id
docker rm -f $container_id

# Done!
exit 0
19 changes: 11 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM postgres:9.5
FROM postgres:16

ENV DEBIAN_FRONTEND=noninteractive \
CHADO_DB_NAME=postgres \
Expand All @@ -9,7 +9,7 @@ ENV DEBIAN_FRONTEND=noninteractive \
POSTGRES_PASSWORD=postgres \
GMOD_ROOT=/usr/share/gmod/ \
PGDATA=/var/lib/postgresql/data/ \
SCHEMA_URL=https://github.com/erasche/chado-schema-builder/releases/download/1.31-jenkins61/chado-1.31.sql.gz \
SCHEMA_URL=https://github.com/galaxy-genome-annotation/chado-schema-builder/releases/download/1.31-build2022-12-03/chado-1.31.sql.gz \
INSTALL_CHADO_SCHEMA=1 \
INSTALL_YEAST_DATA=0

Expand All @@ -18,19 +18,18 @@ ENV DEBIAN_FRONTEND=noninteractive \
RUN apt-get -qq update && \
apt-get install --no-install-recommends -y build-essential \
libpng-dev zlib1g zlib1g-dev build-essential make libpq-dev curl \
xsltproc netcat wget ca-certificates libperlio-gzip-perl \
xsltproc wget ca-certificates libperlio-gzip-perl \
libcapture-tiny-perl libtest-differences-perl libperlio-gzip-perl \
libdevel-size-perl libdbi-perl libjson-perl libjson-xs-perl libheap-perl \
libhash-merge-perl libdbd-pg-perl libio-string-perl libtest-most-perl \
libarray-compare-perl libconvert-binary-c-perl libgraph-perl \
libgraphviz-perl libsoap-lite-perl libsvg-perl libsvg-graph-perl \
libset-scalar-perl libsort-naturally-perl libxml-sax-perl libxml-twig-perl \
libxml-writer-perl libyaml-perl libgd2-xpm-dev perl-doc && \
libxml-writer-perl libyaml-perl perl-doc libgd-dev nano vim-tiny netcat-openbsd && \
apt-get autoremove -y && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

# Some have to be forced.
# But most install just fine
# Modifying /docker-entrypoint.sh because of https://github.com/docker-library/postgres/pull/440
RUN mkdir -p $GMOD_ROOT $PGDATA && \
curl -L http://cpanmin.us | perl - App::cpanminus && \
cpanm --force --notest Test::More Heap::Simple Heap::Simple::XS DBIx::DBStag GO::Parser && \
Expand All @@ -44,8 +43,7 @@ RUN mkdir -p $GMOD_ROOT $PGDATA && \
&& wget https://github.com/GMOD/Chado/archive/master.tar.gz -O /tmp/master.tar.gz \
&& cd / && tar xvfz /tmp/master.tar.gz \
&& mv /Chado-master /chado \
&& rm -f /tmp/master.tar.gz \
&& sed -i "s|listen_addresses=''|listen_addresses='localhost'|" /docker-entrypoint.sh
&& rm -f /tmp/master.tar.gz

WORKDIR /chado/chado/
# https://github.com/docker-library/postgres/blob/a82c28e1c407ef5ddfc2a6014dac87bcc4955a26/9.4/docker-entrypoint.sh#L85
Expand All @@ -57,7 +55,12 @@ RUN perl Makefile.PL GMOD_ROOT=/usr/share/gmod/ DEFAULTS=1 RECONFIGURE=1 && \
wget --quiet http://downloads.yeastgenome.org/curation/chromosomal_feature/saccharomyces_cerevisiae.gff.gz -O saccharomyces_cerevisiae.gff.gz && \
gunzip -c saccharomyces_cerevisiae.gff.gz > saccharomyces_cerevisiae.gff && \
sed -i s'/%20/ /g' saccharomyces_cerevisiae.gff && \
chown -R postgres:postgres /chado/chado/
chown -R postgres:postgres /chado/chado/ && \
sed -i -r 's/defined\(@_\)/@_/g' /usr/local/share/perl/*/Bio/GMOD/DB/Adapter.pm && \
sed -i "s|listen_addresses=''|listen_addresses='localhost'|" /usr/local/bin/docker-entrypoint.sh

# The sed is required because the gmod_add_organism script assumes a network
# connection rather than socke.

COPY load_schema.sh /docker-entrypoint-initdb.d/00-load_schema.sh
COPY load_yeast.sh /docker-entrypoint-initdb.d/01-load_yeast.sh
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Docker Chado Container [![Docker Repository on Quay](https://quay.io/repository/galaxy-genome-annotation/chado/status "Docker Repository on Quay")](https://quay.io/repository/galaxy-genome-annotation/chado)
# Docker Chado Container [![Docker Repository on Quay](https://quay.io/repository/galaxy-genome-annotation/chado/status "Docker Repository on Quay")](https://quay.io/repository/galaxy-genome-annotation/chado) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3540729.svg)](https://doi.org/10.5281/zenodo.3540729)

[![DOI](https://zenodo.org/badge/10899/erasche/docker-chado.svg)](https://zenodo.org/badge/latestdoi/10899/erasche/docker-chado)

Built on top of a standard postgres:9.5 container, the Chado container provides the Chado schema loaded with all 5 standard ontologies.
Built on top of a standard postgres:16 container, the Chado container provides the Chado schema loaded with all 5 standard ontologies.

## Launching the Container

Expand Down Expand Up @@ -56,18 +54,21 @@ docker run -d --name chado-yeast -e INSTALL_YEAST_DATA=1 quay.io/galaxy-genome-a

## Using the Container in `docker-compose.yml`

It is strongly, strongly recommended that you pin your images to a [specific tag](https://quay.io/repository/galaxy-genome-annotation/chado?tab=tags) of this repository. I have intentionally and unintentionally broken the `:latest` images before.
It is strongly, strongly recommended that you pin your images to a [specific tag](https://quay.io/repository/galaxy-genome-annotation/chado?tab=tags) of this repository. I have unintentionally broken the `:latest` images before.

E.g.

```
image: quay.io/galaxy-genome-annotation/chado:1.31-jenkins61-pg9.5
```

Given that I as the developer have no easy way to communicate to you as the end user that breaking changes have been made (and keeping backwards compatability is prohibitve for a 1-person team..., sorry!), it is best to pin and read the changelog before upgrading.
Given that we, as the developers, have no easy way to communicate to you as the end user that breaking changes have been made (and keeping backwards compatability is prohibitve for a small team..., sorry!), it is best to pin and read the changelog before upgrading.

# Changelog

- 2024-02-22
- @hexylena updated postgres from 9 to 16
- @hexylena rebuilt with latest CSB data which is still quite old.
hexylena marked this conversation as resolved.
Show resolved Hide resolved
- 2021-04-01
- @mboudet fixed the missing yeast genome
- 2017-02-21
Expand Down