Skip to content

Commit

Permalink
docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
meminuygur committed Mar 5, 2018
0 parents commit fd37d6d
Show file tree
Hide file tree
Showing 33 changed files with 825 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
COMPOSE_PROJECT_NAME=##PROJECTNAME##

NGINX_HOST=##FULL_DOMAIN_NAME##
PORT=80

MYSQL_ROOT_PASSWORD=rootpass
MYSQL_DATABASE=portakal_magento

YOUR_IP_ADDRESS=##YOUR_LOCAL_IP##
MAGENTO_MODE=developer

USER=##YOUR_UBUNTU/MAC_USERNAME##
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Editor
/.zfproject.xml
/.buildpath
/.cache
/.metadata
/.project
/.settings/
/nbproject/
/.idea/
/.idea/*
/.csscomb.json
/.phpstorm.meta.php

# Local dev files
/*.sql
/*.tgz
/*.gz
/*.zip

# Docker
/.env
/*/*_storage

# OS files
__MACOSX/
[Tt]humbs.db
*.DS_Store
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Portakal Concept Docker configuration
***
This is the Portakal Docker installation. Please follow the steps below to get it up and running.

## Project installation
***
_No need to create the database it's created when starting the containers._
Copy and rename .env.sample to .env and entered your *IP* and *USERNAME*

```bash
cd docker && docker-compose up -d
```
>The `-d` will make docker run in the background, leave this off when you want to debug or see the logs.
## Uninstall
***
_Remove the database directories inside the project_
```bash
cd docker && docker-compose down
sudo rm -Rf mysql/db_storage elastic-search/es_storage redis/redis_storage
```

20 changes: 20 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "portakal/docker",
"description": "Docker package to run Portakal Magento System",
"type": "magento-library",
"authors": [
{
"name": "Mehmet Uygur",
"email": "[email protected]"
}
],
"require": {
"composer/installers": "~1.0"
},
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
}
}

27 changes: 27 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '2'
services:
db:
extends:
file: mysql/base.yml
service: db
elastic-search:
extends:
file: elastic-search/base.yml
service: es
mailhog:
extends:
file: mailhog/base.yml
service: mailhog
php:
extends:
file: php7/base.yml
service: php
web:
extends:
file: nginx/base.yml
service: web
redis:
extends:
file: redis/base.yml
service: redis

4 changes: 4 additions & 0 deletions elastic-search/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM elasticsearch:2.4.6

RUN bin/plugin install analysis-phonetic
RUN bin/plugin install analysis-icu
12 changes: 12 additions & 0 deletions elastic-search/base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '2'
services:
es:
container_name: ${COMPOSE_PROJECT_NAME}_es
build:
context: .
dockerfile: Dockerfile
ports:
- "9200:9200"
volumes:
- ./conf/:/usr/share/elasticsearch/config/
- ./es_storage:/usr/share/elasticsearch/data
12 changes: 12 additions & 0 deletions elastic-search/conf/elasticsearch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
network.host: 0.0.0.0
script.inline: on
script.indexed: on
http.cors.allow-origin: "*"
http.cors.allow-methods: true
http.cors.allow-headers: true
http.cors.allow-credentials: true
http.cors.enabled: true

# this value is required because we set "network.host"
# be sure to modify it appropriately for a production cluster deployment
discovery.zen.minimum_master_nodes: 1
9 changes: 9 additions & 0 deletions elastic-search/conf/log4j2.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
status = error

appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = [%d{ISO8601}][%-5p][%-25c{1.}] %marker%m%n

rootLogger.level = info
rootLogger.appenderRef.console.ref = console
15 changes: 15 additions & 0 deletions elastic-search/conf/logging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# you can override this using by setting a system property, for example -Des.logger.level=DEBUG
es.logger.level: INFO
rootLogger: ${es.logger.level}, console
logger:
# log action execution errors for easier debugging
action: DEBUG
# reduce the logging for aws, too much is logged under the default INFO
com.amazonaws: WARN

appender:
console:
type: console
layout:
type: consolePattern
conversionPattern: "[%d{ISO8601}][%-5p][%-25c] %m%n"
Empty file.
3 changes: 3 additions & 0 deletions mailhog/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM mailhog/mailhog

ENV TERM xterm-256color
10 changes: 10 additions & 0 deletions mailhog/base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '2'
services:
mailhog:
container_name: ${COMPOSE_PROJECT_NAME}_mailhog
build:
context: .
dockerfile: Dockerfile
ports:
- 1025:1025
- 8025:8025
3 changes: 3 additions & 0 deletions mysql/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM percona:latest

RUN ln -sf /dev/stdout /var/lib/mysql/slow.log && ln -sf /dev/stderr /var/lib/mysql/general.log
16 changes: 16 additions & 0 deletions mysql/base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: '2'
services:
db:
container_name: ${COMPOSE_PROJECT_NAME}_mysql
# image: percona:latest
build:
context: .
dockerfile: Dockerfile
volumes:
- ./db_storage:/var/lib/mysql # Link to your local database, it will be imported when running.
- ./conf/mysql.cnf:/etc/mysql/conf.d/mysql.cnf
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
ports:
- "3306:3306"
60 changes: 60 additions & 0 deletions mysql/conf/mysql.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
[client]
default-character-set = utf8

[mysqld]
general_log_file = /var/lib/mysql/general.log
slow_query_log_file = /var/lib/mysql/slow.log

wait_timeout = 3600
performance_schema = OFF

key_buffer_size = 64M
max_allowed_packet = 64M
thread_stack = 512K
thread_cache_size = 150
query_cache_type = 1
query_cache_limit = 3M
query_cache_size = 64M
sort_buffer_size = 8M
read_buffer_size = 8M
read_rnd_buffer_size = 8M
join_buffer_size = 8M
tmp_table_size = 64M
max_connect_errors = 500
connect_timeout = 30

innodb_lock_wait_timeout = 240
innodb_buffer_pool_size = 256M
innodb_doublewrite = 0
innodb_read_io_threads = 1
innodb_write_io_threads = 1
innodb_log_file_size = 1G
innodb_io_capacity = 2500
innodb_status_file
innodb_file_per_table
innodb_flush_log_at_trx_commit = 1
innodb_table_locks = 0
innodb_log_buffer_size = 32M
innodb_lock_wait_timeout = 60
innodb_thread_concurrency = 16
innodb_commit_concurrency = 8
innodb_flush_method = O_DSYNC
innodb_support_xa = 0

skip-federated
skip-blackhole
skip-archive

init_connect="SET collation_connection = utf8_unicode_ci"
init_connect="SET NAMES utf8"
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake

[mysqldump]
quick
quote-names
max_allowed_packet = 16M

[mysql]
default-character-set = utf8
12 changes: 12 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM nginx:latest
ARG user
ENV USER ${user}

RUN echo "Creating user: $USER"

# Create local user inside the container
RUN useradd -ms /bin/bash "$USER"
# Add local user to the web group (eg. www-data)
RUN usermod -a -G www-data "$USER"

ENV TERM xterm-256color
24 changes: 24 additions & 0 deletions nginx/base.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
version: '2'
services:
web:
container_name: ${COMPOSE_PROJECT_NAME}_web
build:
context: .
dockerfile: Dockerfile
args:
user: ${USER}
privileged: true
ports:
- "${PORT}:80"
- "81:81"
- "443:443"
environment:
- NGINX_HOST=${NGINX_HOST}
- MAGENTO_MODE=${MAGENTO_MODE}
volumes:
- ../../:/var/www/html
- ./conf/nginx.conf:/etc/nginx/nginx.conf
- ./conf/default.template:/etc/nginx/conf.d/default.template
- ./conf/fastcgi_params.conf:/etc/nginx/fastcgi_params
command:
/bin/bash -c "envsubst '$$NGINX_HOST$$MAGENTO_MODE' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
Loading

0 comments on commit fd37d6d

Please sign in to comment.