-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds an image containing its own PostgreSQL service.
- Loading branch information
1 parent
5c5338d
commit 516ef77
Showing
5 changed files
with
203 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,105 @@ | ||
FROM ubuntu:18.04 | ||
MAINTAINER DocMarty84 <[email protected]> | ||
|
||
# Reconfigure locales to use UTF-8 encoding | ||
RUN set -x; \ | ||
apt-get update -qq && \ | ||
apt-get install -y --no-install-recommends -qq locales | ||
|
||
RUN set -x; \ | ||
dpkg-reconfigure -fnoninteractive locales && \ | ||
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/g' /etc/locale.gen && \ | ||
locale-gen en_US.UTF-8 && \ | ||
/usr/sbin/update-locale LANG=en_US.UTF-8 | ||
ENV LC_ALL en_US.UTF-8 | ||
|
||
# Install apt dependencies | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
RUN set -x; \ | ||
apt-get update -qq && \ | ||
apt-get install -y --no-install-recommends -qq \ | ||
adduser \ | ||
build-essential \ | ||
ffmpeg \ | ||
libtag1-dev \ | ||
lsb-base \ | ||
mediainfo \ | ||
postgresql-common \ | ||
python3-babel \ | ||
python3-chardet \ | ||
python3-dateutil \ | ||
python3-decorator \ | ||
python3-dev \ | ||
python3-docutils \ | ||
python3-feedparser \ | ||
python3-gevent \ | ||
python3-html2text \ | ||
python3-jinja2 \ | ||
python3-libsass \ | ||
python3-lxml \ | ||
python3-mako \ | ||
python3-mock \ | ||
python3-passlib \ | ||
python3-pil \ | ||
python3-pip \ | ||
python3-polib \ | ||
python3-psutil \ | ||
python3-psycopg2 \ | ||
python3-pydot \ | ||
python3-pyldap \ | ||
python3-pyparsing \ | ||
python3-pypdf2 \ | ||
python3-qrcode \ | ||
python3-reportlab \ | ||
python3-requests \ | ||
python3-setuptools \ | ||
python3-tz \ | ||
python3-vatnumber \ | ||
python3-vobject \ | ||
python3-werkzeug \ | ||
python3-wheel \ | ||
python3-xlsxwriter \ | ||
python3-yaml \ | ||
python3-zeep \ | ||
wget && \ | ||
apt-get clean -qq | ||
|
||
# Install pip dependencies | ||
RUN set -x; \ | ||
pip3 install \ | ||
mutagen==1.43.0 \ | ||
pytaglib==1.4.5 \ | ||
num2words==0.5.6 \ | ||
webvtt-py==0.4.2 | ||
|
||
# PostgreSQL install: deactivate automatic cluster creation since it will created at runtime in a | ||
# mounted location. Copied from https://github.com/docker-library/postgres/tree/master/10 | ||
RUN set -x; \ | ||
sed -ri 's/#(create_main_cluster) .*$/\1 = false/' /etc/postgresql-common/createcluster.conf && \ | ||
apt-get install -y --no-install-recommends -qq \ | ||
postgresql \ | ||
postgresql-client | ||
|
||
# Set up user and mount point | ||
RUN set -x; \ | ||
useradd -m koozic && \ | ||
mkdir -p /mnt/host && \ | ||
chown -R koozic /mnt/host | ||
|
||
# Install KooZic | ||
RUN set -x; \ | ||
v=v3.0.0 && \ | ||
wget -q https://github.com/DocMarty84/koozic/releases/download/${v}/koozic-${v}.tar.gz && \ | ||
tar xfz koozic-*.tar.gz && \ | ||
rm -rf koozic-*.tar.gz | ||
RUN set -x; \ | ||
mv koozic /usr/local/ && \ | ||
chown -R koozic /usr/local/koozic | ||
|
||
# Copy entrypoint script | ||
COPY ./entrypoint.sh / | ||
|
||
# Expose KooZic services | ||
EXPOSE 8069 8072 | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
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,23 @@ | ||
This folder provides a basic Docker configuration using Docker-compose in order to run a fully | ||
functional KooZic installation. It includes: | ||
- Ubuntu 18.04 | ||
- KooZic v3 | ||
- PostgreSQL 10 | ||
|
||
# Set up containers | ||
|
||
1. Install Docker Compose following the | ||
[official instructions](https://docs.docker.com/compose/) | ||
2. Build: | ||
``` | ||
docker-compose build | ||
``` | ||
3. Configure: | ||
Edit `docker-compose.yml` and replace `/music` by the music folder you want to share. | ||
4. Run: | ||
``` | ||
docker-compose up -d | ||
``` | ||
|
||
KooZic should now be available at [http://localhost:8069](http://localhost:8069). | ||
Don't forget to add `/mnt/host` in the Folders section. |
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,4 @@ | ||
# Ignore everything in this directory | ||
* | ||
# Except this file | ||
!.gitignore |
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,25 @@ | ||
version: '3.7' | ||
|
||
services: | ||
|
||
app: | ||
container_name: koozic_app | ||
restart: always | ||
|
||
# Pull the pre-built image from the server: | ||
#image: docmarty84/koozic | ||
# Build the image locally (useful to customize the entrypoint.sh file): | ||
build: . | ||
image: koozic_app:latest | ||
|
||
# Change '/music' to the actual location of your music. | ||
volumes: | ||
- koozic_app:/home/koozic/.local | ||
- ./db:/var/lib/postgresql/10/main/ | ||
- /music:/mnt/host:ro | ||
ports: | ||
- 8069:8069 | ||
- 8072:8072 | ||
|
||
volumes: | ||
koozic_app: |
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,46 @@ | ||
#!/bin/bash | ||
|
||
# Create PostgreSQL cluster | ||
if [[ ! -f "/etc/postgresql/10/main/postgresql.conf" ]] | ||
then | ||
pg_createcluster 10 main --start | ||
sed -i 's/5432/54321/g' /etc/postgresql/10/main/postgresql.conf | ||
cp /etc/postgresql/10/main/*.conf /var/lib/postgresql/10/main/ | ||
fi | ||
|
||
# Restart PostgreSQL and create koozic user | ||
service postgresql restart | ||
sleep 5 | ||
su - postgres -c "createuser -s koozic" | ||
|
||
# Give to koozic user the right to write in app volume | ||
chown -R koozic /home/koozic/.local | ||
|
||
# Initialize db (odoo automatically detects if db is already initialized) | ||
echo "KooZic init process starting" | ||
su - koozic -c "/usr/local/koozic/odoo-bin \ | ||
-d koozic-v3 \ | ||
--db_port=54321 \ | ||
-u oomusic,oovideo \ | ||
--without-demo=all \ | ||
--stop-after-init \ | ||
--logfile /home/koozic/.local/koozic.log \ | ||
--log-level=warn" | ||
echo "KooZic init process complete" | ||
|
||
# Start koozic | ||
echo "Starting KooZic" | ||
echo "The log is available by connecting to the container:" | ||
echo " docker exec -ti <CONTAINER ID> /bin/bash" | ||
echo " tail -f /home/koozic/.local/koozic.log" | ||
su - koozic -c "/usr/local/koozic/odoo-bin \ | ||
--workers=4 \ | ||
--limit-time-cpu=1800 \ | ||
--limit-time-real=3600 \ | ||
-d koozic-v3 \ | ||
--db-filter=koozic-v3 \ | ||
--db_port=54321 \ | ||
--without-demo=all \ | ||
--no-database-list \ | ||
--logfile /home/koozic/.local/koozic.log \ | ||
--log-level=warn" |