GithubHelp home page GithubHelp logo

nazar-pc / docker-webserver Goto Github PK

View Code? Open in Web Editor NEW
291.0 27.0 53.0 131 KB

WebServer (MariaDB, PHP-FPM, Nginx) composed from several separate containers linked together

Home Page: https://registry.hub.docker.com/u/nazarpc/webserver/

License: MIT License

Shell 100.00%
docker webserver php mariadb nginx ssh backup restore docker-container

docker-webserver's Introduction

WebServer (MariaDB, PHP-FPM, Nginx) composed from several separate containers linked together

Currently WebServer consists of such images:

  • Data-only container (based on official debian:jessie image)
  • Logrotate container (based on official debian:jessie image)
  • MariaDB (based on official MariaDB image)
  • Nginx (based on official Nginx image)
  • PHP-FPM (based on nazarpc/php:fpm image, which is official image + bunch of frequently used PHP extensions)
  • SSH (based on phusion/baseimage image, contains pre-installed curl, git, mc, wget, php-cli and composer for your convenience)
  • PhpMyAdmin (based on nazarpc/phpmyadmin image, which is official php image with Apache2, where PhpMyAdmin was installed)
  • Ceph (based on upstream ceph/daemon image)
  • Consul (based on official debian:jessie image)
  • HAProxy (based on official haproxy image)
  • Backup container (based on official debian:jessie image)
  • Restore container (based on official debian:jessie image)
  • nazarpc/webserver-apps for ready to use applications that plays nicely with images mentioned above

If you find this project useful, consider supporting its development on patreon.com/nazarpc, this would help me a lot!

How to use

The most convenient way to use all this is Docker Compose

At first you'll need to create persistent data-only container that will store all files, databases, ssh keys and settings of all these things:

docker run --name example.com nazarpc/webserver:data-v1

NOTE: -v1 suffix here and in all other places is optional (there are also images without -v1 suffix and they are exactly the same), however, it is possible that in future images without suffixes become completely incompatible and -v2 suffixed images will be introduced, so you'd better be protected from upgrading to incompatible image rather than getting broken setup at some point in future (this might not happen ever, but still).

This container will start and stop immediately, that is OK.

After this create directory for your website, it will contain docker-compose.yml file and potentially more files you'll need:

mkdir example.com
cd example.com

Now create docker-compose.yml inside with following contents:

version: '2'
services:
  data:
    image: nazarpc/webserver:data-v1
    volumes_from:
      - container:example.com
  
  logrotate:
    image: nazarpc/webserver:logrotate-v1
    restart: always
    volumes_from:
      - data
  
  mariadb:
    image: nazarpc/webserver:mariadb-v1
    restart: always
    volumes_from:
      - data
  
  nginx:
    image: nazarpc/webserver:nginx-v1
    links:
      - php
#    ports:
#      - {ip where to bind}:{port on previous ip where to bind}:80
    restart: always
    volumes_from:
      - data
  
  php:
    image: nazarpc/webserver:php-fpm-v1
    links:
      - mariadb:mysql
    restart: always
    volumes_from:
      - data
  
#  phpmyadmin:
#    image: nazarpc/webserver:phpmyadmin-v1
#    links:
#      - mariadb:mysql
#    restart: always
#    ports:
#      - {ip where to bind}:{port on previous ip where to bind}:80
  
  ssh:
    image: nazarpc/webserver:ssh-v1
    restart: always
    volumes_from:
      - data
#    ports:
#      - {ip where to bind}:{port on previous ip where to bind}:22
#    environment:
#      PUBLIC_KEY: '{your public SSH key}'

Now customize it as you like, feel free to comment-out or remove mariadb, php or ssh container if you have just bunch of static files, also you can uncomment phpmyadmin container if needed.

When you're done with editing:

docker-compose up -d

That is it, you have whole WebServer up and running!

Also you might be interested in advanced examples with load balancing and scaling across cluster.

Upgrade

You can easily upgrade your WebServer to new version of software.

Using Docker Compose upgrade is very simple:

docker-compose pull
docker-compose up -d

All containers will be recreated from new images in few seconds.

Backup/restore images are not present in docker-compose.yml, so if you're using them - pull them manually.

Alternatively you can pull all images manually:

docker pull nazarpc/webserver:data-v1
docker pull nazarpc/webserver:logrotate-v1
docker pull nazarpc/webserver:mariadb-v1
docker pull nazarpc/webserver:nginx-v1
docker pull nazarpc/webserver:php-fpm-v1
docker pull nazarpc/webserver:ssh-v1
docker pull nazarpc/webserver:backup-v1
docker pull nazarpc/webserver:restore-v1

And again in directory with docker-compose.yml:

docker-compose up -d

Backup

To make backup you need to only backup volumes of data-only container. The easiest way to do that is using nazarpc/webserver:backup-v1 image:

docker run --rm --volumes-from=example.com -v /backup-on-host:/backup --env BACKUP_FILENAME=new-backup nazarpc/webserver:backup-v1

This will result in /backup-on-host/new-backup.tar file being created - feel free to specify other directory and other name for backup file.

All other containers are standard and doesn't contain anything important, that is why upgrade process is so simple.

NOTE: You'll likely want to stop MariaDB instance before backup (it is enough to stop master node in case of MariaDB cluster with 2+ nodes)

Restore

Restoration from backup is not more difficult that making backup, there is nazarpc/webserver:restore-v1 image for that:

docker run --rm --volumes-from=example.com -v /backup-on-host/new-backup.tar:/backup.tar nazarpc/webserver:restore-v1

That is it, empty just created example.com container will be filled with data from backup and ready to use.

SSH

SSH might be needed to access files from outside, especially with git.

Before you enter ssh container via SSH for the first time, you need to specify public SSH key (how to generate SSH keys). The easiest way to do this is to define PUBLIC_KEY environment variable in docker-compose.yml. Alternatively you can create file /data/.ssh/authorized_keys and put your public key contents inside. For example, you can do that from Midnight Commander file manager:

docker-compose run ssh mc

When public SSH key is added you should be able to access container as git user:

Internal structure

Internally all that matters is /data directory - it contains all necessary files (or symlinks sometimes) for your convenience - here you can see files for Nginx and MariaDB, their logs and configs, PHP-FPM's config, SSH config and SSH keys directory. That is all what will be persistent, everything else outside /data will be lost during upgrade.

Update configuration

If you update some configuration - you don't need to restart everything, restart only specific service you need, for instance:

docker-compose restart nginx

License

MIT license, see license.txt

docker-webserver's People

Contributors

nazar-pc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docker-webserver's Issues

nginx+PHP-FPM

my nginx config

`

location / {
    root   /data/nginx/www;
    index  index.html index.htm;
}
location ~ \.php$ {
root /data/nginx/www;
    fastcgi_pass   php:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    include        fastcgi_params;
}

`

but when open localhost/1.php in response return "File not found."

in log nginx write "php_1 | 172.19.0.7 - 07/Jun/2017:07:39:58 +0000 "GET /1.php" 404"

how config PHP in NGINX? or how i can config with Apache form PHP (in phpMyAdmin used Apache for PHP?)

Docker 1.10 support

Docker 1.10 will be released next month and it will not provide hosts via /etc/hosts file, there is a need to find alternative way to provide existing features (also --x-networking key removed from Docker Compose in favor of new docker-compose.yml format)

mariadb keeps restarting

Hi Nazar,

I try to understand and implement your extensive setup. It is the most complete I found yet.

I never ran across consul or ceph, so I don't understand what they do.

So far I can spawn a load balancer in front of an NGINX-PHP (web) module connected to a MySQL or MariaDB database which itself is connected to a data container pointing to a real database on a Digital Ocean Droplet, then start a number of web instances and prove that both the load balancer and the database work correctly (provided I use version 1 of docker-compose, as tutum/haproxy does not work with version 2 yet).

Using your example, I see that examplecom_mariadb_1 keeps restarting, so I commented the automatic restart in docker-compose.yml, only to see that this container exits with 1. The log file only shows the password.

If I understand your scripts correctly, you project everything to your /data subdirectory within the container, which isn't of much use if the container isn't running.

Any ideas?

Thanks a lot anyway.

Move everything under /data

Extending upstream images is fun, but maintaining symbolic links from directories used in upstream images to convenient /data becomes difficult as number of images that can be used together grows.

What we want to do here:

  • move everything under /data as primary location (unnecessary volumes should be removed from images)
  • ensure automatic upgrades of individual images from old layout to the new one

mariadb crash

Hi,

I am trying to use the mariadb database but when I check the docker status, I see that mariadb keeps restarting. There is also a crash on the data container.

I read #16 and tried to pull latest mariadb as suggested but still got the same issue.

Here are the logs :

projectcom_data_1 exited with code 0
projectcom_mariadb_1 exited with code 1
mariadb_1     | MySQL root password (from /data/mysql/root_password): 4548rbBmL30mamsTbRYUMQHvfEczTO
mariadb_1     | error: database is uninitialized and password option is not specified 
mariadb_1     |   You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
mariadb_1     | MySQL root password (from /data/mysql/root_password): 4548rbBmL30mamsTbRYUMQHvfEczTO
mariadb_1     | error: database is uninitialized and password option is not specified 
mariadb_1     |   You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
mariadb_1     | MySQL root password (from /data/mysql/root_password): 4548rbBmL30mamsTbRYUMQHvfEczTO
mariadb_1     | error: database is uninitialized and password option is not specified 
mariadb_1     |   You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
mariadb_1     | MySQL root password (from /data/mysql/root_password): 4548rbBmL30mamsTbRYUMQHvfEczTO
mariadb_1     | error: database is uninitialized and password option is not specified 
mariadb_1     |   You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
projectcom_mariadb_1 exited with code 1
mariadb_1     | MySQL root password (from /data/mysql/root_password): 4548rbBmL30mamsTbRYUMQHvfEczTO
mariadb_1     | error: database is uninitialized and password option is not specified 
mariadb_1     |   You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
mariadb_1     | MySQL root password (from /data/mysql/root_password): 4548rbBmL30mamsTbRYUMQHvfEczTO
mariadb_1     | error: database is uninitialized and password option is not specified 
mariadb_1     |   You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
mariadb_1     | MySQL root password (from /data/mysql/root_password): 4548rbBmL30mamsTbRYUMQHvfEczTO
mariadb_1     | error: database is uninitialized and password option is not specified 
mariadb_1     |   You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
mariadb_1     | MySQL root password (from /data/mysql/root_password): 4548rbBmL30mamsTbRYUMQHvfEczTO
mariadb_1     | error: database is uninitialized and password option is not specified 
mariadb_1     |   You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
mariadb_1     | MySQL root password (from /data/mysql/root_password): 4548rbBmL30mamsTbRYUMQHvfEczTO
mariadb_1     | error: database is uninitialized and password option is not specified 
mariadb_1     |   You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
mariadb_1     | MySQL root password (from /data/mysql/root_password): 4548rbBmL30mamsTbRYUMQHvfEczTO
mariadb_1     | error: database is uninitialized and password option is not specified 
mariadb_1     |   You need to specify one of MYSQL_ROOT_PASSWORD, MYSQL_ALLOW_EMPTY_PASSWORD and MYSQL_RANDOM_ROOT_PASSWORD
projectcom_mariadb_1 exited with code 1

So I added the following code in the mariadb block of the docker-compose.yml

  environment:
    - MYSQL_ROOT_PASSWORD=root

Here are the new logs :

mariadb_1     | MySQL root password (from /data/mysql/root_password): 4548rbBmL30mamsTbRYUMQHvfEczTO
mariadb_1     | Initializing database
php_1         | [16-Sep-2016 15:59:17] NOTICE: PHP message: PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20151012/memcached.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20151012/memcached.so: cannot open shared object file: No such file or directory in Unknown on line 0
php_1         | [16-Sep-2016 15:59:17] NOTICE: fpm is running, pid 1
php_1         | [16-Sep-2016 15:59:17] NOTICE: ready to handle connections
mariadb_1     | 2016-09-16 15:59:15 140550691461056 [Note] /usr/sbin/mysqld (mysqld 10.1.17-MariaDB-1~jessie) starting as process 63 ...
mariadb_1     | 2016-09-16 15:59:15 140550691461056 [ERROR] WSREP: rsync SST method requires wsrep_cluster_address to be configured on startup.
mariadb_1     | 2016-09-16 15:59:15 140550691461056 [Warning] You need to use --log-bin to make --binlog-format work.
phpmyadmin_1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.6. Set the 'ServerName' directive globally to suppress this message
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: Using mutexes to ref count buffer pool pages
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: The InnoDB memory heap is disabled
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
phpmyadmin_1  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.6. Set the 'ServerName' directive globally to suppress this message
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: Compressed tables use zlib 1.2.8
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: Using Linux native AIO
projectcom_data_1 exited with code 0
phpmyadmin_1  | [Fri Sep 16 15:59:18.107357 2016] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.10 (Debian) PHP/5.6.25 configured -- resuming normal operations
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: Using SSE crc32 instructions
phpmyadmin_1  | [Fri Sep 16 15:59:18.107423 2016] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: Initializing buffer pool, size = 256.0M
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: Completed initialization of buffer pool
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: Database physically writes the file full: wait...
mariadb_1     | 2016-09-16 15:59:16 140550691461056 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
mariadb_1     | 2016-09-16 15:59:17 140550691461056 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
mariadb_1     | 2016-09-16 15:59:18 140550691461056 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
mariadb_1     | 2016-09-16 15:59:18 140550691461056 [Warning] InnoDB: New log files created, LSN=45883
mariadb_1     | 2016-09-16 15:59:18 140550691461056 [Note] InnoDB: Doublewrite buffer not found: creating new
mariadb_1     | 2016-09-16 15:59:18 140550691461056 [Note] InnoDB: Doublewrite buffer created
mariadb_1     | 2016-09-16 15:59:18 140550691461056 [Note] InnoDB: 128 rollback segment(s) are active.
mariadb_1     | 2016-09-16 15:59:18 140550691461056 [Warning] InnoDB: Creating foreign key constraint system tables.
mariadb_1     | 2016-09-16 15:59:18 140550691461056 [Note] InnoDB: Foreign key constraint system tables created
mariadb_1     | 2016-09-16 15:59:18 140550691461056 [Note] InnoDB: Creating tablespace and datafile system tables.
mariadb_1     | 2016-09-16 15:59:18 140550691461056 [Note] InnoDB: Tablespace and datafile system tables created.
mariadb_1     | 2016-09-16 15:59:18 140550691461056 [Note] InnoDB: Waiting for purge to start
mariadb_1     | 2016-09-16 15:59:18 140550691461056 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.31-77.0 started; log sequence number 0
mariadb_1     | 2016-09-16 15:59:18 140549902300928 [Note] InnoDB: Dumping buffer pool(s) not yet started
mariadb_1     | 2016-09-16 15:59:22 140401360205760 [Note] /usr/sbin/mysqld (mysqld 10.1.17-MariaDB-1~jessie) starting as process 92 ...
mariadb_1     | 2016-09-16 15:59:22 140401360205760 [ERROR] WSREP: rsync SST method requires wsrep_cluster_address to be configured on startup.
mariadb_1     | 2016-09-16 15:59:22 140401360205760 [Warning] You need to use --log-bin to make --binlog-format work.
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB: Using mutexes to ref count buffer pool pages
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB: The InnoDB memory heap is disabled
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB: Compressed tables use zlib 1.2.8
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB: Using Linux native AIO
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB: Using SSE crc32 instructions
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB: Initializing buffer pool, size = 256.0M
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB: Completed initialization of buffer pool
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB: Highest supported file format is Barracuda.
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB: 128 rollback segment(s) are active.
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB: Waiting for purge to start
mariadb_1     | 2016-09-16 15:59:23 140401360205760 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.31-77.0 started; log sequence number 1616799
mariadb_1     | 2016-09-16 15:59:23 140400580855552 [Note] InnoDB: Dumping buffer pool(s) not yet started
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] /usr/sbin/mysqld (mysqld 10.1.17-MariaDB-1~jessie) starting as process 121 ...
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [ERROR] WSREP: rsync SST method requires wsrep_cluster_address to be configured on startup.
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Warning] You need to use --log-bin to make --binlog-format work.
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB: Using mutexes to ref count buffer pool pages
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB: The InnoDB memory heap is disabled
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB: Compressed tables use zlib 1.2.8
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB: Using Linux native AIO
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB: Using SSE crc32 instructions
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB: Initializing buffer pool, size = 256.0M
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB: Completed initialization of buffer pool
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB: Highest supported file format is Barracuda.
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB: 128 rollback segment(s) are active.
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB: Waiting for purge to start
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.31-77.0 started; log sequence number 1616809
mariadb_1     | 2016-09-16 15:59:25 140662355756800 [Note] InnoDB: Dumping buffer pool(s) not yet started
mariadb_1     | ERROR: 1049  Unknown database 'test'
mariadb_1     | 2016-09-16 15:59:25 140663133943744 [ERROR] Aborting
mariadb_1     | 
mariadb_1     | 
mariadb_1     | WARNING: OPENGIS REQUIRED SP-S WERE NOT COMPLETELY INSTALLED!
mariadb_1     | GIS extentions might not work properly.
mariadb_1     | 
mariadb_1     | PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
mariadb_1     | To do so, start the server, then issue the following commands:
mariadb_1     | 
mariadb_1     | '/usr/bin/mysqladmin' -u root password 'new-password'
mariadb_1     | '/usr/bin/mysqladmin' -u root -h  password 'new-password'
mariadb_1     | 
mariadb_1     | Alternatively you can run:
mariadb_1     | '/usr/bin/mysql_secure_installation'
mariadb_1     | 
mariadb_1     | which will also give you the option of removing the test
mariadb_1     | databases and anonymous user created by default.  This is
mariadb_1     | strongly recommended for production servers.
mariadb_1     | 
mariadb_1     | See the MariaDB Knowledgebase at http://mariadb.com/kb or the
mariadb_1     | MySQL manual for more instructions.
mariadb_1     | 
mariadb_1     | Please report any problems at http://mariadb.org/jira
mariadb_1     | 
mariadb_1     | The latest information about MariaDB is available at http://mariadb.org/.
mariadb_1     | You can find additional information about the MySQL part at:
mariadb_1     | http://dev.mysql.com
mariadb_1     | Support MariaDB development by buying support/new features from MariaDB
mariadb_1     | Corporation Ab. You can contact us about this at [email protected].
mariadb_1     | Alternatively consider joining our community based development effort:
mariadb_1     | http://mariadb.com/kb/en/contributing-to-the-mariadb-project/
mariadb_1     | 
mariadb_1     | Database initialized
mariadb_1     | MySQL init process in progress...
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] mysqld (mysqld 10.1.17-MariaDB-1~jessie) starting as process 148 ...
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Warning] You need to use --log-bin to make --binlog-format work.
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB: Using mutexes to ref count buffer pool pages
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB: The InnoDB memory heap is disabled
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB: Compressed tables use zlib 1.2.8
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB: Using Linux native AIO
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB: Using SSE crc32 instructions
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB: Initializing buffer pool, size = 256.0M
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB: Completed initialization of buffer pool
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB: Highest supported file format is Barracuda.
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB: 128 rollback segment(s) are active.
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB: Waiting for purge to start
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] InnoDB:  Percona XtraDB (http://www.percona.com) 5.6.31-77.0 started; log sequence number 1616819
mariadb_1     | 2016-09-16 15:59:28 140209198958336 [Note] InnoDB: Dumping buffer pool(s) not yet started
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] Plugin 'FEEDBACK' is disabled.
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Warning] 'user' entry 'root@4230632d0627' ignored in --skip-name-resolve mode.
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Warning] 'proxies_priv' entry '@% root@4230632d0627' ignored in --skip-name-resolve mode.
mariadb_1     | 2016-09-16 15:59:28 140209976375232 [Note] mysqld: ready for connections.
mariadb_1     | Version: '10.1.17-MariaDB-1~jessie'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  mariadb.org binary distribution
mariadb_1     | Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
mariadb_1     | 2016-09-16 15:59:30 140209975810816 [Warning] 'proxies_priv' entry '@% root@4230632d0627' ignored in --skip-name-resolve mode.
mariadb_1     | 
mariadb_1     | /docker-entrypoint-init.sh: ignoring /docker-entrypoint-initdb.d/*
mariadb_1     | 
mariadb_1     | 2016-09-16 15:59:30 140209975507712 [Note] mysqld: Normal shutdown
mariadb_1     | 
mariadb_1     | 2016-09-16 15:59:30 140209975507712 [Note] Event Scheduler: Purging the queue. 0 events
mariadb_1     | 2016-09-16 15:59:30 140209182172928 [Note] InnoDB: FTS optimize thread exiting.
mariadb_1     | 2016-09-16 15:59:30 140209975507712 [Note] InnoDB: Starting shutdown...
mariadb_1     | 2016-09-16 15:59:32 140209975507712 [Note] InnoDB: Shutdown completed; log sequence number 1616829
mariadb_1     | 2016-09-16 15:59:32 140209975507712 [Note] mysqld: Shutdown complete
mariadb_1     | 
mariadb_1     | 
mariadb_1     | MySQL init process done. Ready for start up.
mariadb_1     | 
projectcom_mariadb_1 exited with code 0

Thanks.

this is more of a question, not an issue - how to install and manage multiple nodes ?

I'm super green when it comes to docker, we currently run all production with chef but containerization was a good enough reason to consider switching over to docker.

When i found your repo - it made it a lot more obvious that it is so much easier to configure and manage things but I'm having a bit of a difficulty understanding how to deploy this setup over multiple nodes (all dedicated servers). Is it even possible?

Say we want to have 2 of MYSQL + REDIS servers and 2 separate web servers
we currently also have 2 haproxy load balancers (also dedicated servers)

I couldn't understand a few things:

  1. If i set all of this up the way I described above - how will the machines know about each other? Ie. if haproxy is configured on web servers - then will they automatically pick up IPs that need to be connected to haproxy for mysql availability monitoring?
  2. Is there a real benefit to having mutliple NGINX + PHP-FPM + MYSQL instances running on the same node vs 1 of each instances? or is this something that's been tested and performs better when more instances are available and that they are load balanced through the local installation of haproxy?
  3. With the multip-IP DNS entries - it almost seems pointless to have additional LOAD BALANCER hardware when haproxy can reside on 2 of the same physical nodes that host web servers app?
  4. are there any self-hosted utilities to monitor DOCKER resource utilization / service availability / etc.?
  5. what's the best way to add some customizations to the included configs? for example NGINX, ie - we use GEOIP, IMAGE RESIZE, CACHE, REALIP nginx modules. What's the best practice to customize that and save it as a reusalbe image, would it still allow us to stay in sync with your repository changes ?

thank you very much.

Problem to pull

Hi, I've one problem when I want pull your Docker...

Message :
Using default tag: latest
Pulling repository docker.io/nazarpc/webserver
Tag latest not found in repository docker.io/nazarpc/webserver

nginx + php-fpm = 502

Hi,

Thanks for your great repository.
I am trying to use it for a php application, html pages runs fine but when I try to uncomment the php block of the default.conf in nginx

location ~ \.php$ {
    root           html;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    include        fastcgi_params;
}

I have the following error log :

*6 connect() failed (111: Connection refused) while connecting to upstream, client: 172.17.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: localhost:8000"

Any ideas ?

nginx broke after upgrade

my nginx is not coming up after the upgrade. I can tell something is up with the data volume path and the paths/mounts expected by the new nginx. I did not run the data volume container command again because my original volume container has data from an year ago, which is good data. I can log in to the ssh and see the config files, and the web/html files. But when I bash into the nginx, it's /data seems to be clean. The www folder is empty and the conf.d folder is empty too.

CONTAINER ID IMAGE COMMAND CREATED STATUS
17fa31eaa647 nazarpc/webserver:nginx "/webserver-entrypoin" 12 minutes ago Restarting (0) 28 seconds ago

Automatic nginx reloading when config changes

Optional feature should be provided by separate container that will share PID namespace with nginx container and reload nginx process when config gets changed, this simplifies applying config changes, since there is no need to SSH to host and manually restart nginx instance/enter container and ping nginx to gracefully reload config.
Feature should be optional and in separate container.

Currently impossible to implement, needs moby/moby#10163 to be implemented

Question about extends

Hi @nazar-pc ,

I am using your stack from not so long and everything is working smoothly since then.
Well, I came to a point where I need to use 2 extra extensions for PHP.
So I decided to extend your webserver:php-fpm image in my custom image.

This is what I did:


FROM nazarpc/webserver:php-fpm
MAINTAINER Maxime Elomari <[email protected]>

RUN apt-get update

RUN apt-get install -y --no-install-recommends libxslt1-dev
RUN docker-php-ext-install xsl

RUN apt-get install -y --no-install-recommends icu-devtools libicu-dev
RUN docker-php-ext-install intl

RUN curl -sS https://getcomposer.org/installer | \
  php -- --install-dir=/usr/local/bin --filename=composer

# Cleanup
RUN apt-get clean \
RUN rm -rf /var/lb/apt/lists/*

Thing is, I ended up with the following error while building my image:

/usr/local/bin/docker-php-ext-enable: 81: /usr/local/bin/docker-php-ext-enable: cannot create /usr/local/etc/php/conf.d/docker-php-ext-xsl.ini: Directory nonexistent
The command '/bin/sh -c docker-php-ext-install xsl' returned a non-zero code: 123

I am quite new to Docker and I might not know how to do it in the proper way. My guess is that I probably miss something. Is this related to your image? Or do I need to run something else before I could do what I am trying to do. Would you mind pointing me in the right direction please?

For the record, I checked the commands before by executing them directly in the container, using
docker-compose exec php /bin/sh
Everything went well, and the extensions were installed.

Another question/suggestion:

I read the issue about the composer included in the stack. It is interesting that you decided to put it in the ssh container instead of the php container. From my point of view, would not be better if the composer was installed in the php container? Let me explain why:

For my application, like explained previously, I required 2 PHP extensions. But if I install them on the php container, it is only for it's php-cli and not for the ssh container BUT I am using the composer installed on the ssh container which is using the php-cli of ssh container as well. So both of my extensions are missing, which is normal, but quite inconvenient. I have to reinstall them, and even more because all the extensions installed for the php container are missing from the php cli of the ssh container.

Let me know what you think.

Thank you!

Make backup container general-purpose

Read current mounts, exclude defaults and backup everything else.
This means that there will be no paths hardcoded within image, thus allowing to backup any volumes from any containers.

Consul persistance

Currently, internal use of Consul image assumes temporary character of stored data. However, it might be useful to have long-term storage as well, so Consul should store its data on disk, similar to how it is implemented in MariaDB image.

Add load balancer container

Should be linked to nginx instance (all of them if scaled) and balance load across them.
Additional directory for load balancer config (HAProxy or Nginx) should be added.

Currently impossible to add scaled nginx instances, needs docker/compose#1676 to be implemented.

Also additional container similar to #1 should be created to update config to all available linked nginx instances not only on balancer creation, but just automatically.

Π‘an not connect to my DB via phpmyadmin

After last update containers ( today ) i can not connect to my DB via phpmyadmin docker, i see error:

mysqli_real_connect(): (HY000/2002): Connection timed out

What's the problem, do you think?

I configured containers via docker-compose, i' am try force-recrate, i see error in docker, but i don't now what is problem ...

Automatically add services from `docker-compose.yml` to Consul

It is not difficult to do and in many cases is exactly what is expected, so why not add it?
Will allow to get rid of SERVICES: nginx:nginx, mariadb:mariadb in this example:

...
consul:
...
    SERVICES: nginx:nginx, mariadb:mariadb
...
nginx:
...
mariadb:
...

Finalize cluster autoscaling v0

Current implementation is mostly working (not completely), but is not documented (existing documentation is very obsolete).

  • Finalize mechanics (depends on #22, also logs should be separated in many containers in addition to data)
  • Update docs with examples of deploying using Docker Swam Mode (preferably on Docker Machine using VirtualBox, bonus point for making screencast πŸ‘)

I can't test nginx config like cmd nignx -t , lets may be fix it?

How i can test nginx config like nignx -t or reload like nginx -s reload ?

When i try docker-compose exec nginx nginx -t
I see error

2018/02/01 23:52:36 [emerg] 10#10: open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
nginx: [emerg] open() "/etc/nginx/nginx.conf" failed (2: No such file or directory)
nginx: configuration file /etc/nginx/nginx.conf test failed

Why you don't want create symlynk for nginx configs for correct nginx work ?
Like this: mkdir -p /etc/nginx && ln -s /data/nginx/config/* /etc/nginx/

help chapter in readme for rookie

Could you add chapter in readme for rookie(dumb)? for example I have index.php file with phpinfo: what steps need to do to see it in browser using your docker-webserver? because it is not clear, I created example.com, added yml, then run up -d and what next?

According readme

Before you enter ssh container via SSH for the first time, you need to create file /data/.ssh/authorized_keys

where I have to create .ssh file inside example.com on host machine or inside docker-machine or container?

P.S: Thanks for repo

Data container volume issue

Hello,

thanks for all the instructions.

I would like to ask you if you can help me with the issue:
Service "data" mounts volumes from "example.com", which is not the name of a service or container.

I have followed all your steps, but docker compose up ends up with the error message above.

Thanks in advance.

Mount data volume on host

Is there a way to mount the data volume on the host while its running? I was trying to use for development so files can be saved and it would be live.

CephFS image

Well, without really scalable underlaying storage these images are not trully scalable in general sense.
So, there should be combined client-server (with possibility to use any or both) GlusterFS image that would span across physical servers and thus providing complete scalability of the whole stack.
Unfortunately, didn't found any image suitable out of the box or even such that can be taken as the basis for target image.
Zero-configuration is expected as always:)

Emtpy pages are delivered for PHP scripts

Thank you for this project.

I'm trying to install a local wordpress test-site within a container based on your images but even a single php-site won't render correctly (it is empty). Here's what I did:

1- I created docker-compose.yml adapted the code from your README accordingly (activated phpmyadmin and ssh) and ran docker-compose up -d.

2- I can correctly retrieve the default index.html via my web-browser navigating to localhost:2080 (which is the port I chose for nginx:80)

3- I ssh into my instance

4- I create a index.php with <?php phpinfo() ?> in /data/nginx/www/index.php

5- I change /data/nginx/config/conf.d/default.conf to

server {
[..]
    location / {
        root   /data/nginx/www;
        index  index.php index.html index.htm; # added index.php
    }
[..]
    # pass the PHP scripts to FastCGI server listening on php:9000
    location ~ \.php$ {
        fastcgi_pass   php:9000;
        fastcgi_index  index.php;
        fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
        include        fastcgi_params;
    }
[..]

Here I basically changed the fastcgi_param SCRIPT_FILENAME to $fastcgi_script_name .

6- Navigating to localhost:2080/index.php gives me a blank page - immediately (HTTP response is 200).

NGinx's error log does not contain an error.

What can I do to debug this issue?

PS: I tried setting fastcgi_param SCRIPT_FILENAME to $document_root$fastcgi_script_name, this results in the famous "Primary script unknown"-error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.