# magento-test

#Installation:

# Some important information

# Some helpful docker commands:

# Build all containers
- `docker-compose up -d`

# Stop all containers
- `docker-compose down`

# Remove image
- `docker image rm php_apache`

# Stop containers, remove image and recreation of container
- `docker-compose down && docker image rm php_apache && docker-compose up -d`

# Get into container
- `docker exec -it php-apache /bin/bash`


- `docker build -t magento-php .`
- `docker image rm magento_php`
- `docker ps`
- `docker ps --all`
- `docker container stop $(docker container ls -aq)`
- `docker container rm $(docker container ls -aq)`
- `docker rmi $(docker images -q)`
- `docker stop spt_tbuddy && docker rm spt_tbuddy && docker rmi spt_tb && docker-compose up -d`
- `docker stop magento-test && docker rm magento-test && docker rmi spt_tb && docker-compose up -d`

# Some helpful other commands:
- Restart Apache within the container
  - Go into docker container `docker exec -it magento-php /bin/bash`
  - Apache restart `sudo /etc/init.d/apache2 reload`

# Clean restart of Docker instance
1.  Stop the container(s) using the following command: `docker-compose down`
2.  Delete all containers using the following command: `docker rm -f $(docker ps -a -q)`
3.  Delete all volumes using the following command: `docker volume rm $(docker volume ls -q)`
4.  Restart the containers using the following command: `docker-compose up -d`


# INSTALL MAGENTO via composer
- docker Container starten und in den Container wechseln
- composer install
- "bin/magento install" Befehl:
  php bin/magento setup:install --base-url="http://127.0.0.1" \
  --db-host="mariadb" \
  --db-name="magento" \
  --db-user="root" \
  --db-password="root" \
  --admin-firstname="Admin" \
  --admin-lastname="Admin" \
  --admin-email="re@spawntree.de" \
  --admin-user="admin" \
  --admin-password="magento2test" \
  --use-rewrites="1" \
  --backend-frontname="admin" \
  --db-prefix="" \
  --search-engine=elasticsearch7 \
  --elasticsearch-host=elasticsearch \
  --elasticsearch-port=9200

# create admin account
bin/magento admin:user:create --admin-user=admin --admin-password=admin2spt --admin-email=re@spawntree.de --admin-firstname=Admin --admin-lastname=Administrator

# mkdir for volumes
mkdir -m 775 elasticsearch_data magento_data mariadb_data
mkdir .elasticsearch .mariadb

# standard permission magento - do we use it?
find . -type d -exec chmod 0711 {} +
find . -type f -exec chmod 0644 {} +
find . -type f -name “*.php” -exec chmod 600 {} +


*********************

- Auschecken

- Datenbank importieren und importieren (localhost, 3306, root => Database: magento)

- Files in src ziehen
  - ohne .git und .ddev
  - env.php aus app/etc löschen

- cd .docker
  - docker-compose up -d

- In den Container wechseln: docker exec -it php-apache /bin/bash
  - 3 Passwörter eingeben

- Filepermissions setzen:
  find . -type d -exec chmod 0711 {} +
  find . -type f -exec chmod 0644 {} +
  find . -type f -name “*.php” -exec chmod 600 {} +

- Magento install Script

- SSL Basic Server in core_config_data (Datenbank) anpassen auf localhost

- php bin/magento cache:clean
- php bin/magento cache:flush

- php bin/magento setup:static-content:deploy -f



