Giter Club home page Giter Club logo

dockerweb's Introduction

DockerWeb

A docker-powered bash script for shared web hosting management. The ultimate Docker LAMP/LEMP Stack.

Requirements

  • A fresh installation of latest Ubuntu LTS x64 with the FQDN set.
    • DigitalOcean provides Cloud VPS Servers at affordable prices. You can sign up via this referral link to get a free $100 bonus in credit.
  • At least 512MB of system memory. (1GB recommended)
  • A domain name pointed at the host's IP address. (Optional but highly recommended)

Installing

After you changed the default root password and ssh port, to install the latest stable release, you can run the following commands as root:

git clone https://github.com/fffaraz/dockerweb.git /opt/dockerweb
export PATH=$PATH:/opt/dockerweb

To add /opt/dockerweb to your $PATH permanently run echo 'export PATH=$PATH:/opt/dockerweb' >> ~/.profile

To create swap space on a regular file run docweb install:swapfile SIZE_IN_MB

If you don't already have docker installed on your host run docweb install:docker

To create the network bridge used by dockerweb containers run docweb install:network

Finally to build dockerweb images run docweb build:all

Optionally, to install some useful packages run docweb install:extras and docweb install:aliases

Upgrading

To upgrade you just need to run docweb upgrade first and then if necessary rebuild all the images with docweb build:all and re-run all the containers to use new images built.

How to run services

The DNS Server

MicroDNS is a tiny DNS server that is used to (almost) always return your host's IP address for any query sent to it. Hence you will just need to set your domains' dns setting to point to your host's IP address and you don't have to also add them in a config file on the host any more.

docweb microdns:run [--ttl 3600] [--log]
docweb microdns:log
docweb stop microdns

The Reverse Proxy Server

This is the main web server listening on ports 80 and 443 and proxying requests to the apps based on their domain names. It also provides TLS/SSL encryption using valid certificates signed by Let's Encrypt and is responsible for output gzip compression. You can add your apps to its config file at /home/proxy/websites.conf. You need to run the update command each time you edit the config file. Make sure all your apps are running before updating the proxy server.

docweb proxy:run [--debug] [SERVER_NAME]
docweb stop proxy
docweb proxy:update
docweb proxy:status

Logs Directory: /home/proxy/log/nginx/

Config File Format: CONTAINER CATCHALL WILDCARD SSLCERT DOMAIN1 [DOMAINS...]

  • CONTAINER : The name of App's container.
  • CATCHALL : Set to 1 for the default app. Proxies all unmatched domain names to that container. Optional. One app only.
  • WILDCARD : Whether to also proxy all subdomains of app's domain names to that container.
  • SSLCERT : Request for a valid TLS/SSL certificate from letsencrypt.
  • HTTPSONLY : Redirect all HTTP requests to HTTPS.
  • DOMAIN1 : Primary domain name for the app.
  • [DOMAINS...] : Optional additional domain names.

MySQL Server

docweb mysql:run [--debug] [--direct PORT] [--memory M] NAME MYSQL_ROOT_PASSWORD [mariadb|mysql|mysql/mysql-server]
docweb mysql:stop NAME
docweb mysql:client NAME
docweb mysql:status NAME
docweb mysql:optimize NAME
docweb mysql:backup NAME [--gzip] [DATABASES...]
docweb mysql:import NAME [--gzip] FILENAME [DATABASE]
docweb mysql:createuser NAME USERNAME PASSWORD
docweb mysql:createdb NAME DB
docweb mysql:listusers NAME
docweb mysql:listproc NAME
docweb mysql:listdbs NAME
docweb mysql:upgrade NAME
docweb mysql:tuner NAME MYSQL_ROOT_PASSWORD

Default Image: mariadb

MySQL Backup / Import Directory: /home/NAME/backup

PostgreSQL Server

docweb postgres:run [--debug] NAME POSTGRES_PASSWORD
docweb stop NAME

Redis Server

docweb redis:run [--debug] NAME
docweb stop NAME

Mail Forwarder

docweb mailfwd:run

Based on zixia/docker-simple-mail-forwarder. Config File: /home/mailfwd/mail.conf

Web Apps

docweb run [--debug|--bash] [--direct PORT] IMAGE NAME [WEBUSER_PASSWORD SSH_PORT]
docweb stop NAME
docweb logs NAME
docweb update NAME
docweb exec [--root] NAME
docweb clean NAME
docweb backup NAME
docweb ps NAME
docweb status NAME
docweb log:nginx NAME [--error]
docweb log:php NAME [--error]

WWW (public_hmtl) root directory: /home/NAME/www/public

Domains config file: /home/NAME/domains.conf

Optional project init script: /home/NAME/project.sh

List of availabe images: php7nginx php7apache php5apache python3 nodejs aspnet4 aspnet5

phpMyAdmin

docweb pma:run [--debug] [--direct PORT] MYSQLSERVER MYSQLROOTPASSWORD [pma status] [CaptchaPublic CaptchaPrivate]
docweb stop MYSQLSERVER_pma

Then add the following line to your /home/proxy/websites.conf and then run dockweb proxy:update.

MYSQLSERVER_pma 0 0 0 0 pma.example.com

phpMyAdmin can be accessed from http://pma.example.com/pma/

Status page http://pma.example.com/status/

ClamAV

docweb clamav:run

Etc.

  • docweb rm To remove stopped containers, orphaned images and orphaned volumes.
  • docweb rm:all To remove all containers and volumes.
  • docweb rm:img To remove all images.
  • docweb build NAME To build an image.
  • docweb stats Prints host status.
  • docweb volume:create NAME SIZE

Examples

PHP 7.1 + NGINX + MySQL Stack

To create a new PHP website with NGINX webserver and MariaDB database server and phpMyAdmin run the following commands:

docweb mysql:run db1 mysqlrootpassword
docweb mysql:createuser db1 example.com db_password
docweb pma:run db1 mysqlrootpassword
docweb run php7nginx example.com
docweb proxy:run

Then add the following lines to /home/proxy/websites.conf

db1_pma 0 0 0 0 pma.example.com
example.com 0 0 0 0 example.com

Then update the proxy server with docweb proxy:update

See Also

dockerweb's People

Contributors

fffaraz 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dockerweb's Issues

Repository does not exist or may require 'docker login'

Hello,
I run command: docweb build:all but error:
`checking for libzip... not found
configure: error: Please reinstall the libzip distribution
The command '/bin/sh -c chown root:root /script_.sh && chmod 540 /script_.sh && sync && /script_init.sh' returned a non-zero code: 1

/opt/dockerweb/docweb build app/phpmyadmin
Sending build context to Docker daemon 12.29kB
Step 1/3 : FROM fffaraz/web/php7nginx:latest
pull access denied for fffaraz/web/php7nginx, repository does not exist or may require 'docker login'
echo DONE
DONE
exit 0
`
I already install libzip-dev. I run in Ubuntu 16.04 LTS.

building web/php7nginx mysql-client error

docweb build web/php7nginx
E: Package 'mysql-client' has no installation candidate

possible fix:
apt-get install mariadb-client
OR
apt-get install default-mysql-client
apt-get install default-libmysqlclient-dev

docweb proxy:run --debug local.hosting

trying to run this command but got this error :
Unable to find image 'fffaraz/proxy:latest' locally
docker: Error response from daemon: pull access denied for fffaraz/proxy, repository does not exist or may require 'docker login'.
See 'docker run --help'.

Deploying LAMP with Docker on Linode

Hi,

I have 2 questions to start and your answer may result in several other questions:

  1. Using your repo, are the security bits configured (fail2ban, modsecurity, mysql security)?
  2. Using your repo, can I isolate users from each other (distinct LAMP Stack)?

Thanks.

run build individually to work

Hi I've been trying to get this to work and it fails on unable to find fffaraz/proxy/base:latest and says may have to login to dockerhub.

I've realized I can build individually by docweb build web/proxy/base but then I'll need to also do it for php7nginx. Why doesnt docweb build:all command work?

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.