update .env

This commit is contained in:
khanh97dev 2023-11-13 10:47:45 +07:00
parent 35fbc4d491
commit 4d2c66d7cd
9 changed files with 57 additions and 15 deletions

5
.command/compile Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
bin/magento cache:clean
bin/magento cache:flush
bin/magento setup:di:compile

View File

@ -2,11 +2,8 @@
source "$PWD/.env"
echo $ADMIN_EMAIL
exit
php /var/www/html/bin/magento setup:install \
--base-url=http://localhost:$PORT \
--base-url=$APP_URL \
--db-host=mysql \
--db-name=$MYSQL_DATABASE \
--db-user=$MYSQL_USER \

5
.command/set-base-url Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
source "$PWD/.env"
bin/magento setup:store-config:set --base-url $APP_URL

5
.env
View File

@ -1,7 +1,8 @@
# NETWORK
PORT=8000
PORT=81
APP_URL=http://localhost:${PORT}
# Docker
# MYSQL
MYSQL_USER=magento
MYSQL_DATABASE=magento
MYSQL_PASSWORD=secret

View File

@ -62,12 +62,6 @@ RUN sed -i 's/memory_limit = 128M/memory_limit = -1/' /etc/php81/php.ini
# Working file
WORKDIR /var/www/html
# Composer
COPY ./composer.json /var/www/html/
COPY ./auth.json /var/www/html/
RUN composer install
COPY ./docker-entrypoint.sh /docker-entrypoint.sh
RUN chmod +x /docker-entrypoint.sh
ENTRYPOINT ["/docker-entrypoint.sh"]

34
Readme.md Normal file
View File

@ -0,0 +1,34 @@
# Reference and build
## Start on Docker
```sh
docker compose up
```
## Setup magento2
> [!Important]
> Is linux os
```sh
chmod +x ./docker_exec
```
> Install docker
```sh
./docker_exec ./command/install
```
> Disable 2FA to login to admin
```sh
./docker_exec bin/magento module:disable Magento_TwoFactorAuth
./docker_exec bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth
```
> Compile
```sh
./docker_exec ./command/compile
```
> Gelink login to admin
```
app/etc/env.php:4
```
```
backend.frontName => 'admin_*'
```
> http://localhost:81/admin_*
>> 81: Port of docker

View File

@ -16,8 +16,8 @@ services:
elasticsearch:
image: elasticsearch:7.17.14
ports:
- 9200:9200
- 9300:9300
- :9200
- :9300
environment:
- ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
- discovery.type=single-node
@ -33,7 +33,7 @@ services:
depends_on:
- mysql
ports:
- 7777:8080
- :8080
mysql:
image: bitnami/mysql:5.7

View File

@ -8,6 +8,9 @@ if [ ! -d "$PWD/vendor" ]; then
composer install
fi
source "$PWD/.env"
# Do something get environment
chown -R apache:apache /var/www/html
chmod -R 775 /var/www/html

3
docker-exec.cmd Executable file
View File

@ -0,0 +1,3 @@
@echo off
echo "run docker..."
docker exec -it magento2 %*