From 405911323e7a38341adced6fa11ca81d07ef1b69 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Sun, 24 Mar 2024 20:31:02 +0700 Subject: [PATCH 1/6] Update FUNDING.yml --- .github/FUNDING.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 18b8e92..0093468 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,2 @@ github: [tanhongit] -custom: ["https://paypal.me/tanhongcom"] +custom: ["https://www.paypal.com/paypalme/tanhongcom"] From d0199d38b090a0294d7275044c66a34eef9f7450 Mon Sep 17 00:00:00 2001 From: tbreuss Date: Sun, 19 May 2024 22:10:35 +0200 Subject: [PATCH 2/6] fix: deny from in htaccess --- admin/database/.htaccess | 2 +- content/.htaccess | 2 +- lib/.htaccess | 2 +- logs/.htaccess | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/database/.htaccess b/admin/database/.htaccess index 3bf8ec0..28f68f7 100644 --- a/admin/database/.htaccess +++ b/admin/database/.htaccess @@ -1,4 +1,4 @@ -deny form all +deny from all # Developed by: TanHongIT # Website: https://tanhongit.com - https://tanhongit.net diff --git a/content/.htaccess b/content/.htaccess index 3bf8ec0..28f68f7 100644 --- a/content/.htaccess +++ b/content/.htaccess @@ -1,4 +1,4 @@ -deny form all +deny from all # Developed by: TanHongIT # Website: https://tanhongit.com - https://tanhongit.net diff --git a/lib/.htaccess b/lib/.htaccess index b318a1a..3418e55 100644 --- a/lib/.htaccess +++ b/lib/.htaccess @@ -1 +1 @@ -deny form all \ No newline at end of file +deny from all \ No newline at end of file diff --git a/logs/.htaccess b/logs/.htaccess index b318a1a..3418e55 100644 --- a/logs/.htaccess +++ b/logs/.htaccess @@ -1 +1 @@ -deny form all \ No newline at end of file +deny from all \ No newline at end of file From e6b812409e8d4db603f7cc9e5844ee59df144ad0 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Sat, 1 Jun 2024 18:12:56 +0700 Subject: [PATCH 3/6] fix: update docker --- .env.example | 20 ++++++++++---------- docker/Dockerfile | 2 ++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.env.example b/.env.example index 2c42d1f..109911a 100644 --- a/.env.example +++ b/.env.example @@ -16,16 +16,16 @@ SMTP_UNAME SMTP_PWORD ################### For docker ################### -APP_NAME +APP_NAME=nms -APP_PORT -SSL_PORT +APP_PORT=85 +SSL_PORT=445 -MYSQL_PORT -MYSQL_USER -MYSQL_ROOT_PASS -MYSQL_DB -MYSQL_PASS +MYSQL_PORT=13306 +MYSQL_ROOT_PASS=root +MYSQL_DB=new_mvc_shop_db +MYSQL_USER=root +MYSQL_PASS=root -PHPMYADMIN_PORT -PHPMYADMIN_UPLOAD_LIMIT +PHPMYADMIN_PORT=8183 +PHPMYADMIN_UPLOAD_LIMIT=1024M diff --git a/docker/Dockerfile b/docker/Dockerfile index 6422391..6b90c73 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -38,3 +38,5 @@ RUN chown -R www-data:www-data /var/www/html EXPOSE 80 EXPOSE 443 + +CMD ["apache2-foreground"] From 5de00f9a72793b2cf136846a40f1c86ea65ee9ae Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Sun, 2 Jun 2024 16:00:14 +0700 Subject: [PATCH 4/6] fix: update docker config and docs --- README.md | 18 +++++++++--------- ...anhongit-2022-07-10-12-37-26.sql => db.sql} | 0 docker-compose.yml | 13 +++++++------ docker/Dockerfile | 7 +++++-- install.sh | 14 ++++++++++++++ 5 files changed, 35 insertions(+), 17 deletions(-) rename admin/database/{db-backup-tanhongit-2022-07-10-12-37-26.sql => db.sql} (100%) create mode 100644 install.sh diff --git a/README.md b/README.md index a3bc3cd..dce2d03 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ Support this project :stuck_out_tongue_winking_eye: :pray: # 1. Configuration requirements > - Web Server: Apache > - Version PHP >= 8.0 +> - Composer >= 2.0 > - OpenSSL PHP Extension > - [Composer](https://getcomposer.org/download/) (Please install composer before running this project). > - MySQL >= 8.0 (or MariaDB >= 10.0) @@ -65,16 +66,16 @@ Clone the project to your computer: git clone https://github.com/tanhongit/new-mvc-shop.git ``` -Run composer install: +Copy the .env.example file to .env: ```bash -composer install +cp .env.example .env ``` -Copy the .env.example file to .env: +Run composer install: ```bash -cp .env.example .env +composer install ``` # 6. Installation instructions @@ -109,7 +110,7 @@ DB_HOST=db_server DB_PORT=3306 DB_USER=root DB_PASS=root -DB_NAME=chikoi +DB_NAME=new_mvc_shop_db ``` > **Note:** @@ -177,7 +178,7 @@ Please edit the following information in the **.env** file: **Example:** ```dotenv -APP_NAME=new-mvc-shop +APP_NAME=nms APP_PORT=85 SSL_PORT=443 # (optional) @@ -195,14 +196,13 @@ PHPMYADMIN_UPLOAD_LIMIT=2048M Then, run the following command: ```bash -docker-compose up -d +docker compose up -d ``` After running the above command, you need to install the composer package for the project. ```bash -docker-compose exec server bash -composer install +docker compose run --rm -w /var/www/html server composer install ``` Finally, you need to import the database file into the database container. diff --git a/admin/database/db-backup-tanhongit-2022-07-10-12-37-26.sql b/admin/database/db.sql similarity index 100% rename from admin/database/db-backup-tanhongit-2022-07-10-12-37-26.sql rename to admin/database/db.sql diff --git a/docker-compose.yml b/docker-compose.yml index 382fb77..ee4e7cc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,12 +6,12 @@ networks: services: server: -# build: -# context: . -# dockerfile: ./docker/Dockerfile -# args: -# - PHP_VERSION_SELECTED=${PHP_VERSION_SELECTED:-8.2} - image: tanhong/new-mvc-shop:docker + build: + context: . + dockerfile: ./docker/Dockerfile + args: + - PHP_VERSION_SELECTED=${PHP_VERSION_SELECTED:-8.2} +# image: tanhong/new-mvc-shop:docker container_name: '${APP_NAME:-new_mvc_shop}-server' ports: - '${APP_PORT:-85}:80' @@ -44,6 +44,7 @@ services: volumes: - db_data:/var/lib/mysql - ./docker/db/mariadb/my.cnf:/etc/mysql/conf.d/my.cnf + - ./admin/database:/var/lib/mysql/sql networks: - new_mvc_shop diff --git a/docker/Dockerfile b/docker/Dockerfile index 6b90c73..86a86e9 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -12,10 +12,13 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libjpeg62-turbo-dev \ libfreetype6-dev \ curl \ + git \ + zip \ + unzip \ + libxml2-dev \ && rm -r /var/lib/apt/lists/* -RUN a2enmod rewrite -RUN a2enmod ssl +RUN a2enmod rewrite && a2enmod ssl RUN docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install -j$(nproc) \ diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..994dcf5 --- /dev/null +++ b/install.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -a +source .env +set +a + +# Check if .env file not exists +if [ ! -f .env ]; then + cp .env.example .env +fi + +docker compose up -d + +docker compose run --rm -w /var/www/html server composer install From 43b32f9716088d25c2981f3487983b37baa63e88 Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Sun, 2 Jun 2024 16:19:15 +0700 Subject: [PATCH 5/6] fix: update docker config --- docker-compose.yml | 12 ++++++------ install.sh | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index ee4e7cc..1da2611 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,12 +6,12 @@ networks: services: server: - build: - context: . - dockerfile: ./docker/Dockerfile - args: - - PHP_VERSION_SELECTED=${PHP_VERSION_SELECTED:-8.2} -# image: tanhong/new-mvc-shop:docker +# build: +# context: . +# dockerfile: ./docker/Dockerfile +# args: +# - PHP_VERSION_SELECTED=${PHP_VERSION_SELECTED:-8.2} + image: tanhong/new-mvc-shop:docker container_name: '${APP_NAME:-new_mvc_shop}-server' ports: - '${APP_PORT:-85}:80' diff --git a/install.sh b/install.sh index 994dcf5..94823e3 100644 --- a/install.sh +++ b/install.sh @@ -4,11 +4,20 @@ set -a source .env set +a -# Check if .env file not exists -if [ ! -f .env ]; then +if [ -f .env ]; then + echo " ∟ .env file exists" +else + echo " ∟ Creating .env file" cp .env.example .env fi docker compose up -d -docker compose run --rm -w /var/www/html server composer install +if [ -d vendor ]; then + echo " ∟ vendor directory exists" + echo " ∟ Running composer update" + docker compose run --rm -w /var/www/html server composer update +else + echo " ∟ Running composer install" + docker compose run --rm -w /var/www/html server composer install +fi From 5c2f5276425dc1a36205673a9808e27311ccaa8a Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Sun, 2 Jun 2024 16:25:51 +0700 Subject: [PATCH 6/6] fix: shellcheck --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index 94823e3..4f0c760 100644 --- a/install.sh +++ b/install.sh @@ -1,6 +1,7 @@ #!/bin/bash set -a +# shellcheck disable=SC1091 source .env set +a