From ed84436224d3e30dd27c1d176b7fd42dfc764ec0 Mon Sep 17 00:00:00 2001 From: Derkades Date: Mon, 13 Apr 2020 21:03:43 +0200 Subject: [PATCH 01/25] should clean in the same layer --- src/Dockerfile => Dockerfile | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) rename src/Dockerfile => Dockerfile (82%) diff --git a/src/Dockerfile b/Dockerfile similarity index 82% rename from src/Dockerfile rename to Dockerfile index 380cfb7..21e3e0d 100644 --- a/src/Dockerfile +++ b/Dockerfile @@ -11,17 +11,16 @@ RUN docker-php-source extract \ && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ && docker-php-ext-install -j$(nproc) gd \ && a2enmod rewrite \ - && docker-php-source delete + && docker-php-source delete \ + && apt-get clean \ + && apt-get autoclean \ + && apt-get autoremove --purge -y \ + && rm -rf /var/lib/{apt,dpkg,cache,log}/ /tmp/* /var/tmp/* RUN curl -Lo nameless.tar.gz https://github.com/NamelessMC/Nameless/archive/v$NAMELESSMC_VERSION.tar.gz \ && tar -xvf nameless.tar.gz \ && mv Nameless-$NAMELESSMC_VERSION/* /var/www/html/ \ && bash -c "mv Nameless-$NAMELESSMC_VERSION/.[^.]* /var/www/html/" \ - && rm -rf nameless.tar.gz Nameless-$NAMELESSMC_VERSION \ + && rm -rf nameless.tar.gz Nameless-$NAMELESSMC_VERSION \ && chown -R www-data:www-data /var/www/html \ && chmod 755 -R /var/www/html - -RUN apt-get clean \ - && apt-get autoclean \ - && apt-get autoremove --purge -y \ - && rm -rf /var/lib/{apt,dpkg,cache,log}/ /tmp/* /var/tmp/* From 2b8e21f95f36589cf6992afd750095fd03750800 Mon Sep 17 00:00:00 2001 From: Derkades Date: Wed, 10 Jun 2020 14:12:51 +0200 Subject: [PATCH 02/25] Update to v2 and use php-fpm for better performance --- Dockerfile | 26 --------------- LICENSE | 2 +- README.md | 73 +++++++---------------------------------- build.sh | 3 ++ deploy.sh | 11 +++++++ docker-compose.yml | 35 +++++++++++--------- nginx_web/Dockerfile | 15 +++++++++ nginx_web/entrypoint.sh | 9 +++++ nginx_web/nginx.conf | 47 ++++++++++++++++++++++++++ php_fpm/Dockerfile | 23 +++++++++++++ php_fpm/entrypoint.sh | 22 +++++++++++++ 11 files changed, 162 insertions(+), 104 deletions(-) delete mode 100644 Dockerfile create mode 100755 build.sh create mode 100755 deploy.sh create mode 100644 nginx_web/Dockerfile create mode 100644 nginx_web/entrypoint.sh create mode 100644 nginx_web/nginx.conf create mode 100644 php_fpm/Dockerfile create mode 100644 php_fpm/entrypoint.sh diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 21e3e0d..0000000 --- a/Dockerfile +++ /dev/null @@ -1,26 +0,0 @@ -FROM php:7.0-apache - -ARG NAMELESSMC_VERSION=1.0.21 - -WORKDIR /var/www - -RUN docker-php-source extract \ - && apt-get update \ - && apt-get install -y libmcrypt-dev libldap2-dev libpng-dev libjpeg62-turbo-dev libfreetype6-dev curl tar \ - && docker-php-ext-install pdo pdo_mysql mysqli \ - && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ - && docker-php-ext-install -j$(nproc) gd \ - && a2enmod rewrite \ - && docker-php-source delete \ - && apt-get clean \ - && apt-get autoclean \ - && apt-get autoremove --purge -y \ - && rm -rf /var/lib/{apt,dpkg,cache,log}/ /tmp/* /var/tmp/* - -RUN curl -Lo nameless.tar.gz https://github.com/NamelessMC/Nameless/archive/v$NAMELESSMC_VERSION.tar.gz \ - && tar -xvf nameless.tar.gz \ - && mv Nameless-$NAMELESSMC_VERSION/* /var/www/html/ \ - && bash -c "mv Nameless-$NAMELESSMC_VERSION/.[^.]* /var/www/html/" \ - && rm -rf nameless.tar.gz Nameless-$NAMELESSMC_VERSION \ - && chown -R www-data:www-data /var/www/html \ - && chmod 755 -R /var/www/html diff --git a/LICENSE b/LICENSE index 7eb389f..2d0fc88 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Birkhoff Lee +Copyright (c) 2020 Derkades Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 76631c0..b62bbfb 100644 --- a/README.md +++ b/README.md @@ -1,76 +1,27 @@ -# NamelessMC Docker [![](https://images.microbadger.com/badges/image/birkhofflee/namelessmc-docker.svg)](https://microbadger.com/images/birkhofflee/namelessmc-docker) +# NamelessMC Docker + This is the official Docker image for NamelessMC. Deploy with ease! -# Usage +## Usage -## # Install Docker -Obviously, if you wanna use Docker for deployment, you need to install Docker. +### Install Docker -You have to manually install Docker first if you don't have it installed on your server. Check out the official install guide here: https://docs.docker.com/engine/installation. +You have to manually install Docker first if you don't have it installed on your server. Check out the [official install guide](https://docs.docker.com/engine/installation). -If you want to specify the version of NamelessMC you want, head to https://github.com/NamelessMC/Nameless-Docker#manually-run-commands. +### Automated Deployment -## # Automated Deployment -You will need to install [Docker Compose](https://docs.docker.com/compose/) for automated deploying. If you don't have it installed, run the following: +You will need to install [Docker Compose](https://docs.docker.com/compose/) for automated deploying. ```bash -$ curl -L "https://github.com/docker/compose/releases/download/1.11.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose -$ chmod +x /usr/local/bin/docker-compose +sudo apt install docker-compose ``` -> If you got a “Permission denied” error while running the commands above, add `sudo` at the beginning of each of them and run again. This will require sudo access. - -When you're done, clone this repository and run! (`-d` means detach mode, e.g. run in background) +Download the example file, optionally change the directories, passwords, etc. then run it with ```bash -$ git clone https://github.com/NamelessMC/Nameless-Docker -$ cd NamelessMC-docker -$ docker-compose up -d +docker-compose up -d ``` -When the container is up, follow the guide at https://github.com/NamelessMC/Nameless-Docker#namelessmc-installation. +When the containers are up, visit the website in a browser to start the installer. By default it listens on any interface, port 80. -## # Manual Deployment -If you more like to run the containers by yourself or using them with other containers like [jwilder/nginx-proxy](https://github.com/jwilder/nginx-proxy), you may want to do it yourself. - -First, clone the repository: - -```bash -$ git clone https://github.com/NamelessMC/Nameless-Docker -$ cd Nameless-Docker -``` - -Next, build the image. - -```bash -$ docker build -t namelessmc . -``` - -If you want to specify the version: - -```bash -$ docker build --build-arg NAMELESSMC_VERSION=1.0.21 -t namelessmc . -``` - -The version number **MUST BE** listed [here](https://github.com/NamelessMC/Nameless/releases) and it's **not guranteed** to work. - -Next, run the image we just built and a MySQL container as well. - -```bash -$ docker run -d -e "MYSQL_ROOT_PASSWORD=nameless" -e "MYSQL_USER=nameless" -e "MYSQL_PASSWORD=nameless" -e "MYSQL_DATABASE=nameless" --name nameless_db mysql -$ docker run -d -p 80:80 --link nameless_db --name nameless namelessmc -``` - -That's it! - -# Installation -After deploying the containers, open up the corresponding URL in your web browser to get started with NamelessMC. - -By default, the web server will be available at `0.0.0.0:80`, means if you deployed it on you own computer, the URL is gonna be `http://localhost`. Instead, if you did it on a remote server, the URL would be `http://`. - -Follow the install instructions. When the database configuration page shows up, fill in `db` for the *database address*. For database username, password and database name, fill `nameless` for all of them, if you used default database credentials. - -When you're done, submit and follow the rest of installation. - -# About -This repository was moved from [Birkhoff Lee](https://github.com/BirkhoffLee), and the original repository is here: https://github.com/BirkhoffLee/namelessmc-docker, carefully made in Taiwan. :heart: +When the database configuration page shows up, fill in `namelessmc_db` for the *database address*. For database username, password and database name, fill `nameless` for all of them, if you used default database credentials. diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..2bdd402 --- /dev/null +++ b/build.sh @@ -0,0 +1,3 @@ +#!/bin/sh +docker build -t derkades/namelessmc-nginx nginx_web +docker build -t derkades/namelessmc-php php_fpm diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..c0d14e2 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e +docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d +export DOCKER_CLI_EXPERIMENTAL=enabled +set +e +docker buildx rm namelessmc_builder +set -e +docker buildx create --use --name namelessmc_builder +docker buildx build -t derkades/namelessmc-nginx --platform=linux/arm,linux/arm64,linux/amd64 nginx_web --push +docker buildx build -t derkades/namelessmc-php --platform=linux/arm,linux/arm64,linux/amd64 php_fpm --push +docker buildx rm namelessmc_builder diff --git a/docker-compose.yml b/docker-compose.yml index 7122888..c1628da 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,23 +1,26 @@ -version: '3.1' +version: '2' services: - nameless: - build: - context: src + namelessmc: + image: derkades/namelessmc-nginx + ports: ['80:80'] + volumes: ['/srv/namelessmc/web:/data'] + # environment: + # PHP_FPM: namelessmc_php:9000 restart: unless-stopped - links: - - db - ports: - - "80:80" - db: - image: mysql:5.7 + namelessmc_php: + image: derkades/namelessmc-php + volumes_from: [namelessmc] restart: unless-stopped - expose: - - 3306 + + namelessmc_db: + image: mariadb + volumes: ['/srv/namelessmc/db:/var/lib/mysql'] environment: - - "MYSQL_ROOT_PASSWORD=nameless" - - "MYSQL_USER=nameless" - - "MYSQL_PASSWORD=nameless" - - "MYSQL_DATABASE=nameless" + MYSQL_ROOT_PASSWORD: nameless + MYSQL_USER: nameless + MYSQL_PASSWORD: nameless + MYSQL_DATABASE: nameless + restart: unless-stopped diff --git a/nginx_web/Dockerfile b/nginx_web/Dockerfile new file mode 100644 index 0000000..2eb66a3 --- /dev/null +++ b/nginx_web/Dockerfile @@ -0,0 +1,15 @@ +FROM nginx:alpine + +ENV PHP_FPM="namelessmc_php:9000" + +RUN deluser xfs && \ + delgroup www-data && \ + adduser -DH -h /home/www-data -s /sbin/nologin -u 33 www-data + +RUN find /etc/nginx -type f -not -name 'mime.types' -not -name 'fastcgi_params' -delete && \ + rm -rf conf.d modules + +COPY nginx.conf /etc/nginx +COPY entrypoint.sh / + +ENTRYPOINT [ "sh", "/entrypoint.sh" ] diff --git a/nginx_web/entrypoint.sh b/nginx_web/entrypoint.sh new file mode 100644 index 0000000..26fd98f --- /dev/null +++ b/nginx_web/entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +cat > /etc/nginx/php.conf << EOL +upstream php-handler { + server ${PHP_FPM}; +} +EOL + +exec nginx -g "daemon off;" diff --git a/nginx_web/nginx.conf b/nginx_web/nginx.conf new file mode 100644 index 0000000..643adad --- /dev/null +++ b/nginx_web/nginx.conf @@ -0,0 +1,47 @@ +user "www-data"; + +events { + worker_connections 1024; +} + +http { + access_log /dev/stdout; + error_log /dev/stdout; + + include mime.types; + default_type application/octet-stream; + + include php.conf; + + server { + listen 80 default_server; + server_name _; + + index index.php index.html; + + proxy_read_timeout 3600; + fastcgi_read_timeout 3600; + + # Remove X-Powered-By, which is an information leak + fastcgi_hide_header X-Powered-By; + + root /data; + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + + location ~ \.php$ { + try_files $uri = 404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass php-handler; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + client_max_body_size 0; + } +} diff --git a/php_fpm/Dockerfile b/php_fpm/Dockerfile new file mode 100644 index 0000000..1066e22 --- /dev/null +++ b/php_fpm/Dockerfile @@ -0,0 +1,23 @@ +FROM php:7.4-fpm + +ARG NAMELESSMC_VERSION=2.0.0-pr7 + +RUN docker-php-source extract && \ + BUILD_DEPS="libmcrypt-dev libldap2-dev libjpeg62-turbo-dev libfreetype6-dev" && \ + apt-get update && \ + apt-get install -y $BUILD_DEPS libpng-dev curl tar && \ + docker-php-ext-configure gd && \ + docker-php-ext-install -j "$(nproc)" exif gd pdo_mysql mysqli && \ + docker-php-source delete && \ + apt-get purge -y $BUILD_DEPS && \ + apt-get clean && \ + apt-get autoremove --purge -y && \ + rm -rf /var/lib/{apt,dpkg,cache,log}/ /tmp/* /var/tmp/* + +ADD entrypoint.sh / + +ENV NAMELESSMC_VERSION=2.0.0-pr7 + +VOLUME [ "/data" ] + +ENTRYPOINT [ "bash", "/entrypoint.sh" ] diff --git a/php_fpm/entrypoint.sh b/php_fpm/entrypoint.sh new file mode 100644 index 0000000..2f24445 --- /dev/null +++ b/php_fpm/entrypoint.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -e + +if [ -n "$(ls -A /data 2>/dev/null)" ] +then + echo "Data directory contains files, not downloading NamelessMC" +else + echo "Data directory is empty, downloading NamelessMC.." + set -x + mkdir -p /data + cd /tmp + curl -Lo nameless.tar.gz https://github.com/NamelessMC/Nameless/archive/v$NAMELESSMC_VERSION.tar.gz + tar -xf nameless.tar.gz + mv Nameless-$NAMELESSMC_VERSION/{,.[^.]}* /data + chown -R www-data:www-data /data + chmod 755 -R /data + rm -rf /tmp + set +x + echo "Done!" +fi + +exec php-fpm From 7621ac946d6ae2e036a1db98df08f5ed8583ef1d Mon Sep 17 00:00:00 2001 From: Derkades Date: Wed, 10 Jun 2020 19:04:58 +0200 Subject: [PATCH 03/25] Fancy URL support --- nginx_web/nginx.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nginx_web/nginx.conf b/nginx_web/nginx.conf index 643adad..b708da8 100644 --- a/nginx_web/nginx.conf +++ b/nginx_web/nginx.conf @@ -27,6 +27,10 @@ http { root /data; + location / { + try_files $uri $uri/ /index.php?$args; + } + location = /robots.txt { allow all; log_not_found off; From bcad20b299ad97ba1589f0db3fc75b079c8b96cb Mon Sep 17 00:00:00 2001 From: Derkades Date: Wed, 10 Jun 2020 23:15:37 +0200 Subject: [PATCH 04/25] namelessmc web should depend on php --- docker-compose.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yml b/docker-compose.yml index c1628da..da1c170 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,7 @@ services: volumes: ['/srv/namelessmc/web:/data'] # environment: # PHP_FPM: namelessmc_php:9000 + depends_on: [namelessmc_php] restart: unless-stopped namelessmc_php: From b45faa499371ca06e389796739d7a74ab19f2232 Mon Sep 17 00:00:00 2001 From: Derkades Date: Wed, 10 Jun 2020 23:18:45 +0200 Subject: [PATCH 05/25] Fix circular dependeny --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index da1c170..03f976b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: namelessmc: image: derkades/namelessmc-nginx ports: ['80:80'] - volumes: ['/srv/namelessmc/web:/data'] + volumes: ['/srv/namelessmc/web:/data'] # same as php container # environment: # PHP_FPM: namelessmc_php:9000 depends_on: [namelessmc_php] @@ -13,7 +13,7 @@ services: namelessmc_php: image: derkades/namelessmc-php - volumes_from: [namelessmc] + volumes: ['/srv/namelessmc/web:/data'] # same as web container restart: unless-stopped namelessmc_db: From 93de0bea4901577d8616e54f7fe58856a113db29 Mon Sep 17 00:00:00 2001 From: Robin Date: Sat, 18 Jul 2020 12:05:34 +0200 Subject: [PATCH 06/25] Prevent access to template/cache https://github.com/NamelessMC/Nameless/commit/9bd1433f0e18b9de5472480505e9d216ecbc0d1e --- nginx_web/nginx.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nginx_web/nginx.conf b/nginx_web/nginx.conf index b708da8..d2809b1 100644 --- a/nginx_web/nginx.conf +++ b/nginx_web/nginx.conf @@ -31,6 +31,10 @@ http { try_files $uri $uri/ /index.php?$args; } + location ~ \.(tpl|cache)$ { + return 403; + } + location = /robots.txt { allow all; log_not_found off; From bd7c6aef848b003e78ea15a8298b30c9b969de0f Mon Sep 17 00:00:00 2001 From: Derkades Date: Mon, 27 Jul 2020 18:33:21 +0200 Subject: [PATCH 07/25] Compose file for development --- docker-compose.dev.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 docker-compose.dev.yml diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..781ef69 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,25 @@ +version: '2' + +services: + + namelessmc: + build: nginx_web + ports: ['80:80'] + volumes: ['/srv/namelessmc/web:/data'] # same as php container + depends_on: [namelessmc_php] + restart: unless-stopped + + namelessmc_php: + build: php_fpm + volumes: ['/srv/namelessmc/web:/data'] # same as web container + restart: unless-stopped + + namelessmc_db: + image: mariadb + volumes: ['/srv/namelessmc/db:/var/lib/mysql'] + environment: + MYSQL_ROOT_PASSWORD: nameless + MYSQL_USER: nameless + MYSQL_PASSWORD: nameless + MYSQL_DATABASE: nameless + restart: unless-stopped From c154235d46fd0e8b8e07e4136a54685cbae04e2d Mon Sep 17 00:00:00 2001 From: Birkhoff Lee Date: Tue, 28 Jul 2020 01:45:57 +0800 Subject: [PATCH 08/25] Remove default restart policy --- docker-compose.dev.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 781ef69..01f6a6e 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -7,12 +7,10 @@ services: ports: ['80:80'] volumes: ['/srv/namelessmc/web:/data'] # same as php container depends_on: [namelessmc_php] - restart: unless-stopped namelessmc_php: build: php_fpm volumes: ['/srv/namelessmc/web:/data'] # same as web container - restart: unless-stopped namelessmc_db: image: mariadb @@ -22,4 +20,3 @@ services: MYSQL_USER: nameless MYSQL_PASSWORD: nameless MYSQL_DATABASE: nameless - restart: unless-stopped From 817722820858b3dc61de171b42beac2662321d43 Mon Sep 17 00:00:00 2001 From: Birkhoff Lee Date: Tue, 28 Jul 2020 01:46:34 +0800 Subject: [PATCH 09/25] Update LICENSE --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 2d0fc88..7935fda 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Derkades +Copyright (c) 2020 NamelessMC Docker Image Maintainers (https://github.com/NamelessMC/Nameless-Docker/graphs/contributors) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 10c774c7d5253d48c131a8ea9acdc2357d49bfa1 Mon Sep 17 00:00:00 2001 From: Birkhoff Lee Date: Tue, 28 Jul 2020 01:47:36 +0800 Subject: [PATCH 10/25] Update image build tag --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 2bdd402..20e46c1 100755 --- a/build.sh +++ b/build.sh @@ -1,3 +1,3 @@ #!/bin/sh -docker build -t derkades/namelessmc-nginx nginx_web -docker build -t derkades/namelessmc-php php_fpm +docker build -t namelessmc-nginx nginx_web +docker build -t namelessmc-php php_fpm From 466f8e2b239538cf1ca4162d72bc5db72794ecd5 Mon Sep 17 00:00:00 2001 From: Birkhoff Lee Date: Tue, 28 Jul 2020 01:48:03 +0800 Subject: [PATCH 11/25] Update image build tag --- deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy.sh b/deploy.sh index c0d14e2..ee964dd 100755 --- a/deploy.sh +++ b/deploy.sh @@ -6,6 +6,6 @@ set +e docker buildx rm namelessmc_builder set -e docker buildx create --use --name namelessmc_builder -docker buildx build -t derkades/namelessmc-nginx --platform=linux/arm,linux/arm64,linux/amd64 nginx_web --push -docker buildx build -t derkades/namelessmc-php --platform=linux/arm,linux/arm64,linux/amd64 php_fpm --push +docker buildx build -t namelessmc-nginx --platform=linux/arm,linux/arm64,linux/amd64 nginx_web --push +docker buildx build -t namelessmc-php --platform=linux/arm,linux/arm64,linux/amd64 php_fpm --push docker buildx rm namelessmc_builder From 21d08743165a24abf3d831b8567f71d157c6e783 Mon Sep 17 00:00:00 2001 From: Birkhoff Lee Date: Tue, 28 Jul 2020 01:55:03 +0800 Subject: [PATCH 12/25] Update Docker Hub image and container names --- docker-compose.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 03f976b..a0c530a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,21 +2,21 @@ version: '2' services: - namelessmc: - image: derkades/namelessmc-nginx + nginx: + image: namelessmc/nameless-nginx ports: ['80:80'] volumes: ['/srv/namelessmc/web:/data'] # same as php container # environment: - # PHP_FPM: namelessmc_php:9000 - depends_on: [namelessmc_php] + # PHP_FPM: php:9000 + depends_on: [php] restart: unless-stopped - namelessmc_php: - image: derkades/namelessmc-php + php: + image: namelessmc/nameless-php volumes: ['/srv/namelessmc/web:/data'] # same as web container restart: unless-stopped - namelessmc_db: + db: image: mariadb volumes: ['/srv/namelessmc/db:/var/lib/mysql'] environment: From 1555d435f7bc89d87ac8cdb8be989b6679e62ec9 Mon Sep 17 00:00:00 2001 From: Birkhoff Lee Date: Tue, 28 Jul 2020 02:05:27 +0800 Subject: [PATCH 13/25] Update deployment guide --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b62bbfb..5e4a2be 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,17 @@ You have to manually install Docker first if you don't have it installed on your You will need to install [Docker Compose](https://docs.docker.com/compose/) for automated deploying. -```bash -sudo apt install docker-compose +```shell +$ apt install docker-compose # debian ``` -Download the example file, optionally change the directories, passwords, etc. then run it with +Download the example file, optionally change the directories, passwords, etc. then run it -```bash -docker-compose up -d +```shell +$ git clone https://github.com/NamelessMC/Nameless-Docker.git +$ cd Nameless-Docker +$ vim docker-compose.dev.yaml +$ docker-compose up -d ``` When the containers are up, visit the website in a browser to start the installer. By default it listens on any interface, port 80. From 4499daf35cd4d6aebaf84b8077029ac63f9e98b6 Mon Sep 17 00:00:00 2001 From: Birkhoff Lee Date: Tue, 28 Jul 2020 02:06:28 +0800 Subject: [PATCH 14/25] Update database address for deployment guide --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e4a2be..12940ac 100644 --- a/README.md +++ b/README.md @@ -27,4 +27,4 @@ $ docker-compose up -d When the containers are up, visit the website in a browser to start the installer. By default it listens on any interface, port 80. -When the database configuration page shows up, fill in `namelessmc_db` for the *database address*. For database username, password and database name, fill `nameless` for all of them, if you used default database credentials. +When the database configuration page shows up, fill in `db` for the *database address*. For database username, password and database name, fill `nameless` for all of them, if you used default database credentials. From cda455abfd5aa72c32881cb440ba16bd2176c865 Mon Sep 17 00:00:00 2001 From: Derkades Date: Mon, 27 Jul 2020 20:31:13 +0200 Subject: [PATCH 15/25] Remove build.sh For testing the image, people can use the dev docker compose file --- build.sh | 3 --- 1 file changed, 3 deletions(-) delete mode 100755 build.sh diff --git a/build.sh b/build.sh deleted file mode 100755 index 20e46c1..0000000 --- a/build.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -docker build -t namelessmc-nginx nginx_web -docker build -t namelessmc-php php_fpm From e98397aa944707d58e1ffa09feb5c4a9644cda6f Mon Sep 17 00:00:00 2001 From: Derkades Date: Mon, 27 Jul 2020 20:32:18 +0200 Subject: [PATCH 16/25] Update service names in dev file as well --- docker-compose.dev.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 01f6a6e..d0bd0f3 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -2,17 +2,17 @@ version: '2' services: - namelessmc: + nginx: build: nginx_web ports: ['80:80'] volumes: ['/srv/namelessmc/web:/data'] # same as php container depends_on: [namelessmc_php] - namelessmc_php: + php: build: php_fpm volumes: ['/srv/namelessmc/web:/data'] # same as web container - namelessmc_db: + db: image: mariadb volumes: ['/srv/namelessmc/db:/var/lib/mysql'] environment: From f597f4e3050a5c8abf6dc328092a2ab01a290307 Mon Sep 17 00:00:00 2001 From: Derkades Date: Mon, 27 Jul 2020 20:32:42 +0200 Subject: [PATCH 17/25] Update default php fpm host --- nginx_web/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx_web/Dockerfile b/nginx_web/Dockerfile index 2eb66a3..fca72df 100644 --- a/nginx_web/Dockerfile +++ b/nginx_web/Dockerfile @@ -1,6 +1,6 @@ FROM nginx:alpine -ENV PHP_FPM="namelessmc_php:9000" +ENV PHP_FPM="php:9000" RUN deluser xfs && \ delgroup www-data && \ From 3fce6b2fb5a6f7e8b2620f858f8510760cfe73cc Mon Sep 17 00:00:00 2001 From: Derkades Date: Mon, 27 Jul 2020 20:35:27 +0200 Subject: [PATCH 18/25] Fix image repo name in deploy script --- deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy.sh b/deploy.sh index ee964dd..3e0fe44 100755 --- a/deploy.sh +++ b/deploy.sh @@ -6,6 +6,6 @@ set +e docker buildx rm namelessmc_builder set -e docker buildx create --use --name namelessmc_builder -docker buildx build -t namelessmc-nginx --platform=linux/arm,linux/arm64,linux/amd64 nginx_web --push -docker buildx build -t namelessmc-php --platform=linux/arm,linux/arm64,linux/amd64 php_fpm --push +docker buildx build -t namelessmc/namelessmc-nginx --platform=linux/arm,linux/arm64,linux/amd64 nginx_web --push +docker buildx build -t namelessmc/namelessmc-php --platform=linux/arm,linux/arm64,linux/amd64 php_fpm --push docker buildx rm namelessmc_builder From 2b48d23abcfe45bc4e799b6c95c14ef03a490ad7 Mon Sep 17 00:00:00 2001 From: Derkades Date: Tue, 28 Jul 2020 19:03:40 +0200 Subject: [PATCH 19/25] Shorter image names --- deploy.sh | 4 ++-- docker-compose.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deploy.sh b/deploy.sh index 3e0fe44..2023050 100755 --- a/deploy.sh +++ b/deploy.sh @@ -6,6 +6,6 @@ set +e docker buildx rm namelessmc_builder set -e docker buildx create --use --name namelessmc_builder -docker buildx build -t namelessmc/namelessmc-nginx --platform=linux/arm,linux/arm64,linux/amd64 nginx_web --push -docker buildx build -t namelessmc/namelessmc-php --platform=linux/arm,linux/arm64,linux/amd64 php_fpm --push +docker buildx build -t namelessmc/nginx --platform=linux/arm,linux/arm64,linux/amd64 nginx_web --push +docker buildx build -t namelessmc/php --platform=linux/arm,linux/arm64,linux/amd64 php_fpm --push docker buildx rm namelessmc_builder diff --git a/docker-compose.yml b/docker-compose.yml index a0c530a..e3eb4b2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '2' services: nginx: - image: namelessmc/nameless-nginx + image: namelessmc/nginx ports: ['80:80'] volumes: ['/srv/namelessmc/web:/data'] # same as php container # environment: @@ -12,7 +12,7 @@ services: restart: unless-stopped php: - image: namelessmc/nameless-php + image: namelessmc/php volumes: ['/srv/namelessmc/web:/data'] # same as web container restart: unless-stopped From ed5f18e10c91e33fd5ec705ab1c2b6d94ebf1faf Mon Sep 17 00:00:00 2001 From: Derkades Date: Tue, 28 Jul 2020 19:04:10 +0200 Subject: [PATCH 20/25] Revert "Update deployment guide" This reverts commit 1555d435f7bc89d87ac8cdb8be989b6679e62ec9. --- README.md | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 12940ac..6faa988 100644 --- a/README.md +++ b/README.md @@ -12,17 +12,14 @@ You have to manually install Docker first if you don't have it installed on your You will need to install [Docker Compose](https://docs.docker.com/compose/) for automated deploying. -```shell -$ apt install docker-compose # debian +```bash +sudo apt install docker-compose ``` -Download the example file, optionally change the directories, passwords, etc. then run it +Download the example file, optionally change the directories, passwords, etc. then run it with -```shell -$ git clone https://github.com/NamelessMC/Nameless-Docker.git -$ cd Nameless-Docker -$ vim docker-compose.dev.yaml -$ docker-compose up -d +```bash +docker-compose up -d ``` When the containers are up, visit the website in a browser to start the installer. By default it listens on any interface, port 80. From 036390f88f8324259418d3714a919f738abb243d Mon Sep 17 00:00:00 2001 From: Derkades Date: Tue, 28 Jul 2020 19:09:20 +0200 Subject: [PATCH 21/25] Include download link in instructions --- README.md | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 6faa988..99a0a2e 100644 --- a/README.md +++ b/README.md @@ -16,12 +16,8 @@ You will need to install [Docker Compose](https://docs.docker.com/compose/) for sudo apt install docker-compose ``` -Download the example file, optionally change the directories, passwords, etc. then run it with - -```bash -docker-compose up -d -``` +Download [docker-compose.yml](https://github.com/NamelessMC/Nameless-Docker/raw/master/docker-compose.yml), optionally change some settings, then run `docker-compose up -d`. The default restart policy is `unless-stopped` so your website will start back up after a reboot. When the containers are up, visit the website in a browser to start the installer. By default it listens on any interface, port 80. -When the database configuration page shows up, fill in `db` for the *database address*. For database username, password and database name, fill `nameless` for all of them, if you used default database credentials. +When the database configuration page shows up, fill in `db` for *database address*. For database username, password and database name, fill `nameless` for all of them, if you used default database credentials. From 52fdac965e51338f624164d14584de84706b2f38 Mon Sep 17 00:00:00 2001 From: Derkades Date: Tue, 28 Jul 2020 19:12:24 +0200 Subject: [PATCH 22/25] Development file is in main repo --- README.md | 5 +++++ docker-compose.dev.yml | 22 ---------------------- 2 files changed, 5 insertions(+), 22 deletions(-) delete mode 100644 docker-compose.dev.yml diff --git a/README.md b/README.md index 99a0a2e..d32b095 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,8 @@ Download [docker-compose.yml](https://github.com/NamelessMC/Nameless-Docker/raw/ When the containers are up, visit the website in a browser to start the installer. By default it listens on any interface, port 80. When the database configuration page shows up, fill in `db` for *database address*. For database username, password and database name, fill `nameless` for all of them, if you used default database credentials. + + +## Development + +If you want to use Docker for developing NamelessMC, please see the [docker compose file in the main repo](https://github.com/NamelessMC/Nameless/blob/v2/docker-compose.yaml). \ No newline at end of file diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml deleted file mode 100644 index d0bd0f3..0000000 --- a/docker-compose.dev.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: '2' - -services: - - nginx: - build: nginx_web - ports: ['80:80'] - volumes: ['/srv/namelessmc/web:/data'] # same as php container - depends_on: [namelessmc_php] - - php: - build: php_fpm - volumes: ['/srv/namelessmc/web:/data'] # same as web container - - db: - image: mariadb - volumes: ['/srv/namelessmc/db:/var/lib/mysql'] - environment: - MYSQL_ROOT_PASSWORD: nameless - MYSQL_USER: nameless - MYSQL_PASSWORD: nameless - MYSQL_DATABASE: nameless From 1e543a72b7ed3de02f31a6e0eaf9a2aaf3a3a492 Mon Sep 17 00:00:00 2001 From: Derkades Date: Fri, 14 Aug 2020 16:45:38 +0200 Subject: [PATCH 23/25] Remove implicit volume declaration --- php_fpm/Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/php_fpm/Dockerfile b/php_fpm/Dockerfile index 1066e22..d31459a 100644 --- a/php_fpm/Dockerfile +++ b/php_fpm/Dockerfile @@ -18,6 +18,4 @@ ADD entrypoint.sh / ENV NAMELESSMC_VERSION=2.0.0-pr7 -VOLUME [ "/data" ] - ENTRYPOINT [ "bash", "/entrypoint.sh" ] From 8bdfbe58ae803d826130c53510d8ab83346697a9 Mon Sep 17 00:00:00 2001 From: Derkades Date: Fri, 14 Aug 2020 16:45:59 +0200 Subject: [PATCH 24/25] Use namelessmc/ prefix --- deploy.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy.sh b/deploy.sh index c0d14e2..2023050 100755 --- a/deploy.sh +++ b/deploy.sh @@ -6,6 +6,6 @@ set +e docker buildx rm namelessmc_builder set -e docker buildx create --use --name namelessmc_builder -docker buildx build -t derkades/namelessmc-nginx --platform=linux/arm,linux/arm64,linux/amd64 nginx_web --push -docker buildx build -t derkades/namelessmc-php --platform=linux/arm,linux/arm64,linux/amd64 php_fpm --push +docker buildx build -t namelessmc/nginx --platform=linux/arm,linux/arm64,linux/amd64 nginx_web --push +docker buildx build -t namelessmc/php --platform=linux/arm,linux/arm64,linux/amd64 php_fpm --push docker buildx rm namelessmc_builder From 9e9954ef2dd04da3be7692572a174fc37e243679 Mon Sep 17 00:00:00 2001 From: Derkades Date: Fri, 14 Aug 2020 16:46:38 +0200 Subject: [PATCH 25/25] fix fancy url support --- nginx_web/nginx.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nginx_web/nginx.conf b/nginx_web/nginx.conf index b708da8..410b6ae 100644 --- a/nginx_web/nginx.conf +++ b/nginx_web/nginx.conf @@ -28,7 +28,7 @@ http { root /data; location / { - try_files $uri $uri/ /index.php?$args; + try_files $uri $uri/ /index.php?route=$uri&$args; } location = /robots.txt {