Skip to content

Commit

Permalink
finally working
Browse files Browse the repository at this point in the history
  • Loading branch information
noogen committed Oct 26, 2018
1 parent d00af64 commit 7c5b36d
Show file tree
Hide file tree
Showing 15 changed files with 616 additions and 167 deletions.
Empty file added .docker/.gitkeep
Empty file.
150 changes: 150 additions & 0 deletions .docker/conf/my.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock

# Here is entries for some specific programs
# The following values assume you have at least 32M ram
# This was formally known as [safe_mysqld]. Both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
skip-host-cache
skip-name-resolve

#
# * Basic Settings
#
#user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc_messages_dir = /usr/share/mysql
lc_messages = en_US
skip-external-locking

#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
# bind-address = 127.0.0.1
#
# * Fine Tuning
#
max_connections = 100
connect_timeout = 5
wait_timeout = 600
max_allowed_packet = 16M
thread_cache_size = 128
sort_buffer_size = 4M
bulk_insert_buffer_size = 16M
tmp_table_size = 32M
max_heap_table_size = 32M

#
# * MyISAM
#
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched. On error, make copy and try a repair.
myisam_recover_options = BACKUP
key_buffer_size = 128M
open-files-limit = 2000
table_open_cache = 400
myisam_sort_buffer_size = 512M
concurrent_insert = 2
read_buffer_size = 2M
read_rnd_buffer_size = 1M

#
# * Query Cache Configuration
#
# Cache only tiny result sets, so we can fit more in the query cache.
query_cache_limit = 128K
query_cache_size = 64M

# for more write intensive setups, set to DEMAND or OFF
#query_cache_type = DEMAND
#
# * Logging and Replication
#
# Both location gets rotated by the cronjob.
# Be aware that this log type is a performance killer.
# As of 5.1 you can enable the log at runtime!
#general_log_file = /var/log/mysql/mysql.log
#general_log = 1
#
# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.
#
# we do want to know about network errors and such
#log_warnings = 2
#
# Enable the slow query log to see queries with especially long duration
#slow_query_log[={0|1}]
slow_query_log_file = /var/log/mysql/mariadb-slow.log
long_query_time = 10

#log_slow_rate_limit = 1000
#log_slow_verbosity = query_plan

#log-queries-not-using-indexes
#log_slow_admin_statements
#
# The following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see README.Debian about
# other settings you may need to change.
#server-id = 1
#report_host = master1
#auto_increment_increment = 2
#auto_increment_offset = 1
#log_bin = /var/log/mysql/mariadb-bin
#log_bin_index = /var/log/mysql/mariadb-bin.index
# not fab for performance, but safer
#sync_binlog = 1
expire_logs_days = 10
max_binlog_size = 100M

# slaves
#relay_log = /var/log/mysql/relay-bin
#relay_log_index = /var/log/mysql/relay-bin.index
#relay_log_info_file = /var/log/mysql/relay-bin.info
#log_slave_updates
#read_only
#
# If applications support it, this stricter sql_mode prevents some
# mistakes like inserting invalid dates etc.
#sql_mode = NO_ENGINE_SUBSTITUTION,TRADITIONAL
#
# * InnoDB
#
# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/.
# Read the manual for more InnoDB related options. There are many!
default_storage_engine = InnoDB

# you can't just change log file size, requires special procedure
#innodb_log_file_size = 50M
innodb_buffer_pool_size = 256M
innodb_log_buffer_size = 8M
innodb_file_per_table = 1
innodb_open_files = 400
innodb_io_capacity = 400
innodb_flush_method = O_DIRECT

[mysqldump]
quick
quote-names
max_allowed_packet = 16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completion

[isamchk]
key_buffer = 16M

#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/
141 changes: 141 additions & 0 deletions .docker/conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# Server globals
user www-data;
worker_processes auto;
worker_rlimit_nofile 65535;
error_log /var/log/nginx/error.log crit;
pid /var/run/nginx.pid;


# Worker config
events {
worker_connections 8192;
use epoll;
multi_accept on;
}


http {
# Main settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;
client_header_timeout 1m;
client_body_timeout 1m;
client_header_buffer_size 2k;
client_body_buffer_size 256k;
client_max_body_size 256m;
large_client_header_buffers 4 8k;
send_timeout 60;
keepalive_timeout 60;
reset_timedout_connection on;

server_tokens off;
server_name_in_redirect off;
server_names_hash_max_size 512;
server_names_hash_bucket_size 512;


# Log format
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
log_format bytes '$body_bytes_sent';

#access_log /var/log/nginx/access.log main;
access_log off;


# Mime settings
include /etc/nginx/mime.types;
default_type application/octet-stream;


# Compression
gzip on;
gzip_comp_level 9;
gzip_min_length 512;
gzip_buffers 8 64k;
gzip_types text/plain text/css text/javascript text/js text/xml application/json application/javascript application/x-javascript application/xml application/xml+rss application/x-font-ttf image/svg+xml font/opentype;
gzip_proxied any;
gzip_disable "MSIE [1-6]\.";


# Proxy settings
proxy_http_version 1.1;
proxy_redirect off; # not what you think - it simply cancel default nginx behavior
proxy_connect_timeout 5m;
proxy_send_timeout 5m;
proxy_read_timeout 5m;
proxy_buffers 32 4k;

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;


# SSL PCI Compliance
ssl_session_cache shared:SSL:10m;
ssl_protocols TLSv1.1 TLSv1.2; # TLSv1 prevented for PCI-DSS compliance
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+AESGCM+AES128:EECDH+AESGCM+AES256:EDH+AESGCM+AES128:EDH+AESGCM+AES256:EECDH+SHA256+AES128:EECDH+SHA384+AES256:EDH+SHA256+AES128:EDH+SHA256+AES256:EECDH+SHA1+AES128:EECDH+SHA1+AES256:EDH+SHA1+AES128:EDH+SHA1+AES256:EECDH+HIGH:EDH+HIGH:AESGCM+AES128:AESGCM+AES256:SHA256+AES128:SHA256+AES256:SHA1+AES128:SHA1+AES256:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!KRB5:!aECDH:!3DES";


# Error pages
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 502 503 504 /error/50x.html;


# Cache settings
proxy_cache_path /var/cache/nginx/site levels=1:2 keys_zone=site_diskcached:10m max_size=5g inactive=45m use_temp_path=off;
proxy_cache_path /var/cache/nginx/disk levels=1:2 keys_zone=my_diskcached:50m max_size=7g inactive=7d use_temp_path=off;

proxy_cache_key $host$request_uri;
proxy_temp_path /var/cache/nginx/temp;
proxy_ignore_headers Vary Expires Set-Cookie Cache-Control;
proxy_pass_request_headers on;
underscores_in_headers on;

proxy_cache_min_uses 2;
proxy_cache site_diskcached;
proxy_ssl_server_name on;
proxy_intercept_errors on;


# set mininum cache valid to 60 seconds, a small amount goes a long way
proxy_cache_valid any 60s;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;


# File cache settings
open_file_cache max=20000 inactive=30s;
open_file_cache_valid 60s;
open_file_cache_min_uses 2;
open_file_cache_errors off;


# Other settings
log_subrequest on;
rewrite_log on;


# A DNS resolver must be defined for OSCP stapling to function.
resolver 8.8.8.8 8.8.4.4;

# Cache bypass
map $http_cookie $no_cache {
default 0;
~SESS 1;
~wordpress_logged_in 1;
~CONCRETE5 1;
~wp-postpass 1;
~comment_author 1;
}

# Additional conf
include /etc/nginx/conf.d/*.conf;
}
9 changes: 9 additions & 0 deletions .docker/conf/php-fpm.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
listen = 0.0.0.0:9000

pm = dynamic
pm.max_children = 20
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3

catch_workers_output = yes
30 changes: 30 additions & 0 deletions .docker/conf/site.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
fastcgi_cache_path /var/cache/nginx/one levels=1:2 keys_zone=fpm_one:10m max_size=5g inactive=45m use_temp_path=off;

server {
listen 80;

server_name _;

error_log /var/log/nginx/error.log;
access_log /var/log/nginx/access.log;

index index.php index.html index.htm;

root /var/www/public;

# Point index to the Laravel front controller.
index index.php;

location / {
try_files $uri $uri/ /index.php;
}

location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass app:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Empty file added .docker/logs/.gitkeep
Empty file.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ indent_size = 2
indent_style = space
indent_size = 2

[*.{php,json}]
[*.{php,json,conf}]
indent_style = space
indent_size = 4
43 changes: 43 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
APP_NAME=laratt
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_URL=http://laratt.test
APP_DOMAIN=laratt.test
APP_API="/api/v1"

API_KEY=

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=dbhost
DB_PORT=3306
DB_DATABASE=laratt
DB_USERNAME=homestead
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_FROM_ADDRESS=[email protected]
MAIL_FROM_NAME="Me"

MAIL_DRIVER=smtp
MAIL_HOST=niiknow.org
MAIL_PORT=25
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=
AWS_BUCKET_AUDIT=
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.idea
.DS_Store
.docker/data/*/**
.docker/data/**
!.docker/data/*/*.gitkeep
!.docker/data/*.gitkeep
.env
src/storage/installed
Loading

0 comments on commit 7c5b36d

Please sign in to comment.