-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Create Dockerfile for Hets (Server) (#1868)
* Add a basic Dockerfile * Update the packages installed with Docker * Fix the package sources and binary name for Docker setup * Update Dockerfile to use Ubuntu 18.04 and remove the ppa workaround * Ignore Hets-lib in Docker directory * Create a docker compose setup for hets server * WIP Hets connection to database in Docker * Container now correctly addresses database * Remvoe workaround for Hets-Libs * Temporarily remove of Postgres bind mount * Container now in correct network configuration * Fix typo in database configuration * Hets is now a standalone container * Removes comment * Use /data/ as the working directory * Add a workaround for the new hets-server binary (2019-06-19) * Clean-up of unused docker files * Use docker secret to persist postgres password * Remove Workaround for old hets binary and use dynamic IP address for hostnames * Use a docker volume instead of a bind mount for persistend postgres data * Remove whitespace in gitignore
- Loading branch information
1 parent
60cc73d
commit 00f0243
Showing
3 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM ubuntu:18.04 | ||
|
||
ENV LANG C.UTF-8 | ||
|
||
RUN apt-get update && apt-get install software-properties-common -y | ||
RUN apt-add-repository ppa:hets/hets | ||
RUN apt-get update && apt-get install -y hets-server hets-libs libatomic1 && rm -rf /var/lib/apt/lists/* | ||
|
||
RUN mkdir /data/ | ||
|
||
WORKDIR /data/ | ||
|
||
COPY docker-entrypoint.sh /usr/local/bin/ | ||
|
||
ENTRYPOINT [ "/usr/local/bin/docker-entrypoint.sh" ] | ||
|
||
CMD ["hets-server", "--server"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
version: '3.7' | ||
services: | ||
hets: | ||
image: spechub2/hets:latest | ||
command: hets-server --server --database-config=/etc/hets_db_postgresql.yml --database-subconfig=production | ||
ports: | ||
- "8000:8000" | ||
environment: | ||
POSTGRES_HOST: db_postgresql | ||
POSTGRES_PASSWORD: /run/secrets/db_password | ||
POSTGRES_PORT: 5432 | ||
POSTGRES_USERNAME: /run/secrets/db_username | ||
volumes: | ||
- type: bind | ||
source: ./hets_data/ | ||
target: /data/ | ||
read_only: true | ||
networks: | ||
db: | ||
secrets: | ||
- db_password | ||
- db_username | ||
db_postgresql: | ||
image: "postgres:11-alpine" | ||
environment: | ||
POSTGRES_DB: hets | ||
POSTGRES_PASSWORD_FILE: /run/secrets/db_password | ||
expose: | ||
- "5432" | ||
networks: | ||
db: | ||
volumes: | ||
- type: volume | ||
source: postgres_data | ||
target: /var/lib/postgresql/data/ | ||
secrets: | ||
- db_password | ||
|
||
networks: | ||
db: | ||
driver: "bridge" | ||
ipam: | ||
driver: default | ||
|
||
secrets: | ||
db_password: | ||
file: ./secrets/db_password.txt | ||
db_username: | ||
file: ./secrets/db_username.txt | ||
|
||
volumes: | ||
postgres_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ "$1" = 'hets-server' ] && [ "$3" = "--database-config=/etc/hets_db_postgresql.yml" ]; then | ||
echo "default: &default | ||
adapter: postgresql | ||
username: $(cat $POSTGRES_USERNAME) | ||
password: $(cat $POSTGRES_PASSWORD) | ||
host: $POSTGRES_HOST | ||
port: $POSTGRES_PORT | ||
pool: 10 | ||
production: | ||
<<: *default | ||
database: hets" > /etc/hets_db_postgresql.yml | ||
fi | ||
|
||
exec "$@" |