Skip to content

Commit

Permalink
Reviewing container structure to mimic Linuxserver.io ones
Browse files Browse the repository at this point in the history
 * Moving config directory to `/config`
 * Moving downloads directory to `/downloads`
 * Adding missing SSL dependency to allow security configs on WebUI
 * Updating README accordingly
  • Loading branch information
Cobraeti committed Feb 24, 2018
1 parent ec09b3d commit 0e3e9e8
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 69 deletions.
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
FROM linuxserver/baseimage
MAINTAINER Etienne Blondelle <[email protected]>

#Exposing ports and volumes
VOLUME ["/downloads", "/config"]
EXPOSE 8000

#Installing pyLoad
RUN echo "deb http://archive.ubuntu.com/ubuntu/ trusty-security multiverse" >> /etc/apt/sources.list \
&& echo "deb-src http://archive.ubuntu.com/ubuntu/ trusty-security multiverse" >> /etc/apt/sources.list \
Expand All @@ -9,6 +13,7 @@ RUN echo "deb http://archive.ubuntu.com/ubuntu/ trusty-security multiverse" >> /
&& apt-get install -y python \
python-pycurl \
python-crypto \
python-openssl \
tesseract-ocr \
python-beaker \
python-imaging \
Expand All @@ -18,18 +23,15 @@ RUN echo "deb http://archive.ubuntu.com/ubuntu/ trusty-security multiverse" >> /
git \
rhino \
&& git clone -b stable https://github.com/pyload/pyload.git /opt/pyload \
&& echo "/opt/pyload/pyload-config" > /opt/pyload/module/config/configdir \
&& echo "/config" > /opt/pyload/module/config/configdir \
&& apt-get purge -y git \
&& apt-get autoremove -y \
&& apt-get clean -y
&& apt-get clean -y \
&& chown abc:abc -R /opt/pyload

#Adding default config files
ADD config/ /tmp/pyload-config
ADD services/ /etc/service/

#Changing rights
RUN chmod -v 0755 /etc/service/* /etc/service/*/run

#Exposing ports and volumes
VOLUME /opt/pyload/Downloads
EXPOSE 8000
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@ $ docker create \
-p 8000:8000 \
-e PUID=<UID> -e PGID=<GID> \
-e TZ=<YourRegion>/<YourCapital> \
-v </path/to/your/downloads>:/opt/pyload/Downloads \
-v </path/to/your/downloads>:/downloads \
-v </path/to/your/configs>:/config \
cobraeti/pyload
```

### Parameters
* -p 8000:8000 - the webUI port mapping
* -v </path/to/your/downloads>:/opt/pyload/Downloads - path to your downloads folder
* -p 8000:8000 - The webUI port mapping
* -v </path/to/your/downloads>:/downloads - Path to your downloads folder
* -v </path/to/your/configs>:/config - Path to your configs folder (recommended for persisting config)
* -v /etc/localtime:/etc/localtime:ro - Share of the host localtime (optionnal)
* -e PUID=<UID> for UserID - see below for explanation
* -e PGID=<GID> for GroupID - see below for explanation
* -e PUID=<UID> for UserID - See below for explanation
* -e PGID=<GID> for GroupID - See below for explanation
* -e TZ=<YourRegion>/<YourCapital> for timezone information - eg Europe/Paris

### User / Group Identifiers
From LinuxServer.io description:
> TL;DR - The PGID and PUID values set the user / group you'd like your container to 'run as' to the host OS. This can be a user you've created or even root (not recommended).
> The PGID and PUID values set the user / group you'd like your container to 'run as' to the host OS. This can be a user you've created or even root (not recommended).
> Part of what makes our containers work so well is by allowing you to specify your own PUID and PGID. This avoids nasty permissions errors with relation to data volumes (-v flags). When an application is installed on the host OS it is normally added to the common group called users, Docker apps due to the nature of the technology can't be added to this group. So we added this feature to let you easily choose when running your containers.
### Default configs
Expand All @@ -34,7 +36,7 @@ The default port for webUI is 8000 and must stay like that. If you need to use a
* Default login: `admin`
* Default password: `pyload`

You can (and should ^^) change the password through the webUI (Top right corner > Administrate > User > change).
You can (and should :yum:) change the password through the webUI (Top right corner > Administrate > User > change).

If you want to create users, you need to run the following command on the docker host:
```shellsession
Expand All @@ -51,7 +53,10 @@ Notes:
* Don't forget to leave the user management script with choice 4 (Quit) or users won't be added

#### Downloads folder
The default folder for downloads is `/opt/pyload/Downloads`and must stay like that. If you need to change the destination folder for downloads, only change the volume mapping when creating the container (ex: `$ docker create --name pyLoad -v <NEW FOLDER>:/pyload/downloads ...`)
The default folder for downloads is `/downloads`and must stay like that. If you need to change the destination folder for downloads, only change the volume mapping when creating the container (eg: `$ docker create --name pyLoad -v <NEW FOLDER>:/downloads ...`)

#### Remote control
If you are planning to activate this option, just add a port mapping for the dedicated port with `-p 7227:7227` and when pyload is up, just activate the remote control in the dedicated config menu (Top right corner > Config tab > General tab > Menu tab > Remote > Activated > on)

#### SSL
The container was packed with all requirements (obviously except for GUI...), so you just have to add a volume mapping to a folder containing your certificate and key with `-v </path/to/your/ssl/folder>:/ssl` and configure SSL in the dedicated config menu (Top right corner > Config tab > General tab > Menu tab > SSL)
Binary file modified config/files.db
Binary file not shown.
98 changes: 49 additions & 49 deletions config/pyload.conf
Original file line number Diff line number Diff line change
@@ -1,74 +1,74 @@
version: 1

remote - "Remote":
bool nolocalauth : "No authentication on local connections" = True
bool activated : "Activated" = False
int port : "Port" = 7227
ip listenaddr : "Adress" = 0.0.0.0
download - "Download":
int chunks : "Max connections for one download" = 3
str interface : "Download interface to bind (ip or Name)" = None
bool ipv6 : "Allow IPv6" = False
bool limit_speed : "Limit Download Speed" = False
int max_downloads : "Max Parallel Downloads" = 3
int max_speed : "Max Download Speed in kb/s" = -1
bool skip_existing : "Skip already existing files" = False

downloadTime - "Download Time":
time end : "End" = 0:00
time start : "Start" = 0:00

general - "General":
bool checksum : "Use Checksum" = False
bool debug_mode : "Debug Mode" = False
folder download_folder : "Download Folder" = /downloads
bool folder_per_package : "Create folder for each package" = True
en;de;fr;it;es;nl;sv;ru;pl;cs;sr;pt_BR language : "Language" = en
int min_free_space : "Min Free Space (MB)" = 200
int renice : "CPU Priority" = 0

log - "Log":
int log_size : "Size in kb" = 100
folder log_folder : "Folder" = Logs
bool file_log : "File Log" = True
int log_count : "Count" = 5
folder log_folder : "Folder" = Logs
bool log_rotate : "Log Rotate" = True
int log_size : "Size in kb" = 100

permission - "Permissions":
str group : "Groupname" = users
bool change_dl : "Change Group and User of Downloads" = False
bool change_file : "Change file mode of downloads" = False
str user : "Username" = user
str file : "Filemode for Downloads" = 0644
bool change_group : "Change group of running process" = False
str folder : "Folder Permission mode" = 0755
bool change_user : "Change user of running process" = False

general - "General":
en;de;fr;it;es;nl;sv;ru;pl;cs;sr;pt_BR language : "Language" = en
folder download_folder : "Download Folder" = /opt/pyload/Downloads
bool checksum : "Use Checksum" = False
bool folder_per_package : "Create folder for each package" = True
bool debug_mode : "Debug Mode" = False
int min_free_space : "Min Free Space (MB)" = 200
int renice : "CPU Priority" = 0

ssl - "SSL":
file cert : "SSL Certificate" = ssl.crt
bool activated : "Activated" = False
file key : "SSL Key" = ssl.key

webinterface - "Webinterface":
str template : "Template" = default
bool activated : "Activated" = True
str prefix : "Path Prefix" =
builtin;threaded;fastcgi;lightweight server : "Server" = builtin
ip host : "IP" = 0.0.0.0
bool https : "Use HTTPS" = False
int port : "Port" = 8000
str file : "Filemode for Downloads" = 0644
str folder : "Folder Permission mode" = 0755
str group : "Groupname" = users
str user : "Username" = user

proxy - "Proxy":
str username : "Username" = None
bool proxy : "Use Proxy" = False
str address : "Address" = "localhost"
password password : "Password" = None
http;socks4;socks5 type : "Protocol" = http
int port : "Port" = 7070
bool proxy : "Use Proxy" = False
http;socks4;socks5 type : "Protocol" = http
str username : "Username" = None

reconnect - "Reconnect":
time endTime : "End" = 0:00
bool activated : "Use Reconnect" = False
time endTime : "End" = 0:00
str method : "Method" = None
time startTime : "Start" = 0:00

download - "Download":
int max_downloads : "Max Parallel Downloads" = 3
bool limit_speed : "Limit Download Speed" = False
str interface : "Download interface to bind (ip or Name)" = None
bool skip_existing : "Skip already existing files" = False
int max_speed : "Max Download Speed in kb/s" = -1
bool ipv6 : "Allow IPv6" = False
int chunks : "Max connections for one download" = 3
remote - "Remote":
bool activated : "Activated" = False
ip listenaddr : "Adress" = 0.0.0.0
bool nolocalauth : "No authentication on local connections" = True
int port : "Port" = 7227

downloadTime - "Download Time":
time start : "Start" = 0:00
time end : "End" = 0:00
ssl - "SSL":
bool activated : "Activated" = False
file cert : "SSL Certificate" = ssl.crt
file key : "SSL Key" = ssl.key

webinterface - "Webinterface":
bool activated : "Activated" = True
ip host : "IP" = 0.0.0.0
bool https : "Use HTTPS" = False
int port : "Port" = 8000
str prefix : "Path Prefix" =
builtin;threaded;fastcgi;lightweight server : "Server" = builtin
str template : "Template" = classic
13 changes: 7 additions & 6 deletions services/pyload/run
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@
umask 0002

#Checking if config files exists (if not, copy default ones)
if [ ! -f "/opt/pyload/pyload-config/files.db" ] || [ ! -f "/opt/pyload/pyload-config/files.version" ] || [ ! -f "/opt/pyload/pyload-config/plugin.conf" ] || [ ! -f "/opt/pyload/pyload-config/pyload.conf" ]
if [ ! -f "/config/files.db" ] || [ ! -f "/config/files.version" ] || [ ! -f "/config/plugin.conf" ] || [ ! -f "/config/pyload.conf" ]
then
mkdir -p /opt/pyload/pyload-config
chmod 777 /opt/pyload/pyload-config
mkdir -p /config
chmod 777 /config

mv /tmp/pyload-config/* /opt/pyload/pyload-config/
mv /tmp/pyload-config/* /config/
fi

if [ -f "/opt/pyload/pyload-config/pyload.pid" ]
if [ -f "/config/pyload.pid" ]
then
rm -f /opt/pyload/pyload-config/pyload.pid
rm -f /config/pyload.pid
fi

#Changing rights if needed
chown -v abc:abc -R /opt/pyload
chown -v abc:abc -R /config

#Starting pyload
exec /sbin/setuser abc /usr/bin/python /opt/pyload/pyLoadCore.py

0 comments on commit 0e3e9e8

Please sign in to comment.