Merge branch 'new-version'

This commit is contained in:
Dominique Barton
2016-01-20 21:28:53 +01:00
5 changed files with 167 additions and 49 deletions
+28 -7
View File
@@ -1,6 +1,10 @@
FROM debian:8
MAINTAINER Dominique Barton
#
# Install all required dependencies.
#
RUN apt-get -q update \
&& apt-get install -qy git python-pip python-dev libz-dev libxml2-dev libxslt1-dev gcc \
&& pip install cheetah lxml pyopenssl \
@@ -10,21 +14,38 @@ RUN apt-get -q update \
&& rm -rf /var/lib/apt/lists/* \
&& rm -rf /tmp/*
#
# Create user and group for CouchPotato.
#
RUN groupadd -r -g 666 couchpotato \
&& useradd -r -u 666 -g 666 -d /couchpotato couchpotato
#
# Get CouchPotato repository.
#
RUN git clone -b master https://github.com/RuudBurger/CouchPotatoServer.git /couchpotato \
&& chown -R couchpotato: /couchpotato
ADD start.sh /start.sh
RUN chown couchpotato: /start.sh \
&& chmod 755 /start.sh
#
# Add CouchPotato init script.
#
VOLUME ["/datadir", "/media"]
ADD couchpotato.sh /couchpotato.sh
RUN chmod 755 /couchpotato.sh
EXPOSE 8080
#
# Define container settings.
#
USER couchpotato
VOLUME ["/datadir", "/download"]
EXPOSE 5050
#
# Start CouchPotato.
#
WORKDIR /couchpotato
CMD ["/start.sh"]
CMD ["/couchpotato.sh"]
+64 -28
View File
@@ -2,50 +2,86 @@
This is a Docker image for [CouchPotato](https://couchpota.to/) - the awesome movie PVR for usenet and torrents.
The Docker image currently supports:
* running CouchPotato under its __own user__ (not `root`)
* changing of the __UID and GID__ for the CouchPotato user
* __automatic update__ of CouchPotato on container restart
* instant __switching between different CouchPotato versions__
* support for OpenSSL / HTTPS encryption
## Run
### Run via Docker CLI client
To run the CouchPotato container you can execute:
```bash
docker run --name couchpotato -v <datadir path>:/datadir -v <media path>:/media -p 5050:5050 couchpotato/couchpotato
```
Open a browser and point it to [http://my-docker-host:5050](http://my-docker-host:5050)
### Run via Docker Compose
You can also run the CouchPotato container by using [Docker Compose](https://www.docker.com/docker-compose).
If you've cloned the [git repository](https://github.com/domibarton/docker-couchpotato) you can build and run the Docker container locally (without the Docker Hub):
```bash
docker-compose up -d
```
If you want to use the Docker Hub image within your existing Docker Compose file you can use the following YAML snippet:
```yaml
couchpotato:
image: "couchpotato/couchpotato"
container_name: "couchpotato"
volumes:
- "<datadir path>:/datadir"
- "<media path>:/media"
ports:
- "5050:5050"
restart: always
```
## Configuration
### Volumes
Mount the following volumes inside your container:
Please mount the following volumes inside your CouchPotato container:
* `<datadir path>:/datadir`
* `<media path>:/media`
* `/datadir`: Holds all the CouchPotato data files (e.g. config, postProcessing)
* `/media`: Directory for TV shows
### Configuration file
By default the CouchPotato configuration is located on:
By default the CouchPotato configuration is located on `/datadir/config.ini`.
If you want to change this you've to set the `CONFIG` environment variable, for example:
```
/datadir/config.ini
CONFIG=/datadir/couchpotato.ini
```
If you want to change this, set the `CONFIG` environment variable.
### CouchPotato Version
By default the latest CouchPotato version will be used by pointing at the `master` tree of the [CouchPotato git repository](https://github.com/RuudBurger/CouchPotatoServer).
If you want a different version you've set the `VERSION` environment variable to a valid git branch or tag.
By default the latest CouchPotato version will be used. This is achieved by pointing at the `master` tree of the [CouchPotato git repository](https://github.com/RuudBurger/CouchPotatoServer/tree/master). If you want a different version you've set the `VERSION` environment variable to a valid git [branch](https://github.com/RuudBurger/CouchPotatoServer/branches) or [tag](https://github.com/RuudBurger/CouchPotatoServer/tags), for example:
_Please note that CouchPotato will automatically be updated when you restart your container._
## Run
### Run via docker CLI
```bash
docker run --name couchpotato -v <datadir path>:/datadir -v <media path>:/media dbarton/couchpotato
```
VERSION=devel
```
### Run via docker-compose
Please note that `VERSION=master` always points to the latest stable version, while `VERSION=devel` points to the bleeding-edge version of CouchPotato.
```yaml
sabnzbd:
image: "dbarton/couchpotato"
container_name: "couchpotato"
volumes:
- "<datadir path>:/datadir"
- "<media path>:/media"
tty: true
stdin_open: true
restart: always
_CouchPotato will automatically be updated and switched to your defined version when you restart your container._
### UID and GID
By default CouchPotato runs with user ID and group ID `666`.
If you want to run CouchPotato with different ID's you've to set the `UID` and/or `GID` environment variables, for example:
```
UID=1234
GID=1234
```
+65
View File
@@ -0,0 +1,65 @@
#!/bin/bash
set -e
#
# Display settings on standard out.
#
USER="couchpotato"
echo "CouchPotato settings"
echo "===================="
echo
echo " User: ${USER}"
echo " UID: ${CP_UID:=666}"
echo " GID: ${CP_GID:=666}"
echo
echo " Config: ${CONFIG:=/datadir/config.ini}"
echo " Version: ${VERSION:=master}"
echo
#
# Change UID / GID of CouchPotato user.
#
printf "Updating UID / GID... "
[[ $(id -u ${USER}) == ${CP_UID} ]] || usermod -o -u ${CP_UID} ${USER}
[[ $(id -g ${USER}) == ${CP_GID} ]] || groupmod -o -g ${CP_GID} ${USER}
echo "[DONE]"
#
# Set directory permissions.
#
printf "Set permissions... "
touch ${CONFIG}
chown -R ${USER}: /couchpotato
chown ${USER}: /datadir /media $(dirname ${CONFIG})
echo "[DONE]"
#
# Update CouchPotato and checkout requested version.
#
printf "Updating CouchPotato git repository... "
git pull -q
echo "[DONE]"
printf "Getting current version... "
CURRENT_VERSION=$(git rev-parse --abbrev-ref HEAD)
echo "[${CURRENT_VERSION}]"
if [[ "${CURRENT_VERSION}" == "${VERSION}" ]]
then
printf "Checking out CouchPotato version '${VERSION}'... "
git checkout -q ${VERSION}
echo "[DONE]"
fi
#
# Finally, start CouchPotato.
#
CONFIG=${CONFIG:-/datadir/config.ini}
echo "Starting CouchPotato..."
exec ./CouchPotato.py --data_dir=$(dirname ${CONFIG}) --config_file=${CONFIG}
+10
View File
@@ -0,0 +1,10 @@
---
couchpotato:
build: .
container_name: 'couchpotato'
environment:
VERSION: 'master'
volumes:
- './data/datadir:/datadir'
- './data/media:/media'
restart: 'always'
-14
View File
@@ -1,14 +0,0 @@
#!/bin/sh
echo "Updating CouchPotato git repository..."
git pull
if [ -n "${VERSION}" ]
then
echo "Checking out SABnzbd version '${VERSION}'..."
git checkout ${VERSION}
fi
CONFIG=${CONFIG:-/datadir/config.ini}
echo "Starting CouchPotato with config '${CONFIG}'..."
exec ./CouchPotato.py --data_dir=/datadir --config_file=${CONFIG}