-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ae0f396
Showing
14 changed files
with
226 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.git | ||
.gitignore | ||
LICENSE | ||
VERSION | ||
README.md | ||
Changelog.md | ||
Makefile | ||
docker-compose.yml | ||
docs | ||
/.docker | ||
/.ssh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
APP_HOST=packagist.mycompany.org | ||
DATABASE_PORT=5432 | ||
DATABASE_DRIVER=pdo_pgsql | ||
DATABASE_USER=postgres | ||
DATABASE_NAME=packagist | ||
DATABASE_HOST=postgres | ||
DATABASE_PASSWORD=123456 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
FROM ubuntu:xenial | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 | ||
|
||
RUN apt-get update && apt-get install -y locales language-pack-en-base | ||
|
||
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \ | ||
dpkg-reconfigure --frontend=noninteractive locales && \ | ||
update-locale LANG=en_US.UTF-8 | ||
|
||
RUN apt-get update && apt-get install -y --force-yes --no-install-recommends \ | ||
software-properties-common cron nano curl supervisor ssh npm nginx \ | ||
iputils-ping net-tools less | ||
|
||
RUN add-apt-repository ppa:git-core/ppa && add-apt-repository ppa:ondrej/php && \ | ||
apt-get update && apt-get install -y --force-yes --no-install-recommends git redis-server \ | ||
php7.1-fpm php7.1-cli php7.1-common php7.1-dev php7.1-pgsql php7.1-mysql php7.1-curl php7.1-redis \ | ||
php7.1-xmlrpc php7.1-mbstring php7.1-apcu php7.1-xsl php7.1-intl php7.1-zip php7.1-bz2 | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
RUN sed -i -e "s/;daemonize\s*=\s*yes/daemonize = no/g" /etc/php/7.1/fpm/php-fpm.conf && \ | ||
sed -i "s/;date.timezone =.*/date.timezone = UTC/" /etc/php/7.1/fpm/php.ini && \ | ||
sed -i "s/;date.timezone =.*/date.timezone = UTC/" /etc/php/7.1/cli/php.ini && \ | ||
sed -i "s/memory_limit = .*/memory_limit = 1024M/" /etc/php/7.1/fpm/php.ini && \ | ||
sed -i "s/memory_limit = .*/memory_limit = 1024M/" /etc/php/7.1/cli/php.ini && \ | ||
sed -i "s/max_execution_time = .*/max_execution_time = 300/" /etc/php/7.1/fpm/php.ini && \ | ||
sed -i "1 a\apc.shm_size=128M" /etc/php/7.1/fpm/php.ini | ||
|
||
COPY supervisor* /etc/supervisor/conf.d/ | ||
COPY config/packagist.conf /etc/nginx/sites-enabled/default | ||
COPY config/nginx.conf /etc/nginx/nginx.conf | ||
COPY config/cron.conf /tmp/cron.conf | ||
COPY scripts/app.sh /usr/local/bin/app | ||
|
||
RUN crontab -u www-data /tmp/cron.conf && mkdir -p /run/php/ && \ | ||
chmod +x /usr/local/bin/app | ||
|
||
USER www-data | ||
RUN git clone https://github.com/vtsykun/private-packagist.git /var/www/packagist && \ | ||
cp /var/www/packagist/app/config/parameters.yml.dist /var/www/packagist/app/config/parameters.yml && \ | ||
composer install --no-interaction --no-suggest --prefer-dist --working-dir /var/www/packagist | ||
|
||
USER root | ||
WORKDIR /var/www/packagist | ||
|
||
CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"] | ||
|
||
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*/30 * * * * /var/www/packagist/bin/console --env=prod packagist:update >> /dev/null | ||
0 0 * * * /var/www/packagist/bin/console --env=prod packagist:stats:compile >> /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
daemon off; | ||
user www-data; | ||
worker_processes auto; | ||
pid /run/nginx.pid; | ||
|
||
events { | ||
worker_connections 768; | ||
} | ||
|
||
http { | ||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
keepalive_timeout 65; | ||
types_hash_max_size 2048; | ||
|
||
default_type application/octet-stream; | ||
include /etc/nginx/mime.types; | ||
|
||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE | ||
ssl_prefer_server_ciphers on; | ||
|
||
access_log /var/log/nginx/access.log; | ||
error_log /var/log/nginx/error.log; | ||
|
||
gzip on; | ||
gzip_disable "msie6"; | ||
client_max_body_size 256M; | ||
include /etc/nginx/conf.d/*.conf; | ||
include /etc/nginx/sites-enabled/*; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
server { | ||
listen 80 default_server; | ||
root /var/www/packagist/web; | ||
|
||
location / { | ||
try_files $uri @rewriteapp; | ||
} | ||
|
||
location @rewriteapp { | ||
rewrite ^(.*)$ /app.php/$1 last; | ||
} | ||
|
||
location ~ ^/(app|app_dev)\.php(/|$) { | ||
fastcgi_split_path_info ^(.+\.php)(/.*)$; | ||
include fastcgi_params; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
fastcgi_index app.php; | ||
send_timeout 600; | ||
fastcgi_read_timeout 600; | ||
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; | ||
} | ||
|
||
location ~ \.php$ { | ||
fastcgi_split_path_info ^(.+\.php)(/.+)$; | ||
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; | ||
fastcgi_index index.php; | ||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | ||
include fastcgi_params; | ||
} | ||
|
||
error_log /var/log/nginx/packagist_error.log; | ||
access_log /var/log/nginx/packagist_access.log; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: '2' | ||
|
||
services: | ||
postgres: | ||
hostname: postgres | ||
image: postgres:9.6 | ||
volumes: | ||
- .docker/db:/var/lib/postgresql/data | ||
environment: | ||
POSTGRES_DB: ${DATABASE_NAME} | ||
POSTGRES_PASSWORD: ${DATABASE_PASSWORD} | ||
expose: | ||
- "5432" | ||
packagist: | ||
image: okvpn/packagist:1.0 | ||
container_name: private-packagist | ||
hostname: pkg | ||
volumes: | ||
- .docker/redis:/var/lib/redis | ||
- .docker/tmp/www-composer:/var/www/.composer | ||
- .ssh:/var/tmp/ssh | ||
links: | ||
- "postgres" | ||
environment: | ||
PRIVATE_REPO_DOMAIN_LIST: bitbucket.org gitlab.com github.com | ||
VIRTUAL_HOST: ${APP_HOST} | ||
DATABASE_HOST: ${DATABASE_HOST} | ||
DATABASE_PORT: ${DATABASE_PORT} | ||
DATABASE_DRIVER: ${DATABASE_DRIVER} | ||
DATABASE_USER: ${DATABASE_USER} | ||
DATABASE_NAME: ${DATABASE_NAME} | ||
DATABASE_PASSWORD: ${DATABASE_PASSWORD} | ||
ports: | ||
- 127.0.0.1:8088:80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
START=`date +%s` | ||
|
||
if [ -f app/console ]; then | ||
php app/fast_console "$@" | ||
elif [ -f bin/console ]; then | ||
php bin/console "$@" | ||
else | ||
echo "Not found symfony project" | ||
exit 1 | ||
fi | ||
|
||
END=`date +%s` | ||
SECONDS=$(($END-$START)) | ||
|
||
echo "Execution time - $(($SECONDS/60)) minutes $(($SECONDS%60)) seconds" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[program:pkg-workers] | ||
environment = | ||
HOME=/var/www/ | ||
command=/bin/bash -c "php -r 'while (file_exists(\"/var/www/packagist/lock.txt\")){sleep(2);}' && /var/www/packagist/bin/console packagist:run-workers --env=prod --no-debug" | ||
directory=/var/www/packagist/ | ||
process_name=%(program_name)s_%(process_num)02d | ||
numprocs=1 | ||
autostart=true | ||
autorestart=true | ||
startsecs=0 | ||
redirect_stderr=true | ||
priority=1 | ||
user=www-data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[program:install] | ||
command=/bin/bash -c "/root/scripts/start.sh" | ||
numprocs=1 | ||
startsecs=0 | ||
priority=1 | ||
stdout_logfile=/dev/fd/1 | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[program:cron] | ||
command=/usr/sbin/cron -f | ||
autostart = true | ||
autorestart=true | ||
priority=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[program:nginx] | ||
command = /usr/sbin/nginx | ||
autostart = true | ||
autorestart=true | ||
priority=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[program:php] | ||
command = php-fpm7.1 | ||
autostart = true | ||
autorestart=true | ||
priority=2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[program:redis] | ||
command=redis-server | ||
autostart=true | ||
autorestart=true | ||
directory=/var/lib/redis | ||
priority=5 |