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

Docker updates #129

Merged
merged 7 commits into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
33 changes: 0 additions & 33 deletions Dockerfile

This file was deleted.

58 changes: 55 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,65 @@ are currently using PostgreSQL.
Please read the included [chado/INSTALL.Chado.md](./chado/INSTALL.Chado.md) document for instructions on how to
install the Chado schema.

### Running the Docker Image
### Using the Chado Docker Image
#### Locally Build the Docker Image
To build the docker image run the following:
```bash

cd docker
make v<version>
```
Replace `<version>` with a specific version of Chado that you want to use (e.g. `1.31`). This will create a Docker image with the tag: `gmod/chado:<version>` where <version> is the same version used above (e.g. `gmod/chado:1.31`).

#### Using the Chado Docker
You can start and work within the Chado container by using the following command.
```bash
docker run -it gmod/chado:<version>
```
Replace `<version>` with the specific version of Chado that you want to use (e.g. `1.31`). This will start the PostgreSQL server and give you access to a bash terminal.

As a test, you can run the `flyway info` command after starting the container:

```bash
flyway info
```

You can explore the Chado tables using the `psql` command in the following way:

docker build -t chado .
docker run -it -d chado
```bash
psql -U postgres -h localhost -d chado
```
You will be prompted for a password. The default password is `chadotest`

##### Testing a Pull Request
You can test any pull request or other Git branch of Chado by navigating to the Chado directory in the image and changing the branch:
```bash
cd Chado/chado
git checkout <branch>
```
If the branch has any FlyWay migrations you can test those by running these flyway commans:

Use this command to see what needs to be applied
```bash
flyway info
```

For testing of a PR you can set the baseline to the current installation of Chado provided by the image:
```bash
flyway baseline
```

To update Chado you can apply the Flyway migrations:
```bash
flyway migrate
```

As long as no errors occured you will see success for all updates:

```bash
flyway info
```



## Chado Support
Expand Down
45 changes: 45 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
FROM ubuntu:20.04
MAINTAINER Scott Cain <[email protected]>

RUN apt-get update

#for some reason, this has to be installed by itself
RUN apt-get install -y tzdata

RUN apt-get install -y apt-utils

RUN apt-get install -y wget \
unzip \
git \
make \
gcc \
vim \
uuid-dev

RUN apt-get install -y postgresql-all

RUN cd /usr/local \
&& wget -qO- https://repo1.maven.org/maven2/org/flywaydb/flyway-commandline/8.5.2/flyway-commandline-8.5.2-linux-x64.tar.gz | tar xvz \
&& ln -s `pwd`/flyway-8.5.2/flyway /usr/local/bin

ARG CHADO_BRANCH=${CHADO_BRANCH}
ARG CHADO_VERSION=${CHADO_VERSION}

RUN cd / \
&& git clone https://github.com/GMOD/Chado.git \
&& cd Chado \
&& git checkout ${CHADO_BRANCH}

RUN /etc/init.d/postgresql start \
&& su -c "createdb chado" - postgres \
&& su -c "psql chado < /Chado/chado/schemas/${CHADO_VERSION}/default_schema.sql" - postgres \
&& su -c "psql -c \"ALTER USER postgres PASSWORD 'chadotest';\"" - postgres \
&& /etc/init.d/postgresql stop;

ADD flyway.conf /root/flyway.conf
ADD entrypoint.sh entrypoint.sh
ADD motd /etc/motd

RUN echo '[ ! -z "$TERM" -a -r /etc/motd ] && cat /etc/issue && cat /etc/motd' >> /etc/bash.bashrc

ENTRYPOINT ["sh", "entrypoint.sh"]
2 changes: 2 additions & 0 deletions docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/etc/init.d/postgresql start
/bin/bash
6 changes: 6 additions & 0 deletions docker/flyway.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
flyway.url=jdbc:postgresql://localhost:5432/chado
flyway.user=postgres
flyway.password=chadotest
flyway.schemas=public
flyway.locations=filesystem:/Chado
flyway.validateOnMigrate=false
8 changes: 8 additions & 0 deletions docker/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
all: v1.31

v1.31:
docker build \
-t gmod/chado:1.31 \
--build-arg CHADO_BRANCH=1.31-release \
--build-arg CHADO_VERSION=1.31 \
.
10 changes: 10 additions & 0 deletions docker/motd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
________ _____ ____ ____
/ ____/ / / / | / __ \/ __ \
/ / / /_/ / /| | / / / / / / /
/ /___/ __ / ___ |/ /_/ / /_/ /
\____/_/ /_/_/ |_/_____/\____/

This Chado docker image uses default security settings for
PostgreSQL and has a hard-coded password for the postgres
user. Do not use this image for a production service without
first correcting