Skip to content

Commit

Permalink
pure YOURLS v1.7.2 with docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
guessi committed May 7, 2017
0 parents commit de47814
Show file tree
Hide file tree
Showing 11 changed files with 196 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
docker-compose.yaml
volumes
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
volumes/var/lib/mysql/*
!volumes/var/lib/mysql/.PLACEHOLDER
8 changes: 8 additions & 0 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /yourls-loader.php [L]
</IfModule>
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM php:5.6-apache

ENV YOURLS_VERSION 1.7.2
ENV YOURLS_PACKAGE https://github.com/YOURLS/YOURLS/archive/${YOURLS_VERSION}.tar.gz

RUN docker-php-ext-install pdo_mysql mysqli mbstring && \
a2enmod rewrite ssl

RUN mkdir -p /opt/yourls && \
curl -sSL ${YOURLS_PACKAGE} -o /tmp/yourls.tar.gz && \
tar xf /tmp/yourls.tar.gz --strip-components=1 --directory=/opt/yourls

RUN sed -i -e '/ServerTokens/s/^.*$/ServerTokens Prod/g' \
-e '/ServerSignature/s/^.*$/ServerSignature Off/g' \
/etc/apache2/conf-available/security.conf

RUN apt-get update && \
apt-get install --no-install-recommends -y git-core && \
apt-get clean

ADD conf/ /

WORKDIR /opt/yourls
29 changes: 29 additions & 0 deletions conf/etc/apache2/sites-enabled/000-default.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<VirtualHost *:80>
ServerName yourls

ServerAdmin no-reply@localhost
DocumentRoot /opt/yourls

<Directory /opt/yourls>
DirectoryIndex index.php index.html
Options All
AllowOverride All
Require all granted
</Directory>

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
17 changes: 17 additions & 0 deletions conf/opt/yourls/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ /yourls-loader.php [L]
</IfModule>

<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>

<files config.php>
order allow,deny
deny from all
</files>
Empty file added conf/opt/yourls/index.php
Empty file.
87 changes: 87 additions & 0 deletions conf/opt/yourls/user/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php
/*
** MySQL settings - You can get this info from your web host
*/

/** MySQL database username */
define( 'YOURLS_DB_USER', 'yourls' );

/** MySQL database password */
define( 'YOURLS_DB_PASS', 'mysecretpassword' );

/** The name of the database for YOURLS */
define( 'YOURLS_DB_NAME', 'yourls' );

/** MySQL hostname.
** If using a non standard port, specify it like 'hostname:port', eg. 'localhost:9999' or '127.0.0.1:666' */
define( 'YOURLS_DB_HOST', 'mysql' );

/** MySQL tables prefix */
define( 'YOURLS_DB_PREFIX', 'yourls_' );

/*
** Site options
*/

/** YOURLS installation URL -- all lowercase and with no trailing slash.
** If you define it to "http://sho.rt", don't use "http://www.sho.rt" in your browser (and vice-versa) */
define( 'YOURLS_SITE', 'http://localhost' );

/** Server timezone GMT offset */
define( 'YOURLS_HOURS_OFFSET', 0 );

/** YOURLS language
** Change this setting to use a translation file for your language, instead of the default English.
** That translation file (a .mo file) must be installed in the user/language directory.
** See http://yourls.org/translations for more information */
define( 'YOURLS_LANG', '' );

/** Allow multiple short URLs for a same long URL
** Set to true to have only one pair of shortURL/longURL (default YOURLS behavior)
** Set to false to allow multiple short URLs pointing to the same long URL (bit.ly behavior) */
define( 'YOURLS_UNIQUE_URLS', true );

/** Private means the Admin area will be protected with login/pass as defined below.
** Set to false for public usage (eg on a restricted intranet or for test setups)
** Read http://yourls.org/privatepublic for more details if you're unsure */
define( 'YOURLS_PRIVATE', true );

/** A random secret hash used to encrypt cookies. You don't have to remember it, make it long and complicated. Hint: copy from http://yourls.org/cookie **/
define( 'YOURLS_COOKIEKEY', 'modify this text with something random' );

/** Username(s) and password(s) allowed to access the site. Passwords either in plain text or as encrypted hashes
** YOURLS will auto encrypt plain text passwords in this file
** Read http://yourls.org/userpassword for more information */
$yourls_user_passwords = array(
'admin' => 'adminsecretpassword',
// 'username2' => 'password2',
// You can have one or more 'login'=>'password' lines
);

/** Debug mode to output some internal information
** Default is false for live site. Enable when coding or before submitting a new issue */
define( 'YOURLS_DEBUG', false );

/*
** URL Shortening settings
*/

/** URL shortening method: 36 or 62 */
define( 'YOURLS_URL_CONVERT', 36 );
/*
* 36: generates all lowercase keywords (ie: 13jkm)
* 62: generates mixed case keywords (ie: 13jKm or 13JKm)
* Stick to one setting. It's best not to change after you've started creating links.
*/

/**
* Reserved keywords (so that generated URLs won't match them)
* Define here negative, unwanted or potentially misleading keywords.
*/
$yourls_reserved_URL = array(
'porn', 'faggot', 'sex', 'nigger', 'fuck', 'cunt', 'dick',
);

/*
** Personal settings would go after here.
*/
Empty file.
28 changes: 28 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: '2'

services:
mysql:
image: mysql
container_name: yourls-mysql
environment:
- MYSQL_ROOT_PASSWORD=rootsecretpassword
- MYSQL_USER=yourls
- MYSQL_PASSWORD=mysecretpassword
- MYSQL_DATABASE=yourls
volumes:
- ./volumes/var/lib/mysql:/var/lib/mysql:rw
privileged: true

yourls:
build: ./
container_name: yourls
links:
- mysql:mysql
environment:
- MYSQL_USER=yourls
- MYSQL_PASSWORD=mysecretpassword
- MYSQL_DATABASE=yourls
ports:
- "80:80"
depends_on:
- mysql
Empty file.

0 comments on commit de47814

Please sign in to comment.