Rewrite Docker-Setup

* make it simpler and cleaner
* switch to nginx-alpine and php-fpm-alpine
* docker-compose: autobuild php-image for stikked
* serve all files directly (htdocs is mounted instead of copied)
* stikked-configuration for docker resides in docker/stikked.php
This commit is contained in:
Claude 2019-11-23 16:58:17 +01:00
parent e579784507
commit 4462a471c5
11 changed files with 2795 additions and 148 deletions

View File

@ -1 +0,0 @@
.git*

View File

@ -1,23 +0,0 @@
FROM php:7.1-apache
EXPOSE 80
# Note that 'vim' and 'mysql-client' are changed to an echo,
# as they're only useful when debugging, and leaving them in
# the standard container only increases its size.
RUN apt-get -y update && \
apt-get -y install libpng-dev zlib1g-dev cron && \
echo apt-get -y install vim mysql-client && \
a2enmod rewrite && \
docker-php-ext-install mysqli gd && \
rm -rf /var/lib/apt/lists/*
COPY htdocs /var/www/html
COPY htdocs/application/config/stikked.php.dist /var/www/html/application/config/stikked.php
# This overwrites the entrypoint from the php container with ours, which updates the
# stikked config file based on environment variables
COPY docker/docker-php-entrypoint /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-php-entrypoint

View File

@ -58,12 +58,11 @@ Installation
How to run it in Docker How to run it in Docker
----------------------- -----------------------
sudo docker build -t stikked . docker-compose up
sudo docker-compose up -d
This automatically creates a database with passwords that are configurable in the docker-compose.yml file. This automatically builds the docker-image and fires up nginx, php and mariadb. Access your Stikked instance at http://localhost/.
NOTE: This sets the captcha to false and requires port 80 to be accessible on the host machine. Also, a host entry of 127.0.0.1 stikked.local will fix the base_url issues. All files are served directly; the Stikked-configuration for Docker resides in docker/stikked.php
Documentation Documentation

View File

@ -1,29 +1,31 @@
version: "3.2" version: "3.7"
services: services:
db: nginx:
image: mysql:latest image: nginx:1.17-alpine
volumes: volumes:
- db_data:/var/lib/mysql - ./docker/nginx.conf:/etc/nginx/conf.d/default.conf:ro
env_file: docker/stikked-envvars.txt - ./htdocs:/htdocs:ro
stikked:
depends_on:
- db
image: stikked
env_file: docker/stikked-envvars.txt
ports: ports:
- 80:80 - 127.0.0.1:80:80/tcp
# You should use persistant storage for this, php:
# as if the volume is deleted, everything is gone! image: stikked-php:1
volumes: volumes:
db_data: - ./docker/php.ini:/usr/local/etc/php/php.ini:ro
- ./docker/php-fpm.conf:/usr/local/etc/php-fpm.d/www.conf:ro
# Example of NFS backed persistant storage: - ./htdocs:/htdocs
# db_data: - ./docker/stikked.php:/htdocs/application/config/stikked.php:ro
# driver_opts: build:
# type: "nfs" context: ./docker/php
# o: "addr=192.168.1.254,nolock,soft,rw"
# device: ":/nfs/export/pbdatabase"
mysql:
image: mariadb:10.4
command: mysqld --innodb-buffer-pool-size=4000000000
volumes:
- ./mysql-datadir_customize-in-docker-compose.yml:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: stikked
MYSQL_USER: stikked
MYSQL_PASSWORD: stikked

View File

@ -1,70 +0,0 @@
#!/bin/bash
# This is copied from the original docker-php-entrypoint and was updated
# by the Stikked container
set -e
# Check to see where Stikked might be - If you added Stikked to this
# container with something like:
# ADD https://github.com/claudehohl/Stikked/archive/0.12.0.tar.gz /usr/local
# then it will be in /usr/local/stikked/Stikked-0.12.0/htdocs/application/config/stikked.php.dist
# If you're using the standard Dockerfile from Stikked, it will be in
# /var/www/html/htdocs/applcation/config/stikked.php.dist
if [ -e /var/www/html/application/config/stikked.php.dist ]; then
CFG=/var/www/html/application/config/stikked.php
cp /var/www/html/application/config/stikked.php.dist $CFG
elif [ -e /usr/local/stikked/Stikked-*/htdocs/application/config/stikked.php.dist ]; then
CFG=$(echo /usr/local/stikked/Stikked-*/htdocs/application/config/stikked.php.dist | sed 's/\.dist//')
cp /usr/local/stikked/Stikked-*/htdocs/application/config/stikked.php.dist $CFG
else
echo I can not find the stikked.php.dist file, which means docker-php-entrypoint
echo needs to be updated. Sorry. I can not continue. Exiting.
exit -1
fi
# Set some default variables
STIKKED_SITE_NAME="${STIKKED_SITE_NAME:-Dockerised Stikked Container}"
STIKKED_BASE_URL="${STIKKED_BASE_URL:-https://bogus.example.com/}"
STIKKED_DB_HOSTNAME="${STIKKED_DB_HOSTNAME:-db}"
# If these aren't set, use MYSQL_ values. If they're not set, then
# just guess.
STIKKED_DB_DATABASE="${STIKKED_DB_DATABASE:-${MYSQL_DATABASE:-stikked}}"
STIKKED_DB_USERNAME="${STIKKED_DB_USERNAME:-${MYSQL_USER:-stikked}}"
STIKKED_DB_PASSWORD="${STIKKED_DB_PASSWORD:-${MYSQL_PASSWORD:-stikked}}"
# If there's not a cron key, set a random one.
if [ ! "$STIKKED_CRON_KEY" ]; then
# Note - this is not very random. But it'll do in a pinch.
STIKKED_CRON_KEY=$RANDOM.$RANDOM.$RANDOM.$RANDOM
fi
# Put the cron file in place
echo "*/5 * * * * root curl --silent http://localhost/cron/$STIKKED_CRON_KEY" > /etc/cron.d/stikked
# This gets all environment variables that start with STIKKED_
svars=$(set | grep \^STIKKED_ | cut -d= -f1)
for svar in $svars; do
# Remove STIKKED_ from the front, and convert it to lower
# case (STIKKED_CRON_KEY is now cron_key)
val=$(echo $svar | sed 's/STIKKED_\(.*\)/\L\1/')
# if it has a /, escape it - for example, in a path or URL.
FIXED=$(echo ${!svar} | sed 's_/_\\/_g')
# Tell the user what's going on
echo Setting $val to be $FIXED
# And actually update the file
sed -i "s/\['$val'\].*/['$val'] = '$FIXED';/" $CFG
done
# Start Cron, if it exists
[ -e /usr/sbin/cron ] && /usr/sbin/cron
# first arg is `-f` or `--some-option`
if [ "${1#-}" != "$1" ]; then
set -- apache2-foreground "$@"
fi
exec "$@"

69
docker/nginx.conf Normal file
View File

@ -0,0 +1,69 @@
upstream php {
#server unix:/var/run/php5-fpm.sock;
server php:9000;
}
server {
listen 80 backlog=1024;
server_name localhost;
server_tokens off;
root /htdocs;
index index.php;
client_body_buffer_size 8M;
client_max_body_size 8M;
gzip on;
gzip_types text/plain text/css application/javascript;
# Only requests to our Host are allowed
if ($host !~ ^localhost$ ) {
return 444;
}
# Only allow these request methods
if ($request_method !~ ^(GET|HEAD|POST)$ ) {
return 444;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
}
# Deny access to any files with a .php extension in the static directory
location ~* /(?:static)/.*\.php$ {
deny all;
}
location / {
# This is cool because no php is touched for static content.
# include the "?$args" part so non-default permalinks doesn't break when using query string
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
include fastcgi.conf;
fastcgi_intercept_errors on;
fastcgi_pass php;
}
location ~* \.(js|css|png|ico)$ {
expires max;
log_not_found off;
}
}

413
docker/php-fpm.conf Normal file
View File

@ -0,0 +1,413 @@
; Start a new pool named 'www'.
; the variable $pool can be used in any directive and will be replaced by the
; pool name ('www' here)
[www]
; Per pool prefix
; It only applies on the following directives:
; - 'access.log'
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
; - 'chdir'
; - 'php_values'
; - 'php_admin_values'
; When not set, the global prefix (or /usr) applies instead.
; Note: This directive can also be relative to the global prefix.
; Default Value: none
;prefix = /path/to/pools/$pool
; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
; will be used.
user = www-data
group = www-data
; The address on which to accept FastCGI requests.
; Valid syntaxes are:
; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific IPv4 address on
; a specific port;
; '[ip:6:addr:ess]:port' - to listen on a TCP socket to a specific IPv6 address on
; a specific port;
; 'port' - to listen on a TCP socket to all addresses
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /run/php/php7.0-fpm.sock
; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)
;listen.backlog = 511
; Set permissions for unix socket, if one is used. In Linux, read/write
; permissions must be set in order to allow connections from a web server. Many
; BSD-derived systems allow connections regardless of permissions.
; Default Values: user and group are set as the running user
; mode is set to 0660
listen.owner = www-data
listen.group = www-data
;listen.mode = 0660
; When POSIX Access Control Lists are supported you can set them using
; these options, value is a comma separated list of user/group names.
; When set, listen.owner and listen.group are ignored
;listen.acl_users =
;listen.acl_groups =
; List of addresses (IPv4/IPv6) of FastCGI clients which are allowed to connect.
; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
; must be separated by a comma. If this value is left blank, connections will be
; accepted from any ip address.
; Default Value: any
;listen.allowed_clients = 127.0.0.1
; Specify the nice(2) priority to apply to the pool processes (only if set)
; The value can vary from -19 (highest priority) to 20 (lower priority)
; Note: - It will only work if the FPM master process is launched as root
; - The pool processes will inherit the master process priority
; unless it specified otherwise
; Default Value: no set
; process.priority = -19
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
; dynamic - the number of child processes are set dynamically based on the
; following directives. With this process management, there will be
; always at least 1 children.
; pm.max_children - the maximum number of children that can
; be alive at the same time.
; pm.start_servers - the number of children created on startup.
; pm.min_spare_servers - the minimum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is less than this
; number then some children will be created.
; pm.max_spare_servers - the maximum number of children in 'idle'
; state (waiting to process). If the number
; of 'idle' processes is greater than this
; number then some children will be killed.
; ondemand - no children are created at startup. Children will be forked when
; new requests will connect. The following parameter are used:
; pm.max_children - the maximum number of children that
; can be alive at the same time.
; pm.process_idle_timeout - The number of seconds after which
; an idle process will be killed.
; Note: This value is mandatory.
pm = dynamic
; The number of child processes to be created when pm is set to 'static' and the
; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
; This value sets the limit on the number of simultaneous requests that will be
; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
; CGI. The below defaults are based on a server without much resources. Don't
; forget to tweak pm.* to fit your needs.
; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
; Note: This value is mandatory.
pm.max_children = 20
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'
; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
pm.start_servers = 4
; The desired minimum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.min_spare_servers = 4
; The desired maximum number of idle server processes.
; Note: Used only when pm is set to 'dynamic'
; Note: Mandatory when pm is set to 'dynamic'
pm.max_spare_servers = 8
; The number of seconds after which an idle process will be killed.
; Note: Used only when pm is set to 'ondemand'
; Default Value: 10s
;pm.process_idle_timeout = 10s;
; The number of requests each child process should execute before respawning.
; This can be useful to work around memory leaks in 3rd party libraries. For
; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
; Default Value: 0
pm.max_requests = 10000
; The URI to view the FPM status page. If this value is not set, no URI will be
; recognized as a status page. It shows the following informations:
; pool - the name of the pool;
; process manager - static, dynamic or ondemand;
; start time - the date and time FPM has started;
; start since - number of seconds since FPM has started;
; accepted conn - the number of request accepted by the pool;
; listen queue - the number of request in the queue of pending
; connections (see backlog in listen(2));
; max listen queue - the maximum number of requests in the queue
; of pending connections since FPM has started;
; listen queue len - the size of the socket queue of pending connections;
; idle processes - the number of idle processes;
; active processes - the number of active processes;
; total processes - the number of idle + active processes;
; max active processes - the maximum number of active processes since FPM
; has started;
; max children reached - number of times, the process limit has been reached,
; when pm tries to start more children (works only for
; pm 'dynamic' and 'ondemand');
; Value are updated in real time.
; Example output:
; pool: www
; process manager: static
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 62636
; accepted conn: 190460
; listen queue: 0
; max listen queue: 1
; listen queue len: 42
; idle processes: 4
; active processes: 11
; total processes: 15
; max active processes: 12
; max children reached: 0
;
; By default the status page output is formatted as text/plain. Passing either
; 'html', 'xml' or 'json' in the query string will return the corresponding
; output syntax. Example:
; http://www.foo.bar/status
; http://www.foo.bar/status?json
; http://www.foo.bar/status?html
; http://www.foo.bar/status?xml
;
; By default the status page only outputs short status. Passing 'full' in the
; query string will also return status for each pool process.
; Example:
; http://www.foo.bar/status?full
; http://www.foo.bar/status?json&full
; http://www.foo.bar/status?html&full
; http://www.foo.bar/status?xml&full
; The Full status returns for each process:
; pid - the PID of the process;
; state - the state of the process (Idle, Running, ...);
; start time - the date and time the process has started;
; start since - the number of seconds since the process has started;
; requests - the number of requests the process has served;
; request duration - the duration in µs of the requests;
; request method - the request method (GET, POST, ...);
; request URI - the request URI with the query string;
; content length - the content length of the request (only with POST);
; user - the user (PHP_AUTH_USER) (or '-' if not set);
; script - the main script called (or '-' if not set);
; last request cpu - the %cpu the last request consumed
; it's always 0 if the process is not in Idle state
; because CPU calculation is done when the request
; processing has terminated;
; last request memory - the max amount of memory the last request consumed
; it's always 0 if the process is not in Idle state
; because memory calculation is done when the request
; processing has terminated;
; If the process is in Idle state, then informations are related to the
; last request the process has served. Otherwise informations are related to
; the current request being served.
; Example output:
; ************************
; pid: 31330
; state: Running
; start time: 01/Jul/2011:17:53:49 +0200
; start since: 63087
; requests: 12808
; request duration: 1250261
; request method: GET
; request URI: /test_mem.php?N=10000
; content length: 0
; user: -
; script: /home/fat/web/docs/php/test_mem.php
; last request cpu: 0.00
; last request memory: 0
;
; Note: There is a real-time FPM status monitoring sample web page available
; It's available in: /usr/share/php/7.0/fpm/status.html
;
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
;pm.status_path = /status
; The ping URI to call the monitoring page of FPM. If this value is not set, no
; URI will be recognized as a ping page. This could be used to test from outside
; that FPM is alive and responding, or to
; - create a graph of FPM availability (rrd or such);
; - remove a server from a group if it is not responding (load balancing);
; - trigger alerts for the operating team (24/7).
; Note: The value must start with a leading slash (/). The value can be
; anything, but it may not be a good idea to use the .php extension or it
; may conflict with a real PHP file.
; Default Value: not set
;ping.path = /ping
; This directive may be used to customize the response of a ping request. The
; response is formatted as text/plain with a 200 response code.
; Default Value: pong
;ping.response = pong
; The access log file
; Default: not set
;access.log = log/$pool.access.log
; The access log format.
; The following syntax is allowed
; %%: the '%' character
; %C: %CPU used by the request
; it can accept the following format:
; - %{user}C for user CPU only
; - %{system}C for system CPU only
; - %{total}C for user + system CPU (default)
; %d: time taken to serve the request
; it can accept the following format:
; - %{seconds}d (default)
; - %{miliseconds}d
; - %{mili}d
; - %{microseconds}d
; - %{micro}d
; %e: an environment variable (same as $_ENV or $_SERVER)
; it must be associated with embraces to specify the name of the env
; variable. Some exemples:
; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
; %f: script filename
; %l: content-length of the request (for POST request only)
; %m: request method
; %M: peak of memory allocated by PHP
; it can accept the following format:
; - %{bytes}M (default)
; - %{kilobytes}M
; - %{kilo}M
; - %{megabytes}M
; - %{mega}M
; %n: pool name
; %o: output header
; it must be associated with embraces to specify the name of the header:
; - %{Content-Type}o
; - %{X-Powered-By}o
; - %{Transfert-Encoding}o
; - ....
; %p: PID of the child that serviced the request
; %P: PID of the parent of the child that serviced the request
; %q: the query string
; %Q: the '?' character if query string exists
; %r: the request URI (without the query string, see %q and %Q)
; %R: remote IP address
; %s: status (response code)
; %t: server time the request was received
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
; %T: time the log has been written (the request has finished)
; it can accept a strftime(3) format:
; %d/%b/%Y:%H:%M:%S %z (default)
; The strftime(3) format must be encapsuled in a %{<strftime_format>}t tag
; e.g. for a ISO8601 formatted timestring, use: %{%Y-%m-%dT%H:%M:%S%z}t
; %u: remote user
;
; Default: "%R - %u %t \"%m %r\" %s"
;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
;slowlog = log/$pool.log.slow
; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_slowlog_timeout = 0
; The timeout for serving a single request after which the worker process will
; be killed. This option should be used when the 'max_execution_time' ini option
; does not stop script execution for some reason. A value of '0' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
;request_terminate_timeout = 0
; Set open file descriptor rlimit.
; Default Value: system defined value
;rlimit_files = 1024
; Set max core size rlimit.
; Possible Values: 'unlimited' or an integer greater or equal to 0
; Default Value: system defined value
;rlimit_core = 0
; Chroot to this directory at the start. This value must be defined as an
; absolute path. When this value is not set, chroot is not used.
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
; of its subdirectories. If the pool prefix is not set, the global prefix
; will be used instead.
; Note: chrooting is a great security feature and should be used whenever
; possible. However, all PHP paths will be relative to the chroot
; (error_log, sessions.save_path, ...).
; Default Value: not set
;chroot =
; Chdir to this directory at the start.
; Note: relative path can be used.
; Default Value: current directory or / when chroot
;chdir = /var/www
; Redirect worker stdout and stderr into main error log. If not set, stdout and
; stderr will be redirected to /dev/null according to FastCGI specs.
; Note: on highloaded environement, this can cause some delay in the page
; process time (several ms).
; Default Value: no
;catch_workers_output = yes
; Clear environment in FPM workers
; Prevents arbitrary environment variables from reaching FPM worker processes
; by clearing the environment in workers before env vars specified in this
; pool configuration are added.
; Setting to "no" will make all environment variables available to PHP code
; via getenv(), $_ENV and $_SERVER.
; Default Value: yes
;clear_env = no
; Limits the extensions of the main script FPM will allow to parse. This can
; prevent configuration mistakes on the web server side. You should only limit
; FPM to .php extensions to prevent malicious users to use other extensions to
; exectute php code.
; Note: set an empty value to allow all extensions.
; Default Value: .php
;security.limit_extensions = .php .php3 .php4 .php5 .php7
; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
; the current environment.
; Default Value: clean env
;env[HOSTNAME] = $HOSTNAME
;env[PATH] = /usr/local/bin:/usr/bin:/bin
;env[TMP] = /tmp
;env[TMPDIR] = /tmp
;env[TEMP] = /tmp
; Additional php.ini defines, specific to this pool of workers. These settings
; overwrite the values previously defined in the php.ini. The directives are the
; same as the PHP SAPI:
; php_value/php_flag - you can set classic ini defines which can
; be overwritten from PHP call 'ini_set'.
; php_admin_value/php_admin_flag - these directives won't be overwritten by
; PHP call 'ini_set'
; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
; Defining 'extension' will load the corresponding shared extension from
; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
; overwrite previously defined php.ini values, but will append the new value
; instead.
; Note: path INI options can be relative and will be expanded with the prefix
; (pool, global or /usr)
; Default Value: nothing is defined by default except the values in php.ini and
; specified at startup with the -d argument
;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
;php_flag[display_errors] = off
;php_admin_value[error_log] = /var/log/fpm-php.www.log
;php_admin_flag[log_errors] = on
;php_admin_value[memory_limit] = 32M

1918
docker/php.ini Normal file

File diff suppressed because it is too large Load Diff

9
docker/php/Dockerfile Normal file
View File

@ -0,0 +1,9 @@
FROM php:7.1-fpm-alpine3.9
RUN apk add -U libjpeg-turbo-dev libpng-dev freetype-dev
RUN docker-php-ext-configure gd \
--enable-gd-native-ttf \
--with-freetype-dir=/usr/include/freetype2 \
--with-png-dir=/usr/include \
--with-jpeg-dir=/usr/include
RUN docker-php-ext-install gd mysqli

View File

@ -1,27 +0,0 @@
MYSQL_ROOT_PASSWORD=thisREALLYshouldBEchanged
MYSQL_DATABASE=stikked
MYSQL_USER=stikked
MYSQL_PASSWORD=stikked
STIKKED_SITE_NAME=Stikked
# Note that there is no need to escape the URL
STIKKED_BASE_URL=http://stikked.local/
# This should match the database container name
STIKKED_DB_HOSTNAME=db
# These do NOT need to be set, as they will be inherited from
# the MYSQL_DATABASE settings above. However, you can set them
# if you are using a seperately managed database.
#STIKKED_DB_DATABASE=stikked
#STIKKED_DB_USERNAME=stikked
#STIKKED_DB_PASSWORD=stikked
# Other random examples
STIKKED_DISALLOW_SEARCH_ENGINES="true"
STIKKED_JS_EDITOR="codemirror"
# Example of enabling CAPTCHA
#STIKKED_ENABLE_CAPTCHA="true"
#STIKKED_RECAPTCHA_PUBLICKEY="_replace_this_with_your_public_key_"
#STIKKED_RECAPTCHA_PRIVATEKEY="_replace_this_with_your_private_key_"

358
docker/stikked.php Normal file
View File

@ -0,0 +1,358 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Site Name
*
* The name of your site
*
*/
$config['site_name'] = 'Stikked';
/**
* Base URL
*
* Set the base URL of Stikked. WITH trailing slash!
*
*/
$config['base_url'] = 'http://localhost/';
/**
* Database connection
*
* Credentials for your database
* The database structure will be created automatically
*
*/
$config['db_hostname'] = 'mysql';
$config['db_database'] = 'stikked';
$config['db_username'] = 'stikked';
$config['db_password'] = 'stikked';
// If you are using sqlite:
// uncomment the configuration lines below.
//$config['db_database'] = 'db/stikked'; // you need to create a directory "db" and give the webserver write access. sqlite needs a writable folder to work properly!
//$config['db_driver'] = 'sqlite';
/**
* Table prefix
* Generate table prefix for stikked db, commonly used if the webhoster only has one db.
* Use underscore as suffix to easily see the tables.
* example: $config['db_prefix'] = 'stikked_';
* use $config['db_prefix'] = ''; if you don't want to use table prefix.
*/
$config['db_prefix'] = '';
/**
* Theme
*
* Which theme to use
* Folder name in htdocs/themes/
* Currently: default, bootstrap, gabdark, gabdark3, geocities, snowkat, stikkedizr, cleanwhite, i386
*
*/
$config['theme'] = 'default';
/**
* Display QR code
*
* Whether or not to display the QR code
*
*/
$config['qr_enabled'] = true;
/**
* JavaScript-Editor
*
* Which editor to use
* CodeMirror, ACE or none
*
* none: ~130kb JS
* CodeMirror: ~300kb JS
* ACE: >800kb JS
*
*/
$config['js_editor'] = ''; // codemirror, ace, ''
/**
* Language
*
* Which language to use
* Translate Stikked to your own language, see htdocs/application/language files
* Currently: english, german, swissgerman, spanish, norwegian, danish, portuguese, turkish, french, japanese, polish, russian, chinese-simplified, chinese-traditional, indonesia
*
*/
$config['language'] = 'english';
/**
* Combine JS & CSS files (recommended)
*
* htdocs/static/asset/ folder must be writeable
*
*/
$config['combine_assets'] = false;
/**
* Content expiration
*
* Sets the "Expires:"-header to make use of browser-caching
* Format: http://php.net/manual/en/function.strtotime.php
* Examples: '+10 seconds', '+1 year', '-1 week'
*
*/
$config['content_expiration'] = '-1 week';
/**
* Key for Cron
*
* The password required to run the cron job */
// Example cron: */5 * * * * curl --silent http://yoursite.com/cron/[key]
//
//
$config['cron_key'] = '';
/**
* url shortener config
*
* url_shortening_use:
* - Enables specific url shortening engine or disables them all
* - Valid values:
* @string yourls
* @string gwgd
* @string googl
* @string bitly
* @string polr
* @string random - Randomly chose any of upper API-s !WARNING! May be slow! For maximum performanse, it's recommended to either set all API keys or use random_url_engines to list working engines.
* @string none - same as off
*
* random_url_engines:
* - This variable sets list of APIs to be considered for usage if url_shortening_use is set to 'random'
* To consider all API-s, either leave it empty (as empty array or string) or type all apis available (yourls,gwgd,googl,bitly)
* be aware that considering all the APIs is not recommended because program will test them all, and that affects speed.
* This will greatly improve performance of 'random' mode if listed are only valid, filled APIs.
* Accepted inputs:
* @array array('use this', 'and this', 'and this of course')
* @string 'use this,and this,and this of course'
* - If input is @string it must be comma delimited, otherwise will be ignored.
* - Script will accept minimum of 2 APIs, ignored otherwise
* - Only alphanumeric characters and "." are allowed. Everything else is filtered out.
*
* -------------------------------------------------------------------------------------------------------------
* yourls_url: Your own instance of yourls URL-shortener (Download: http://yourls.org/)
* Example: http://example.com/yourls/
*
* yourls_signature: Your signature, used to authenticate API requests.
* You can find your signature under http://your-yourls-installation.com/admin/tools.php
*
* gwgd_url: Your own instance of the gw.gd URL-shortener (Download: https://github.com/neofutur/gwgd)
* Default: http://gw.gd/
*
* googl_url_api: URL shortening service provided by Google Inc. (API: http://code.google.com/apis/console/)
* Usage: Your API key
*
* bitly_url_api: Famous URL shortening service (API: http://dev.bitly.com/get_started.html)
* Usage: Your API key
*
* polr_url: Your own instance of polr URL-shortener (Download: https://github.com/cydrobolt/polr)
* polr_api: Your polr api key
*
**/
$config['url_shortening_use'] = 'off';
$config['random_url_engines'] = 'googl,bitly'; // Used only in random mode, read comment above for more info
// Yourls
$config['yourls_url'] = '';
$config['yourls_signature'] = '';
// gwgd_url
$config['gwgd_url'] = '';
$config['shorturl_selected'] = false;
// goo.gl API key
$config['googl_url_api'] = '';
// Bit.ly API key
$config['bitly_url_api'] = '';
// polr
$config['polr_url'] = '';
$config['polr_api'] = '';
/**
* Credentials for the backup URL
*
* Basic auth user & pass for the backup URL, accessible via http://yoursite.com/backup
*
**/
$config['backup_user'] = '';
$config['backup_pass'] = '';
/**
* Pastes Per Page
*
* Number of pastes per page, on the recent pastes listings.
*
**/
$config['per_page'] = 15;
/**
* API key
*
* Require a key to interact with the API.
* Append to all API requests: ?apikey=[yourkey]
*
**/
$config['apikey'] = '';
/**
* Soft API
*
* When set to true, allow interaction:
* without apikey: badword-check applies
* with apikey: badwords are ignored
*
* This is useful to maintain a restrictive blocklist
* for spammers and bypass it using the apikey.
*
**/
$config['soft_api'] = false;
/**
* Anti spam
*
* private_only: No recent pastes will be displayed.
* enable_captcha: Users must enter a captcha to post.
* recaptcha_publickey & recaptcha_privatekey: If filled, reCaptcha will be used (get a key from https://www.google.com/recaptcha/admin/create)
* disable_api: Don't allow pasting via API (because we can't use a captcha there...)
* disable_keep_forever: Don't allow pasting without expiration
* blocked_words: Comma separated list, e.g. '.es.tl, mycraft.com, yourbadword'
* disable_shorturl: "Create Shorturl" option will be disabled
* disallow_search_engines: displays a robots.txt that forbids indexing
*
**/
$config['private_only'] = false;
$config['enable_captcha'] = true;
$config['recaptcha_publickey'] = '';
$config['recaptcha_privatekey'] = '';
$config['disable_api'] = false;
$config['disable_keep_forever'] = false;
$config['blocked_words'] = '';
$config['disable_shorturl'] = false;
$config['disallow_search_engines'] = false;
//spamadmin: accessible via /spamadmin (only active when user + pass is set)
$config['spamadmin_user'] = '';
$config['spamadmin_pass'] = '';
/**
* Default paste expiration time (minutes)
*
* Possible values:
* burn (burn on reading)
* 5 (5 minutes)
* 60 (1 hour)
* 1440 (1 day)
* 10080 (1 week)
* 40320 (1 month)
* 483840 (1 year)
* 0 (keep forever)
**/
$config['default_expiration'] = 0;
/**
* Default language
*
* Preselected language. See application/config/geshi_languages.php for valid values (array keys)
*
**/
$config['default_language'] = 'text';
/**
* Name for anonymous poster
*
* What name is to be set for anonymous posters
* DO NOT SET BLANK
* Set to random for a random paste to be generated
* NOTE: if changed only pastes from then on will be updated.
*
**/
$config['unknown_poster'] = 'random';
/**
* Name for untitled pastes
*
* What name is to be set for untitled pastes.
* DO NOT SET BLANK
* NOTE: if changed only pastes from then on will be updated.
**/
$config['unknown_title'] = 'Untitled';
/**
* To require LDAP authentication or not.
*
* Weather to require LDAP authenticaiton or not.
* Set to either 'true' to require authentication or 'false' not to.
* NOTE: if changed, set LDAP settings in auth_ldap.php
**/
$config['require_auth'] = false;
/**
* Override the displayed URL
*
* Display this URL in a paste's detail view instead of the main URL - e.g. if you use mod_rewrite
* Variable $id: the paste_id
* Example: 'http://example.com/$id'
*
**/
$config['displayurl_override'] = '';
/**
*
*
* Words used for when unknown_poster is set to random
*
*
**/
$config['nouns'] = array('Hornbill', 'Elephant', 'Bison', 'Lion', 'Camel', 'Sheep',
'Monkey', 'Prairie Dog', 'Plover', 'Tapir', 'Capybara', 'Cheetah', 'Flamingo', 'Peccary', 'Eider', 'Porcupine', 'Pelican', 'Dove', 'Crane', 'Tortoise', 'Agouti',
'Tamarin', 'Pheasant', 'Owl', 'Gibbon', 'Goose', 'Baboon', 'Hamerkop', 'Zebra',
'Macaw', 'Gibbon', 'Madrill', 'Wolf', 'Stork', 'Armadillo', 'Ostrich', 'Marmoset',
'Lizard', 'Panda', 'Giraffe', 'Cassowary', 'Kangaroo', 'Gorilla', 'Pheasant',
'Finch', 'Duck', 'Matamata', 'Teal', 'Macaque', 'Goat', 'Lechwe', 'Ibis', 'Parrot',
'Parakeet', 'Bongo', 'Pudu', 'Echidna', 'Lemur', 'Bat', 'Curlew', 'Terrapin',
'Peafowl', 'Duck', 'Owl', 'Parakeet', 'Meerkat', 'Tern', 'Wigeon', 'Pintail',
'Meerkat', 'Motmot', 'Motmot', 'Shama', 'Dormouse', 'Horse', 'Rhinoceros', 'Sloth',
'Mousedeer', 'Treeshrew', 'Bushbaby', 'Guinea Pig', 'Agouti', 'Water Vole', 'Hog',
'Pig', 'Anoa', 'Octupus', 'Butterfly', 'Cat', 'Kitten', 'Coyote', 'Crocodile',
'Cockroach', 'Crow', 'Bird', 'Dolphin', 'Earthworm', 'Frog', 'Hamster', 'Hedgehog',
'Hog', 'Human', 'Hummingbird', 'Iguana', 'Leech', 'Leopard', ' Marten',
'Mockingbird', 'Mockingjay', 'Mosquito', 'Moth', 'Partdridge', 'Bee', 'Penguin');
$config['adjectives'] = array('Ample', 'Mature', 'Bulky', 'Burly', 'Capacious',
'Colossal', 'Commodious', 'Thundering', 'Mammoth', 'Mungo', 'Voluminous',
'Walloping', 'Tiny', 'Baby', 'Bitty', 'Diminutive', 'Little', 'Paltry', 'Scanty',
'Trivial', 'Scribby', 'Blush', 'Tinct', 'Colorant', 'Aqua', 'Beige', 'Bistre',
'Buff', 'Bistre', 'Chartreuse', 'Chocolate', 'Cobalt', 'Coral', 'Cream', 'Crimson',
'Denim', 'Emerald', 'Gray', 'Gamboge', 'Ivory', 'Mustard', 'Silly', 'Perl',
'Whipped', 'Violet', 'Harmless', 'Gentle', 'Innocent', 'Reliable', 'Unreliable',
'Soft', 'Toxic', 'Anorexic', 'Beefy', 'Sexy', 'Morose', 'Rude', 'Ungracious',
'Abrupt', 'Gracious', 'Queen', 'Cute', 'Edgy', 'Insensitive', 'Round', 'Sharp',
'Gruff', 'Subtle', 'Crippled', 'Eratic', 'Social', 'Jittery', 'Sole', 'Unique',
'Botched', 'Tacky', 'Sludgy', 'Stained', 'Wet', 'Soiled', 'Big', 'Small', 'Sloppy',
'Smelly', 'Funky', 'Putrid', 'Melodic', 'Corrupt', 'Lousy', 'Fiery', 'Red',
'Sweet', 'Hot', 'Scorching', 'Sweltering', 'Torrid', 'Obese', 'Speedy', 'Flying',
'Idiotic', 'Chunky', 'Forensic');
/**
*
*
* Words used for expiring pastes
*
*
**/
$config['expires'] = array('expire', 'perish', 'go to its last resting place',
'go to meet its maker', 'cross the great divide', 'slip away', 'give up the ghost',
'kick the bucket', 'croak', 'bite the big one', 'check out', 'buy the farm',
'join the choir invisible', 'shuffle off the mortal coil', 'hop the perch',
'run down the curtain', 'die', 'self destruct', 'explode');