Initial commit
This commit is contained in:
commit
f20aae3732
6 changed files with 651 additions and 0 deletions
45
Dockerfile
Normal file
45
Dockerfile
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
FROM debian:jessie
|
||||||
|
|
||||||
|
# Install necessary programs
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
RUN apt-get update && apt-get install -y apache2 libapache2-mod-php5 \
|
||||||
|
mysql-server php5 php5-mysql php5-mcrypt php5-curl php5-gd phpmyadmin vim \
|
||||||
|
wget curl git
|
||||||
|
|
||||||
|
# Configure apache
|
||||||
|
COPY ./config/apache2.conf /etc/apache2/apache2.conf
|
||||||
|
RUN a2enmod rewrite
|
||||||
|
|
||||||
|
# Configure MySQL
|
||||||
|
COPY ./config/my.cnf /etc/mysql/my.cnf
|
||||||
|
EXPOSE 3306
|
||||||
|
|
||||||
|
# Install composer
|
||||||
|
RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
|
||||||
|
php -r "if (hash_file('SHA384', 'composer-setup.php') === '92102166af5abdb03f49ce52a40591073a7b859a86e8ff13338cf7db58a19f7844fbc0bb79b2773bf30791e935dbd938') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
|
||||||
|
php composer-setup.php --install-dir=/usr/bin --filename=composer && \
|
||||||
|
php -r "unlink('composer-setup.php');"
|
||||||
|
|
||||||
|
# Install magerun
|
||||||
|
RUN wget https://files.magerun.net/n98-magerun.phar && \
|
||||||
|
mv n98-magerun.phar /usr/bin/ && \
|
||||||
|
echo 'alias magerun="php -f /usr/bin/n98-magerun.phar --"' >> /root/.bashrc
|
||||||
|
|
||||||
|
# Install Accolade Magerun Tools
|
||||||
|
RUN mkdir -p /usr/local/share/n98-magerun/modules && \
|
||||||
|
git clone https://github.com/Accolades/MagerunTools.git /usr/local/share/n98-magerun/modules/MagerunTools
|
||||||
|
|
||||||
|
# Install Magento Mess Detector
|
||||||
|
RUN git clone https://github.com/AOEpeople/mpmd.git /usr/local/share/n98-magerun/modules/mpmd
|
||||||
|
|
||||||
|
# Install modman
|
||||||
|
RUN wget -q --no-check-certificate -O - https://raw.github.com/colinmollenhour/modman/master/modman-installer | bash && \
|
||||||
|
mv ~/bin/modman /usr/local/bin/modman
|
||||||
|
|
||||||
|
# Start the web server
|
||||||
|
ENV APACHE_LOCK_DIR=/var/lock/apache2
|
||||||
|
ENV APACHE_PID_FILE=/var/run/apache2/apache2.pid
|
||||||
|
ENV APACHE_RUN_USER=www-data
|
||||||
|
ENV APACHE_RUN_GROUP=www-data
|
||||||
|
ENV APACHE_LOG_DIR=/var/log/apache2
|
||||||
|
ENTRYPOINT service mysql start; apache2 -DFOREGROUND
|
91
README.md
Normal file
91
README.md
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
Accolade's Docker LAMP Stack for Magento
|
||||||
|
========================================
|
||||||
|
|
||||||
|
To get started, first [download and install Docker](https://docs.docker.com/engine/installation/).
|
||||||
|
|
||||||
|
For Windows Devs
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Once you have that out of the way, you'll first need to delete the default machine, and replace it with one that has a bit more RAM. You shouldn't allocate more than half of your total RAM to the machine. Since I have 8GB of RAM, I'll allocate 4GB to Docker, so I still have a bit for my host machine:
|
||||||
|
|
||||||
|
Remove the existing machine:
|
||||||
|
|
||||||
|
`docker-machine rm default`
|
||||||
|
|
||||||
|
Replace it with a new one:
|
||||||
|
|
||||||
|
`docker-machine create -d virtualbox --virtualbox-memory "4096" default`
|
||||||
|
|
||||||
|
You can replace `default` with whatever you like. It's not very important.
|
||||||
|
|
||||||
|
With your new machine set up, cd into the directory where these files are located. Docker will start you at your home by default, so for me it's just `cd Documents/docker-lemp`
|
||||||
|
|
||||||
|
*Reminder to Windows devs:* This is a bash shell, so capitalization counts.
|
||||||
|
|
||||||
|
All Devs
|
||||||
|
|
||||||
|
From the docker-lamp directory, you can run
|
||||||
|
|
||||||
|
`docker-compose up -d`
|
||||||
|
|
||||||
|
This will take some time because Docker will have to fetch and configure the image for the LAMP stack.
|
||||||
|
|
||||||
|
Windows Devs
|
||||||
|
------------
|
||||||
|
|
||||||
|
Once the installation is complete, run
|
||||||
|
|
||||||
|
`docker-machine ip default`
|
||||||
|
|
||||||
|
to get the IP address of your Docker machine. Drop that into the address bar of your favorite browser and you should see a screen very much like this one!
|
||||||
|
|
||||||
|
Linux Devs
|
||||||
|
----------
|
||||||
|
|
||||||
|
On Linux, you can usually get away with just going to localhost (127.0.0.1)
|
||||||
|
|
||||||
|
All Devs
|
||||||
|
---------
|
||||||
|
|
||||||
|
You can also use that same IP address to set up MySQL Workbench with it, if you prefer, or you can use PHPMyAdmin, by visiting your machine's IP address at /phpmyadmin. In my case, this would be http://192.168.99.100/phpmyadmin.
|
||||||
|
|
||||||
|
The default root password is empty.
|
||||||
|
|
||||||
|
Once you have your Docker machine running, you can place your files in the public_html folder. The other folders contain configuration files, so it's not recommended to add files to them or modify them in any way.
|
||||||
|
|
||||||
|
To get shell access to your machine, there are a couple of things you have to take into consideration. The most important being that the process are each run in their own containers, so you cannot access multiple processes from the same shell. This means that you will need to open a different shell process for each running process you wish to connect to. To see a list of all of your running containers, use the following command:
|
||||||
|
|
||||||
|
`docker ps`
|
||||||
|
|
||||||
|
this will give you an output that looks something like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ docker ps
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
50d61f2b31cb dockerlemp_nginx "nginx -g 'daemon off" About an hour ago Up About an hour 0.0.0.0:80->80/tcp, 443/tcp dockerlemp_nginx_1
|
||||||
|
190bc213fe3a dockerlemp_php "php-fpm" About an hour ago Up About an hour 9000/tcp dockerlemp_php_1
|
||||||
|
fe0d4632c300 phpmyadmin/phpmyadmin "/run.sh" About an hour ago Up About an hour 0.0.0.0:8080->80/tcp dockerlemp_phpmyadmin_1
|
||||||
|
509ab5917034 dockerlemp_mysql "docker-entrypoint.sh" About an hour ago Up About an hour 0.0.0.0:3306->3306/tcp dockerlemp_mysql_1
|
||||||
|
```
|
||||||
|
|
||||||
|
By using either the container id or its name, you can connect to them with the following command:
|
||||||
|
|
||||||
|
`docker exec -it CONTAINER_NAME/ID /bin/bash`
|
||||||
|
|
||||||
|
Replace CONTAINER_NAME/ID with the name or id of the container you'd like to connect to, and you will be dropped into a bash environment where you can run commands like importing a large database into MySQL or running composer or magerun (both of which are already installed and ready to use.)
|
||||||
|
|
||||||
|
So, to run a composer installation, you would need to first run
|
||||||
|
|
||||||
|
`docker exec -it dockerlemp_php_1 /bin/bash`
|
||||||
|
|
||||||
|
to gain access to the shell, and then you could cd into the correct directory and run your composer install command.
|
||||||
|
|
||||||
|
As stated earlier, you will not have access to the mysql process from this shell. To gain that, you'll have to press `Ctrl + D` to exit the current shell, and then run
|
||||||
|
|
||||||
|
`docker exec -it dockerlemp_mysql_1 /bin/bash`
|
||||||
|
|
||||||
|
to enter a shell with access to the mysql process.
|
||||||
|
|
||||||
|
DISCLAIMER:
|
||||||
|
|
||||||
|
This Docker machine should under NO circumstances, be used in a production environment. This is solely intended for local development, and has numerous security concerns that would need to be addressed prior to being a feasible production candidate. You have been warned.
|
224
config/apache2.conf
Normal file
224
config/apache2.conf
Normal file
|
@ -0,0 +1,224 @@
|
||||||
|
# This is the main Apache server configuration file. It contains the
|
||||||
|
# configuration directives that give the server its instructions.
|
||||||
|
# See http://httpd.apache.org/docs/2.4/ for detailed information about
|
||||||
|
# the directives and /usr/share/doc/apache2/README.Debian about Debian specific
|
||||||
|
# hints.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Summary of how the Apache 2 configuration works in Debian:
|
||||||
|
# The Apache 2 web server configuration in Debian is quite different to
|
||||||
|
# upstream's suggested way to configure the web server. This is because Debian's
|
||||||
|
# default Apache2 installation attempts to make adding and removing modules,
|
||||||
|
# virtual hosts, and extra configuration directives as flexible as possible, in
|
||||||
|
# order to make automating the changes and administering the server as easy as
|
||||||
|
# possible.
|
||||||
|
|
||||||
|
# It is split into several files forming the configuration hierarchy outlined
|
||||||
|
# below, all located in the /etc/apache2/ directory:
|
||||||
|
#
|
||||||
|
# /etc/apache2/
|
||||||
|
# |-- apache2.conf
|
||||||
|
# | `-- ports.conf
|
||||||
|
# |-- mods-enabled
|
||||||
|
# | |-- *.load
|
||||||
|
# | `-- *.conf
|
||||||
|
# |-- conf-enabled
|
||||||
|
# | `-- *.conf
|
||||||
|
# `-- sites-enabled
|
||||||
|
# `-- *.conf
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# * apache2.conf is the main configuration file (this file). It puts the pieces
|
||||||
|
# together by including all remaining configuration files when starting up the
|
||||||
|
# web server.
|
||||||
|
#
|
||||||
|
# * ports.conf is always included from the main configuration file. It is
|
||||||
|
# supposed to determine listening ports for incoming connections which can be
|
||||||
|
# customized anytime.
|
||||||
|
#
|
||||||
|
# * Configuration files in the mods-enabled/, conf-enabled/ and sites-enabled/
|
||||||
|
# directories contain particular configuration snippets which manage modules,
|
||||||
|
# global configuration fragments, or virtual host configurations,
|
||||||
|
# respectively.
|
||||||
|
#
|
||||||
|
# They are activated by symlinking available configuration files from their
|
||||||
|
# respective *-available/ counterparts. These should be managed by using our
|
||||||
|
# helpers a2enmod/a2dismod, a2ensite/a2dissite and a2enconf/a2disconf. See
|
||||||
|
# their respective man pages for detailed information.
|
||||||
|
#
|
||||||
|
# * The binary is called apache2. Due to the use of environment variables, in
|
||||||
|
# the default configuration, apache2 needs to be started/stopped with
|
||||||
|
# /etc/init.d/apache2 or apache2ctl. Calling /usr/bin/apache2 directly will not
|
||||||
|
# work with the default configuration.
|
||||||
|
|
||||||
|
|
||||||
|
# Global configuration
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# ServerRoot: The top of the directory tree under which the server's
|
||||||
|
# configuration, error, and log files are kept.
|
||||||
|
#
|
||||||
|
# NOTE! If you intend to place this on an NFS (or otherwise network)
|
||||||
|
# mounted filesystem then please read the Mutex documentation (available
|
||||||
|
# at <URL:http://httpd.apache.org/docs/2.4/mod/core.html#mutex>);
|
||||||
|
# you will save yourself a lot of trouble.
|
||||||
|
#
|
||||||
|
# Do NOT add a slash at the end of the directory path.
|
||||||
|
#
|
||||||
|
#ServerRoot "/etc/apache2"
|
||||||
|
|
||||||
|
#
|
||||||
|
# The accept serialization lock file MUST BE STORED ON A LOCAL DISK.
|
||||||
|
#
|
||||||
|
Mutex file:${APACHE_LOCK_DIR} default
|
||||||
|
|
||||||
|
#
|
||||||
|
# PidFile: The file in which the server should record its process
|
||||||
|
# identification number when it starts.
|
||||||
|
# This needs to be set in /etc/apache2/envvars
|
||||||
|
#
|
||||||
|
PidFile ${APACHE_PID_FILE}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Timeout: The number of seconds before receives and sends time out.
|
||||||
|
#
|
||||||
|
Timeout 300
|
||||||
|
|
||||||
|
#
|
||||||
|
# KeepAlive: Whether or not to allow persistent connections (more than
|
||||||
|
# one request per connection). Set to "Off" to deactivate.
|
||||||
|
#
|
||||||
|
KeepAlive On
|
||||||
|
|
||||||
|
#
|
||||||
|
# MaxKeepAliveRequests: The maximum number of requests to allow
|
||||||
|
# during a persistent connection. Set to 0 to allow an unlimited amount.
|
||||||
|
# We recommend you leave this number high, for maximum performance.
|
||||||
|
#
|
||||||
|
MaxKeepAliveRequests 100
|
||||||
|
|
||||||
|
#
|
||||||
|
# KeepAliveTimeout: Number of seconds to wait for the next request from the
|
||||||
|
# same client on the same connection.
|
||||||
|
#
|
||||||
|
KeepAliveTimeout 5
|
||||||
|
|
||||||
|
|
||||||
|
# These need to be set in /etc/apache2/envvars
|
||||||
|
User ${APACHE_RUN_USER}
|
||||||
|
Group ${APACHE_RUN_GROUP}
|
||||||
|
|
||||||
|
#
|
||||||
|
# HostnameLookups: Log the names of clients or just their IP addresses
|
||||||
|
# e.g., www.apache.org (on) or 204.62.129.132 (off).
|
||||||
|
# The default is off because it'd be overall better for the net if people
|
||||||
|
# had to knowingly turn this feature on, since enabling it means that
|
||||||
|
# each client request will result in AT LEAST one lookup request to the
|
||||||
|
# nameserver.
|
||||||
|
#
|
||||||
|
HostnameLookups Off
|
||||||
|
|
||||||
|
# ErrorLog: The location of the error log file.
|
||||||
|
# If you do not specify an ErrorLog directive within a <VirtualHost>
|
||||||
|
# container, error messages relating to that virtual host will be
|
||||||
|
# logged here. If you *do* define an error logfile for a <VirtualHost>
|
||||||
|
# container, that host's errors will be logged there and not here.
|
||||||
|
#
|
||||||
|
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||||
|
|
||||||
|
#
|
||||||
|
# LogLevel: Control the severity of messages logged to the error_log.
|
||||||
|
# Available values: trace8, ..., trace1, debug, info, notice, warn,
|
||||||
|
# error, crit, alert, emerg.
|
||||||
|
# It is also possible to configure the log level for particular modules, e.g.
|
||||||
|
# "LogLevel info ssl:warn"
|
||||||
|
#
|
||||||
|
LogLevel warn
|
||||||
|
|
||||||
|
# Include module configuration:
|
||||||
|
IncludeOptional mods-enabled/*.load
|
||||||
|
IncludeOptional mods-enabled/*.conf
|
||||||
|
|
||||||
|
# Include list of ports to listen on
|
||||||
|
Include ports.conf
|
||||||
|
|
||||||
|
|
||||||
|
# Sets the default security model of the Apache2 HTTPD server. It does
|
||||||
|
# not allow access to the root filesystem outside of /usr/share and /var/www.
|
||||||
|
# The former is used by web applications packaged in Debian,
|
||||||
|
# the latter may be used for local directories served by the web server. If
|
||||||
|
# your system is serving content from a sub-directory in /srv you must allow
|
||||||
|
# access here, or in any related virtual host.
|
||||||
|
<Directory />
|
||||||
|
Options FollowSymLinks
|
||||||
|
AllowOverride None
|
||||||
|
Require all denied
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory /usr/share>
|
||||||
|
AllowOverride None
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
<Directory /var/www/>
|
||||||
|
Options Indexes FollowSymLinks
|
||||||
|
AllowOverride all
|
||||||
|
Require all granted
|
||||||
|
</Directory>
|
||||||
|
|
||||||
|
#<Directory /srv/>
|
||||||
|
# Options Indexes FollowSymLinks
|
||||||
|
# AllowOverride None
|
||||||
|
# Require all granted
|
||||||
|
#</Directory>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# AccessFileName: The name of the file to look for in each directory
|
||||||
|
# for additional configuration directives. See also the AllowOverride
|
||||||
|
# directive.
|
||||||
|
#
|
||||||
|
AccessFileName .htaccess
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following lines prevent .htaccess and .htpasswd files from being
|
||||||
|
# viewed by Web clients.
|
||||||
|
#
|
||||||
|
<FilesMatch "^\.ht">
|
||||||
|
Require all denied
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following directives define some format nicknames for use with
|
||||||
|
# a CustomLog directive.
|
||||||
|
#
|
||||||
|
# These deviate from the Common Log Format definitions in that they use %O
|
||||||
|
# (the actual bytes sent including headers) instead of %b (the size of the
|
||||||
|
# requested file), because the latter makes it impossible to detect partial
|
||||||
|
# requests.
|
||||||
|
#
|
||||||
|
# Note that the use of %{X-Forwarded-For}i instead of %h is not recommended.
|
||||||
|
# Use mod_remoteip instead.
|
||||||
|
#
|
||||||
|
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
|
||||||
|
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
|
||||||
|
LogFormat "%h %l %u %t \"%r\" %>s %O" common
|
||||||
|
LogFormat "%{Referer}i -> %U" referer
|
||||||
|
LogFormat "%{User-agent}i" agent
|
||||||
|
|
||||||
|
# Include of directories ignores editors' and dpkg's backup files,
|
||||||
|
# see README.Debian for details.
|
||||||
|
|
||||||
|
# Include generic snippets of statements
|
||||||
|
IncludeOptional conf-enabled/*.conf
|
||||||
|
|
||||||
|
# Include the virtual host configurations:
|
||||||
|
IncludeOptional sites-enabled/*.conf
|
||||||
|
|
||||||
|
# Include PHPMyAdmin
|
||||||
|
Include /etc/phpmyadmin/apache.conf
|
||||||
|
|
||||||
|
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
|
128
config/my.cnf
Normal file
128
config/my.cnf
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
#
|
||||||
|
# The MySQL database server configuration file.
|
||||||
|
#
|
||||||
|
# You can copy this to one of:
|
||||||
|
# - "/etc/mysql/my.cnf" to set global options,
|
||||||
|
# - "~/.my.cnf" to set user-specific options.
|
||||||
|
#
|
||||||
|
# One can use all long options that the program supports.
|
||||||
|
# Run program with --help to get a list of available options and with
|
||||||
|
# --print-defaults to see which it would actually understand and use.
|
||||||
|
#
|
||||||
|
# For explanations see
|
||||||
|
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
|
||||||
|
|
||||||
|
# This will be passed to all mysql clients
|
||||||
|
# It has been reported that passwords should be enclosed with ticks/quotes
|
||||||
|
# escpecially if they contain "#" chars...
|
||||||
|
# Remember to edit /etc/mysql/debian.cnf when changing the socket location.
|
||||||
|
[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]
|
||||||
|
#
|
||||||
|
# * 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
|
||||||
|
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
|
||||||
|
#
|
||||||
|
key_buffer = 16M
|
||||||
|
max_allowed_packet = 1G
|
||||||
|
thread_stack = 192K
|
||||||
|
thread_cache_size = 8
|
||||||
|
# This replaces the startup script and checks MyISAM tables if needed
|
||||||
|
# the first time they are touched
|
||||||
|
myisam-recover = BACKUP
|
||||||
|
#max_connections = 100
|
||||||
|
#table_cache = 64
|
||||||
|
#thread_concurrency = 10
|
||||||
|
#
|
||||||
|
# * Query Cache Configuration
|
||||||
|
#
|
||||||
|
query_cache_limit = 1M
|
||||||
|
query_cache_size = 16M
|
||||||
|
#
|
||||||
|
# * 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 log - should be very few entries.
|
||||||
|
#
|
||||||
|
log_error = /var/log/mysql/error.log
|
||||||
|
#
|
||||||
|
# Here you can see queries with especially long duration
|
||||||
|
#slow_query_log_file = /var/log/mysql/mysql-slow.log
|
||||||
|
#slow_query_log = 1
|
||||||
|
#long_query_time = 2
|
||||||
|
#log_queries_not_using_indexes
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
#log_bin = /var/log/mysql/mysql-bin.log
|
||||||
|
expire_logs_days = 10
|
||||||
|
max_binlog_size = 100M
|
||||||
|
#binlog_do_db = include_database_name
|
||||||
|
#binlog_ignore_db = include_database_name
|
||||||
|
#
|
||||||
|
# * 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!
|
||||||
|
#
|
||||||
|
# * Security Features
|
||||||
|
#
|
||||||
|
# Read the manual, too, if you want chroot!
|
||||||
|
# chroot = /var/lib/mysql/
|
||||||
|
#
|
||||||
|
# For generating SSL certificates I recommend the OpenSSL GUI "tinyca".
|
||||||
|
#
|
||||||
|
# ssl-ca=/etc/mysql/cacert.pem
|
||||||
|
# ssl-cert=/etc/mysql/server-cert.pem
|
||||||
|
# ssl-key=/etc/mysql/server-key.pem
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[mysqldump]
|
||||||
|
quick
|
||||||
|
quote-names
|
||||||
|
max_allowed_packet = 1G
|
||||||
|
|
||||||
|
[mysql]
|
||||||
|
#no-auto-rehash # faster start of mysql but no tab completition
|
||||||
|
|
||||||
|
[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/
|
8
docker-compose.yml
Normal file
8
docker-compose.yml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
- 3306:3306
|
||||||
|
volumes:
|
||||||
|
- /var/lib/mysql
|
||||||
|
- ./public_html:/var/www/html
|
155
public_html/index.php
Normal file
155
public_html/index.php
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: Billy
|
||||||
|
* Date: 5/10/2016
|
||||||
|
* Time: 2:15 PM
|
||||||
|
*/
|
||||||
|
|
||||||
|
$servername = "localhost";
|
||||||
|
$username = "root";
|
||||||
|
$password = "";
|
||||||
|
|
||||||
|
// Create connection
|
||||||
|
$conn = mysqli_connect($servername, $username, $password);
|
||||||
|
|
||||||
|
// Check connection
|
||||||
|
if (!$conn) {
|
||||||
|
$mysqlStatus = "Connection failed: " . mysqli_connect_error();
|
||||||
|
$color = "red";
|
||||||
|
} else {
|
||||||
|
$mysqlStatus = "Connected successfully";
|
||||||
|
$color = "green";
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Accolade Docker - LAMP Stack</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<style scoped>
|
||||||
|
body {font-family: sans-serif;}
|
||||||
|
h1, h2 {text-align: center;}
|
||||||
|
.content {
|
||||||
|
max-width: 1000px;
|
||||||
|
margin: auto;
|
||||||
|
text-align: justify;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
background-color: #012456;
|
||||||
|
color: #f1f1f1;
|
||||||
|
overflow-x: scroll;
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
.info {
|
||||||
|
border: 1px solid #FFDE73;
|
||||||
|
border-top: 3px solid #FFDE73;
|
||||||
|
padding: 15px 10px;
|
||||||
|
background: #FFF6D9;
|
||||||
|
}
|
||||||
|
.info span {
|
||||||
|
border: 1px solid #E4E4E4;
|
||||||
|
padding: 1px;
|
||||||
|
border-radius: 2px;
|
||||||
|
background: #ffffff;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="content">
|
||||||
|
<h1>Accolade's Docker LAMP Stack for Magento</h1>
|
||||||
|
<p>To get started, first <a href="https://docs.docker.com/engine/installation/" target="_blank">download and install Docker</a>.</p>
|
||||||
|
|
||||||
|
<h2>For Windows Devs</h2>
|
||||||
|
|
||||||
|
<p>Once you have that out of the way, you'll first need to delete the default machine, and replace it with one that has a bit more RAM. You shouldn't allocate more than half of your total RAM to the machine. Since I have 8GB of RAM, I'll allocate 4GB to Docker, so I still have a bit for my host machine:</p>
|
||||||
|
|
||||||
|
<p>Remove the existing machine:</p>
|
||||||
|
|
||||||
|
<pre>docker-machine rm default</pre>
|
||||||
|
|
||||||
|
<p>Replace it with a new one:</p>
|
||||||
|
|
||||||
|
<pre>docker-machine create -d virtualbox --virtualbox-memory "4096" default</pre>
|
||||||
|
|
||||||
|
<p>You can replace</p>
|
||||||
|
<pre>default</pre>
|
||||||
|
<p>with whatever you like. It's not very important.</p>
|
||||||
|
|
||||||
|
<p>With your new machine set up, cd into the directory where these files are located. Docker will start you at your home by default, so for me it's just</p>
|
||||||
|
|
||||||
|
<pre>cd Documents/docker-lemp</pre>
|
||||||
|
|
||||||
|
<p><i>Reminder to Windows devs:</i> This is a bash shell, so capitalization counts.</p>
|
||||||
|
|
||||||
|
<h2>All Devs</h2>
|
||||||
|
|
||||||
|
<p>From the docker-lamp directory, you can run</p>
|
||||||
|
|
||||||
|
<pre>docker-compose up -d</pre>
|
||||||
|
|
||||||
|
<p>This will take some time because Docker will have to fetch and configure the image for the LAMP stack.</p>
|
||||||
|
|
||||||
|
<h2>Windows Devs</h2>
|
||||||
|
|
||||||
|
<p>Once the installation is complete, run</p>
|
||||||
|
|
||||||
|
<pre>docker-machine ip default</pre>
|
||||||
|
|
||||||
|
<p>to get the IP address of your Docker machine. Drop that into the address bar of your favorite browser and you should see a screen very much like this one!</p>
|
||||||
|
|
||||||
|
<h2>Linux Devs</h2>
|
||||||
|
|
||||||
|
<p>On Linux, you can usually get away with just going to localhost (127.0.0.1)</p>
|
||||||
|
|
||||||
|
<h2>All Devs</h2>
|
||||||
|
|
||||||
|
<p>You can also use that same IP address to set up MySQL Workbench with it, if you prefer, or you can use PHPMyAdmin, by visiting your machine's IP address at /phpmyadmin. In my case, this would be <a href="http://192.168.99.100/phpmyadmin" target="_blank">http://192.168.99.100/phpmyadmin</a>.</p>
|
||||||
|
|
||||||
|
<p>The default root password is empty.</p>
|
||||||
|
|
||||||
|
<p>Once you have your Docker machine running, you can place your files in the public_html folder. The other folders contain configuration files, so it's not recommended to add files to them or modify them in any way.</p>
|
||||||
|
|
||||||
|
<p>To get shell access to your machine, there are a couple of things you have to take into consideration. The most important being that the process are each run in their own containers, so you cannot access multiple processes from the same shell. This means that you will need to open a different shell process for each running process you wish to connect to. To see a list of all of your running containers, use the following command:</p>
|
||||||
|
|
||||||
|
<pre>docker ps</pre>
|
||||||
|
|
||||||
|
<p>this will give you an output that looks something like this:</p>
|
||||||
|
|
||||||
|
<pre>$ docker ps
|
||||||
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
|
50d61f2b31cb dockerlemp_nginx "nginx -g 'daemon off" About an hour ago Up About an hour 0.0.0.0:80->80/tcp, 443/tcp dockerlemp_nginx_1
|
||||||
|
190bc213fe3a dockerlemp_php "php-fpm" About an hour ago Up About an hour 9000/tcp dockerlemp_php_1
|
||||||
|
fe0d4632c300 phpmyadmin/phpmyadmin "/run.sh" About an hour ago Up About an hour 0.0.0.0:8080->80/tcp dockerlemp_phpmyadmin_1
|
||||||
|
509ab5917034 dockerlemp_mysql "docker-entrypoint.sh" About an hour ago Up About an hour 0.0.0.0:3306->3306/tcp dockerlemp_mysql_1
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>By using either the container id or its name, you can connect to them with the following command:</p>
|
||||||
|
|
||||||
|
<pre>docker exec -it CONTAINER_NAME/ID /bin/bash</pre>
|
||||||
|
|
||||||
|
<p>Replace CONTAINER_NAME/ID with the name or id of the container you'd like to connect to, and you will be dropped into a bash environment where you can run commands like importing a large database into MySQL or running composer or magerun (both of which are already installed and ready to use.)</p>
|
||||||
|
|
||||||
|
<p>So, to run a composer installation, you would need to first run</p>
|
||||||
|
|
||||||
|
<pre>docker exec -it dockerlemp_php_1 /bin/bash</pre>
|
||||||
|
|
||||||
|
<p>to gain access to the shell, and then you could cd into the correct directory and run your composer install command.</p>
|
||||||
|
|
||||||
|
<p>As stated earlier, you will not have access to the mysql process from this shell. To gain that, you'll have to press</p>
|
||||||
|
<pre>Ctrl + D</pre>
|
||||||
|
<p>to exit the current shell, and then run</p>
|
||||||
|
|
||||||
|
<pre>docker exec -it dockerlemp_mysql_1 /bin/bash</pre>
|
||||||
|
|
||||||
|
<p>to enter a shell with access to the mysql process.</p>
|
||||||
|
|
||||||
|
<p class="info">For all questions and concerns, ping <span>@Billy</span> in Flowdock</p>
|
||||||
|
|
||||||
|
<h2>DISCLAIMER:</h2>
|
||||||
|
|
||||||
|
<p>This Docker machine should under NO circumstances, be used in a production environment. This is solely intended for local development, and has numerous security concerns that would need to be addressed prior to being a feasible production candidate. You have been warned.</p>
|
||||||
|
<p>MySQL Connection Status: <span style="color: <?php echo $color; ?>;"><?php echo $mysqlStatus; ?></span></p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in a new issue