Symfony Cli - butvin/galera GitHub Wiki

Symfony Cli.

Download & install Symfony Cli:

wget https://get.symfony.com/cli/installer -O - | bash

Globally:

sudo mv $HOME/.symfony/bin/symfony /usr/local/bin/symfony

Build command:

symfony new <PROJECT_NAME> --full
symfony new <PROJECT_NAME> --version=4.4

If appeares error: "no PHP binaries detected", try to run this: symfony local:php:refresh

Composer (without Symfony CLI):

composer create-project symfony/website-skeleton <PROJECT_NAME>
composer create-project symfony/website-skeleton:"^4.4" <PROJECT_NAME>

Starting local (Symfony cli) server: symfony server:start

REMOVE & INSTALL

Disable dockers services:

sudo systemctl show docker.service
sudo systemctl stop docker.service 
sudo systemctl disable docker.service

Overviews service:

sudo service docker status


Uninstall the Docker Engine, CLI, and Containerd packages:

sudo apt-get remove docker docker-engine docker.io containerd runc
sudo apt-get purge docker-ce docker-ce-cli containerd.io

Images, containers, volumes, or customized configuration files on your host are not automatically removed. To delete all images, containers, and volumes:

sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

Update the apt package index and install packages to allow apt to use a repository over HTTPS:

sudo apt-get update && \
sudo apt-get install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    wget \
    gnupg \
    lsb-release

//info: cgroupfs-mount docker-ce-rootless-extras docker-scan-plugin pigz slirp4netns

Add Docker’s official GPG key:

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

echo \
	"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
	$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null


sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io

Permissions. To create the docker group and add your user:

sudo groupadd docker

sudo usermod -aG docker $USER

newgrp docker 

sudo chown "$USER":"$USER" /home/"$USER"/.docker -R
sudo chmod g+rwx "$HOME/.docker" -R

sudo systemctl enable docker.service
sudo systemctl enable containerd.service

Configure services:

sudo systemctl edit docker.service

Reload the systemctl configuration.

sudo systemctl daemon-reload

Restart Docker.

sudo systemctl restart docker.service

Checking:

sudo netstat -lntp | grep dockerd

Remote access with daemon.json Set the hosts array in the /etc/docker/daemon.json to connect to the UNIX socket and an IP address, as follows:

sudo nano /etc/docker/daemon.json

{
  "hosts": ["unix:///var/run/docker.sock", "tcp://127.0.0.1:2375"]
}

Re & Check


Configure checking docker daemon:

curl https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh > check-config.sh

bash ./check-config.sh

Re & Check

Configure chrcking docker daemon:

curl https://raw.githubusercontent.com/docker/docker/master/contrib/check-config.sh > check-config.sh

bash ./check-config.sh

Add dns

sudo nano /etc/docker/daemon.json

{
  "dns": ["8.8.8.8", "8.8.4.4"]
}


ps aux |grep dnsmasq

If you prefer not to change the Docker daemon’s configuration to use a specific IP address, follow these instructions to disable dnsmasq in NetworkManager. Edit the /etc/NetworkManager/NetworkManager.conf file. Comment out the dns=dnsmasq line by adding a # character to the beginning of the line #dns=dnsmasq Save and close the file.

Restart both NetworkManager and Docker. As an alternative, you can reboot your system.

sudo systemctl restart network-manager
sudo systemctl restart docker	


sudo update-grub

INFO






BEGINNING

START

Inside container:

composer require logger
composer require twig
composer require annotations
composer require symfony/orm-pack
composer require --dev symfony/maker-bundle

php bin/console doctrine:database:create
php bin/console fos:user:create dev [email protected] devdev --super-admin
php bin/console about

Outside container:

docker exec -t php-fpm bash -c 'php bin/console fos:user:create dev [email protected] devdev --super-admin'

Show report [Symfony Security Check Report]: symfony check:security


Example:

Creating random symfony project:

symfony new <PROJECT_NAME> --demo

Required packages:

TODO:...

php bin/console doctrine:migrations:list
php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate
----------------------------------------------------
php bin/console make:entity --regenerate --overwrite
If you make some changes and want to regenerate all getter/setter methods, also pass --overwrite.
----------------------------------------------------
php bin/console doctrine:query:sql "SELECT * FROM user"
send manual\custom sql query 
----------------------------------------------------
composer require doctrine/annotations symfony/validator
composer require symfony/webpack-encore-bundle

[PERMISSION]

HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\  -f1)

sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var

sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX var 

Create user 'dev'

docker exec -t php-fpm bash -c 'php bin/console fos:user:create dev [email protected] devdev --super-admin'

run.sh


#!bin/bash

#Symfony 4.4 LTS file permissions

HTTP_USER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1)

sudo -S setfacl -dR -m u:"$HTTP_USER":rwX -m u:"$(whoami)":rwX var

sudo -S setfacl -R -m u:"$HTTP_USER":rwX -m u:"$(whoami)":rwX var


DIGGING DEEPER

TODO: ...

⚠️ **GitHub.com Fallback** ⚠️