diff --git a/docker/.env b/docker/.env deleted file mode 100755 index 760f38cbc..000000000 --- a/docker/.env +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -# See https://docs.docker.com/compose/environment-variables/#the-env-file - -# Nginx -NGINX_HOST=localhost - -# PHP - -# See https://hub.docker.com/r/nanoninja/php-fpm/tags/ -PHP_VERSION=latest - -# MySQL -MYSQL_VERSION=5.7.22 -MYSQL_HOST=mysql -MYSQL_DATABASE=test -MYSQL_ROOT_USER=root -MYSQL_ROOT_PASSWORD=root -MYSQL_USER=dev -MYSQL_PASSWORD=dev diff --git a/docker/.gitignore b/docker/.gitignore deleted file mode 100755 index 7fbb7857b..000000000 --- a/docker/.gitignore +++ /dev/null @@ -1,25 +0,0 @@ -# Global -.*.swp -.DS_Store - -# Application -web/app/composer.json -web/app/composer.lock -web/app/vendor/ -web/app/doc/ -web/app/report/ -data/ - -# PHPStorm -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/dictionaries - -# Netbeans -nbproject/ -/nbproject/ -/nbproject/private/ -/nbproject/private/private.properties - -# SSL Certs -etc/ssl/ \ No newline at end of file diff --git a/docker/.travis.yml b/docker/.travis.yml deleted file mode 100755 index 8ec197855..000000000 --- a/docker/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -sudo: required - -env: - DOCKER_COMPOSE_VERSION: 1.18.0 - -services: - - docker - -before_install: - - sudo apt update - - sudo rm /usr/local/bin/docker-compose - - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose - - chmod +x docker-compose - - sudo mv docker-compose /usr/local/bin - - docker-compose --version - -before_script: - - sudo make docker-start - - sleep 2m - -script: - - sudo make apidoc - - sudo make gen-certs - - sudo make mysql-dump - - sudo make mysql-restore - - sudo make phpmd - - sudo make test - -after_script: - - sudo make docker-stop \ No newline at end of file diff --git a/docker/Makefile b/docker/Makefile deleted file mode 100755 index 86b5d3c43..000000000 --- a/docker/Makefile +++ /dev/null @@ -1,83 +0,0 @@ -# Makefile for Docker Nginx PHP Composer MySQL - -include .env - -# MySQL -MYSQL_DUMPS_DIR=data/db/dumps - -help: - @echo "" - @echo "usage: make COMMAND" - @echo "" - @echo "Commands:" - @echo " apidoc Generate documentation of API" - @echo " code-sniff Check the API with PHP Code Sniffer (PSR2)" - @echo " clean Clean directories for reset" - @echo " composer-up Update PHP dependencies with composer" - @echo " docker-start Create and start containers" - @echo " docker-stop Stop and clear all services" - @echo " gen-certs Generate SSL certificates" - @echo " logs Follow log output" - @echo " mysql-dump Create backup of all databases" - @echo " mysql-restore Restore backup of all databases" - @echo " phpmd Analyse the API with PHP Mess Detector" - @echo " test Test application" - -init: - @$(shell cp -n $(shell pwd)/web/app/composer.json.dist $(shell pwd)/web/app/composer.json 2> /dev/null) - -apidoc: - @docker-compose exec -T php php -d memory_limit=256M -d xdebug.profiler_enable=0 ./app/vendor/bin/apigen generate app/src --destination app/doc - @make resetOwner - -clean: - @rm -Rf data/db/mysql/* - @rm -Rf $(MYSQL_DUMPS_DIR)/* - @rm -Rf web/app/vendor - @rm -Rf web/app/composer.lock - @rm -Rf web/app/doc - @rm -Rf web/app/report - @rm -Rf etc/ssl/* - -code-sniff: - @echo "Checking the standard code..." - @docker-compose exec -T php ./app/vendor/bin/phpcs -v --standard=PSR2 app/src - -composer-up: - @docker run --rm -v $(shell pwd)/web/app:/app composer update - -docker-start: init - docker-compose up -d - -docker-stop: - @docker-compose down -v - @make clean - -gen-certs: - @docker run --rm -v $(shell pwd)/etc/ssl:/certificates -e "SERVER=$(NGINX_HOST)" jacoelho/generate-certificate - -logs: - @docker-compose logs -f - -mysql-dump: - @mkdir -p $(MYSQL_DUMPS_DIR) - @docker exec $(shell docker-compose ps -q mysqldb) mysqldump --all-databases -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" > $(MYSQL_DUMPS_DIR)/db.sql 2>/dev/null - @make resetOwner - -mysql-restore: - @docker exec -i $(shell docker-compose ps -q mysqldb) mysql -u"$(MYSQL_ROOT_USER)" -p"$(MYSQL_ROOT_PASSWORD)" < $(MYSQL_DUMPS_DIR)/db.sql 2>/dev/null - -phpmd: - @docker-compose exec -T php \ - ./app/vendor/bin/phpmd \ - ./app/src \ - text cleancode,codesize,controversial,design,naming,unusedcode - -test: code-sniff - @docker-compose exec -T php ./app/vendor/bin/phpunit --colors=always --configuration ./app/ - @make resetOwner - -resetOwner: - @$(shell chown -Rf $(SUDO_USER):$(shell id -g -n $(SUDO_USER)) $(MYSQL_DUMPS_DIR) "$(shell pwd)/etc/ssl" "$(shell pwd)/web/app" 2> /dev/null) - -.PHONY: clean test code-sniff init \ No newline at end of file diff --git a/docker/README.md b/docker/README.md deleted file mode 100755 index 261e41d53..000000000 --- a/docker/README.md +++ /dev/null @@ -1,24 +0,0 @@ -# 用docker-compose 部署shopxo - -## Nginx PHP MySQL - -方案来源于 [nanoninja/docker-nginx-php-mysql](https://github.com/nanoninja/docker-nginx-php-mysql)涉及到php相关的内容,请参考该仓库 - -## 部署步骤 - -1. [安装docker](https://www.docker.com/) - [国内用户安装docker](https://www.runoob.com/docker/ubuntu-docker-install.html) - [docker从入门到实践](https://legacy.gitbook.com/book/yeasy/docker_practice/details) -2. [安装docker-compose](https://docs.docker.com/compose/reference/overview/) - -3. 克隆代码并且修改shopxo文件夹权限 - - git clone git@github.com:gongfuxiang/shopxo.git - - sudo chmod -R 777 shopxo - -4. 用docker-compose 运行项目包括数据库,如果不想用容器里面的数据库可以单独配置数据库 - - cd shopxo - - docker-compose up - - 访问 localhost:10000 - -5. 如果使用容器里面的数据库,可以将数据库的地址设置为容器名称 利用docker网络访问数据库 - diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml deleted file mode 100755 index e2047561f..000000000 --- a/docker/docker-compose.yml +++ /dev/null @@ -1,41 +0,0 @@ -version: '3' -services: - web: - image: nginx - volumes: - - "./etc/nginx/default.conf:/etc/nginx/conf.d/default.conf" - - "../:/var/www/html" # shopxo代码挂载在nginx里面 - - "./etc/nginx/default.template.conf:/etc/nginx/conf.d/default.template" - ports: - - "10000:80" - - "3000:443" - environment: - - NGINX_HOST=${NGINX_HOST} # 可以设置nginx的域名 - command: /bin/sh -c "envsubst '$$NGINX_HOST' < /etc/nginx/conf.d/default.template > /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'" - restart: always - depends_on: - - php - - mysqldb - php: - image: nanoninja/php-fpm:7.4.4 - restart: always - volumes: - - "./etc/php/php.ini:/usr/local/etc/php/conf.d/php.ini" - - "../:/var/www/html" - - mysqldb: - image: mysql:5.7 - container_name: mysql - restart: always - env_file: - - ".env" - environment: - - MYSQL_DATABASE=yourdb - - MYSQL_ROOT_PASSWORD=yourpasswd - - MYSQL_USER=youruser - - MYSQL_PASSWORD=yourpasswd - ports: - - "10001:3306" - volumes: - - "/data/shopxo_db:/var/lib/mysql" # mysql数据库持久化配置 - - "./etc/db/my.cnf:/etc/mysql/my.cnf" # 修改mysql配置,首页统计 diff --git a/docker/etc/db/my.cnf b/docker/etc/db/my.cnf deleted file mode 100755 index 3b54eec10..000000000 --- a/docker/etc/db/my.cnf +++ /dev/null @@ -1,25 +0,0 @@ -# -# The MySQL database server configuration file. -# -# You can copy this to one of: -# - "/etc/mysql/my.cnf" to set global options, -# - "~/.my.cnf" to set user-specific options. -# -# One can use all long options that the program supports. -# Run program with --help to get a list of available options and with -# --print-defaults to see which it would actually understand and use. -# -# For explanations see -# http://dev.mysql.com/doc/mysql/en/server-system-variables.html - -# This will be passed to all mysql clients -# It has been reported that passwords should be enclosed with ticks/quotes -# escpecially if they contain "#" chars... -# Remember to edit /etc/mysql/debian.cnf when changing the socket location. - -# Here is entries for some specific programs -# The following values assume you have at least 32M ram -[mysqld] -sql_mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION - -!includedir /etc/mysql/conf.d/ diff --git a/docker/etc/nginx/default.conf b/docker/etc/nginx/default.conf deleted file mode 100755 index 1088f8f2a..000000000 --- a/docker/etc/nginx/default.conf +++ /dev/null @@ -1,48 +0,0 @@ -# Nginx configuration - -server { - listen 80 default_server; - listen [::]:80 default_server; - server_name localhost; - - index index.php index.html; - error_log /var/log/nginx/error.log; - access_log /var/log/nginx/access.log; - root /var/www/html/public; - - location ~ \.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass php:9000; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - } -} - -# server { -# server_name localhost; - -# listen 443 ssl; -# fastcgi_param HTTPS on; - -# ssl_certificate /etc/ssl/server.pem; -# ssl_certificate_key /etc/ssl/server.key; -# ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; - -# index index.php index.html; -# error_log /var/log/nginx/error.log; -# access_log /var/log/nginx/access.log; -# root /var/www/html/public; - -# location ~ \.php$ { -# try_files $uri =404; -# fastcgi_split_path_info ^(.+\.php)(/.+)$; -# fastcgi_pass php:9000; -# fastcgi_index index.php; -# include fastcgi_params; -# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; -# fastcgi_param PATH_INFO $fastcgi_path_info; -# } -# } \ No newline at end of file diff --git a/docker/etc/nginx/default.template.conf b/docker/etc/nginx/default.template.conf deleted file mode 100755 index 2a485890f..000000000 --- a/docker/etc/nginx/default.template.conf +++ /dev/null @@ -1,48 +0,0 @@ -# Nginx configuration - -server { - listen 80 default_server; - listen [::]:80 default_server; - server_name ${NGINX_HOST}; - - index index.php index.html; - error_log /var/log/nginx/error.log; - access_log /var/log/nginx/access.log; - root /var/www/html/public; - - location ~ \.php$ { - try_files $uri =404; - fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass php:9000; - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_param PATH_INFO $fastcgi_path_info; - } -} - -# server { -# server_name ${NGINX_HOST}; - -# listen 443 ssl; -# fastcgi_param HTTPS on; - -# ssl_certificate /etc/ssl/server.pem; -# ssl_certificate_key /etc/ssl/server.key; -# ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; - -# index index.php index.html; -# error_log /var/log/nginx/error.log; -# access_log /var/log/nginx/access.log; -# root /var/www/html/public; - -# location ~ \.php$ { -# try_files $uri =404; -# fastcgi_split_path_info ^(.+\.php)(/.+)$; -# fastcgi_pass php:9000; -# fastcgi_index index.php; -# include fastcgi_params; -# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; -# fastcgi_param PATH_INFO $fastcgi_path_info; -# } -# } \ No newline at end of file diff --git a/docker/etc/php/php.ini b/docker/etc/php/php.ini deleted file mode 100755 index 4f47c01f7..000000000 --- a/docker/etc/php/php.ini +++ /dev/null @@ -1,29 +0,0 @@ -; PHP Configuration - -;[Date] -; Defines the default timezone used by the date functions -; http://php.net/date.timezone -;date.timezone = - -; Error handling -;display_errors = Off - -; Xdebug -; See https://xdebug.org/docs/all_settings - -;PHPStorm -[Xdebug] -xdebug.remote_enable=1 -xdebug.idekey=PHPSTORM -xdebug.profiler_enable=0 -xdebug.max_nesting_level=700 -xdebug.remote_host=192.168.0.1 # your ip -xdebug.remote_port=9000 - -;Netbeans -;[Xdebug] -;xdebug.remote_enable=1 -;xdebug.remote_handler=dbgp -;xdebug.remote_mode=req -;xdebug.remote_host=192.168.0.1 # your ip -;xdebug.remote_port=9000 \ No newline at end of file diff --git a/docker/web/app/composer.json.dist b/docker/web/app/composer.json.dist deleted file mode 100755 index 1db4dfaa3..000000000 --- a/docker/web/app/composer.json.dist +++ /dev/null @@ -1,24 +0,0 @@ -{ - "require": { - - }, - "require-dev": { - "apigen/apigen": "dev-master", - "phpmd/phpmd": "@stable", - "phpunit/phpunit": "^7.0", - "roave/better-reflection": "dev-master", - "squizlabs/php_codesniffer": "3.*" - }, - "autoload": { - "psr-4": { - "App\\Acme\\": "src/" - } - }, - "autoload-dev": { - "psr-4": { - "AppTest\\Acme\\": "test/" - } - }, - "minimum-stability": "stable", - "prefer-stable": true -} \ No newline at end of file diff --git a/docker/web/app/phpunit.xml.dist b/docker/web/app/phpunit.xml.dist deleted file mode 100755 index 7cd9c11cf..000000000 --- a/docker/web/app/phpunit.xml.dist +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - ./test/ - - - - - - ./src - - ./vendor - - - - - - - - - - - - - diff --git a/docker/web/app/src/Foo.php b/docker/web/app/src/Foo.php deleted file mode 100755 index f94d679cd..000000000 --- a/docker/web/app/src/Foo.php +++ /dev/null @@ -1,11 +0,0 @@ -assertEquals($foo->getName(), 'Nginx PHP MySQL'); - } -} diff --git a/docker/web/app/test/bootstrap.php b/docker/web/app/test/bootstrap.php deleted file mode 100755 index 5106c0e1c..000000000 --- a/docker/web/app/test/bootstrap.php +++ /dev/null @@ -1,8 +0,0 @@ - - - - - Docker <?php echo $foo->getName(); ?> - - -

Docker getName(); ?>

- -