Skip to content

Commit

Permalink
Add phpcensor worker image. Separate worker and web part
Browse files Browse the repository at this point in the history
  • Loading branch information
ketchoop committed Feb 5, 2017
1 parent 129dd9d commit 8fd88e4
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
30 changes: 30 additions & 0 deletions worker/Dockerfile
@@ -0,0 +1,30 @@
FROM php:7.0.15-alpine

MAINTAINER Alexey Boyko <ket4yiit@gmail.com>

ENV PHPCENSOR_VERSION=0.7.0

WORKDIR /var/www/html

RUN apk update && \
apk add git openssh postgresql-dev gettext && \
curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/bin/composer

RUN docker-php-ext-install -j$(grep -c ^processor /proc/cpuinfo) pdo pdo_mysql pdo_pgsql

RUN git clone https://github.com/corpsee/php-censor.git .
RUN composer install

ADD entrypoint.sh /
ADD config.tmpl.yml /

ENV DB_HOST=localhost
ENV DB_TYPE=mysql
ENV DB_NAME=phpcensor
ENV DB_USER=phpcensor
ENV DB_PASS=changethepass
ENV BEANSTALK_HOST=beanstalk
ENV BEANSTALK_QUEUE_NAME=phpcensor

ENTRYPOINT ["/entrypoint.sh"]
49 changes: 49 additions & 0 deletions worker/config.tmpl.yml
@@ -0,0 +1,49 @@
b8:
database:
servers:
read:
- host: $LOCAL_DB_HOST
port: $LOCAL_DB_PORT
write:
- host: $LOCAL_DB_HOST
port: $LOCAL_DB_PORT
type: $DB_TYPE
name: $DB_NAME
username: $DB_USER
password: $DB_PASS
php-censor:
language: en
per_page: 10
url: '$SITE_URL'
email_settings:
from_address: $SMTP_FROM
smtp_address: $SMTP_HOST
smtp_port: $SMTP_PORT
smtp_username: $SMTP_USER
smtp_password: $SMTP_PASSWORD
default_mailto_address: $SMTP_DEFAULTTO
smtp_encryption: $SMTP_ENCRYPT
queue:
host: $BEANSTALK_HOST
name: $BEANSTALK_QUEUE_NAME
lifetime: 600
github:
token: $GITHUB_TOKEN
comments:
commit: false
pull_request: false
build:
remove_builds: true
security:
disable_auth: false
default_user_id: 1
auth_providers:
internal:
type: internal
ldap:
type: ldap
data:
host: $LDAP_HOST
port: $LDAP_PORT
base_dn: $LDAP_BASE_DN
mail_attribute: $LDAP_MAIL_ATTRIBUTE
8 changes: 8 additions & 0 deletions worker/entrypoint.sh
@@ -0,0 +1,8 @@
#!/bin/sh
set -eo pipefail

export LOCAL_DB_HOST=$(echo $DB_HOST | awk -F ":" '{ print $1 }')
export LOCAL_DB_PORT=$(echo $DB_HOST | awk -F ":" '{ print $2; }')

[ ! -f ./app/config.yml ] && envsubst < /config.tmpl.yml > ./app/config.yml
./bin/console php-censor:worker

0 comments on commit 8fd88e4

Please sign in to comment.