All Projects → nazar-pc → Docker Webserver

nazar-pc / Docker Webserver

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

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Docker Webserver

docker-atlassian
A docker-compose orchestration for JIRA Software and Confluence based on docker containers.
Stars: ✭ 13 (-95.52%)
Mutual labels:  backup, docker-container
ioBroker.backitup
Backitup enables the cyclical creation of backups of an IoBroker / Homematic installation
Stars: ✭ 43 (-85.17%)
Mutual labels:  backup, restore
restique
A wrapper around restic with profiles
Stars: ✭ 43 (-85.17%)
Mutual labels:  backup, restore
irsync
rsync on interval, via command line binary or docker container. Server and IOT builds for pull or push based device content management.
Stars: ✭ 19 (-93.45%)
Mutual labels:  backup, docker-container
Webinoly
Optimized LEMP Web Server to manage your WordPress, PHP, or simple HTML sites running on a powerful NGINX setup.
Stars: ✭ 254 (-12.41%)
Mutual labels:  mariadb, nginx
mongodb-backup-manager
🌿 A Full-stack MongoDB Backup System.
Stars: ✭ 42 (-85.52%)
Mutual labels:  backup, restore
eXperDB-Management
eXperDB-Management is a integrated management tool for PostgreSQL(for efficient operation and management).
Stars: ✭ 38 (-86.9%)
Mutual labels:  backup, restore
wnmp-dev
Development environment: Windows + nginx + MySQL + PHP
Stars: ✭ 52 (-82.07%)
Mutual labels:  webserver, mariadb
PyFiSync
Python (+ rsync or rclone) based intelligent file sync with automatic backups and file move/delete tracking.
Stars: ✭ 88 (-69.66%)
Mutual labels:  ssh, backup
python3-docker-devenv
Docker Start Guide with Python Development Environment
Stars: ✭ 13 (-95.52%)
Mutual labels:  ssh, docker-container
esop
Cloud-enabled backup and restore tool for Apache Cassandra
Stars: ✭ 40 (-86.21%)
Mutual labels:  backup, restore
Lnmp
Support: Nginx 1.12/1.13 + MySQL 5.5/5.6/5.7/8.0(MariaDB 5.5/10.0/10.1/10.2/10.3) + PHP 5.4/5.5/5.6/7.0/7.1/7.2 + phpMyAdmin(Adminer)
Stars: ✭ 262 (-9.66%)
Mutual labels:  mariadb, nginx
n3dr
Nexus3 Disaster Recovery (N3DR) is a tool that is capable of downloading all artifacts from a Nexus3 server and to migrate them to another Nexus3 server. Note that some repository formats are not supported at the moment.
Stars: ✭ 110 (-62.07%)
Mutual labels:  backup, restore
larawell
Monolithic docker container to run your Laravel apps: MariaDB/Redis/Nginx/PHP7.0-Fpm with properly configured cron and queue
Stars: ✭ 14 (-95.17%)
Mutual labels:  docker-container, mariadb
docker-db-backup
Backup mutltiple databases types on a scheduled basis with many customizable options
Stars: ✭ 302 (+4.14%)
Mutual labels:  backup, mariadb
docker-aws-s3-sync
Docker container to sync a folder to Amazon S3
Stars: ✭ 21 (-92.76%)
Mutual labels:  backup, docker-container
PHP-Backuper
A framework which will help you to make (incremental) backups of your site.
Stars: ✭ 16 (-94.48%)
Mutual labels:  backup, restore
backup-docker
A simple command line tool to backup and restore docker containers along with their volumes
Stars: ✭ 58 (-80%)
Mutual labels:  backup, restore
myhoard
MySQL Backup and Point-in-time Recovery service
Stars: ✭ 62 (-78.62%)
Mutual labels:  backup, restore
Burry.sh
Cloud Native Infrastructure BackUp & RecoveRY
Stars: ✭ 260 (-10.34%)
Mutual labels:  backup, restore

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:

ssh [email protected]

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].