diff --git a/.env.example b/.env.example index 2c42d1ff..109911ad 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/.github/FUNDING.yml b/.github/FUNDING.yml index 18b8e925..00934686 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"] diff --git a/README.md b/README.md index a3bc3cdc..dce2d03b 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/.htaccess b/admin/database/.htaccess index 3bf8ec08..28f68f7c 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/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/content/.htaccess b/content/.htaccess index 3bf8ec08..28f68f7c 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/docker-compose.yml b/docker-compose.yml index 382fb777..1da2611c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 6422391f..86a86e94 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) \ @@ -38,3 +41,5 @@ RUN chown -R www-data:www-data /var/www/html EXPOSE 80 EXPOSE 443 + +CMD ["apache2-foreground"] diff --git a/install.sh b/install.sh new file mode 100644 index 00000000..4f0c760e --- /dev/null +++ b/install.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +set -a +# shellcheck disable=SC1091 +source .env +set +a + +if [ -f .env ]; then + echo " ∟ .env file exists" +else + echo " ∟ Creating .env file" + cp .env.example .env +fi + +docker compose up -d + +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 diff --git a/lib/.htaccess b/lib/.htaccess index b318a1af..3418e55a 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 b318a1af..3418e55a 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