added db stuff

This commit is contained in:
Nick Yeoman 2022-11-15 18:33:37 -08:00
parent 9ec819e91a
commit 65cd502066

View File

@ -55,7 +55,8 @@ echo "Creating scaffolding Twig templates in views directory"
composer require twig composer require twig
composer require nickyeoman/nytwig composer require nickyeoman/nytwig
mv config/packages/twig.yaml config/packages/twig.yaml.bak mv config/packages/twig.yaml config/packages/twig.yaml.bak
wget https://git.gopo.li/nick/symfony/raw/branch/main/twig.yaml config/packages/twig.yaml wget https://git.gopo.li/nick/symfony/raw/branch/main/twig/twig.yaml
mv twig.yaml config/packages/twig.yaml
echo "Your twig.yaml config file has been replaced, remove the bak if you are happy." echo "Your twig.yaml config file has been replaced, remove the bak if you are happy."
################################################################################ ################################################################################
@ -69,12 +70,17 @@ echo '@import ../vendor/nickyeoman/sasslibrary/master.sass' > sass/$1.sass
echo "SASS installed you still need to run sass sass/$1.sass public/css/main.css" echo "SASS installed you still need to run sass sass/$1.sass public/css/main.css"
################################################################################ ################################################################################
# Symfony components # Symfony bundles
################################################################################ ################################################################################
composer require symfony/process composer req symfony/process
composer require asset composer req asset
composer require annotations composer req annotations
# Dev components
composer req --dev maker
composer req --dev profiler
composer req debug logger
################################################################################ ################################################################################
# Docker # Docker
@ -87,25 +93,41 @@ echo 'DOCKERNAME=symfony' >> .env
echo 'DOCKERIMAGE=YOUR_NAME/YOUR_IMAGE_NAME' >> .env echo 'DOCKERIMAGE=YOUR_NAME/YOUR_IMAGE_NAME' >> .env
echo 'DOCKERVER=latest' >> .env echo 'DOCKERVER=latest' >> .env
echo 'DOCKERNET=DOCKER_NETWORK_NAME_FOR_PROXY' >> .env echo 'DOCKERNET=DOCKER_NETWORK_NAME_FOR_PROXY' >> .env
echo 'DBHOST=mariadb' >> .env echo "DOCKERPORT=8000" >> .env
GEN=`echo $RANDOM | md5sum | head -c 12` GEN=`echo $RANDOM | md5sum | head -c 12`
echo "MYSQL_ROOT_PASSWORD=${GEN}" >> .env echo "MYSQL_ROOT_PASSWORD=${GEN}" >> .env
echo '# Database info, should match your db url' >> .env
echo 'DBHOST=mariadb' >> .env
echo 'DB=symfony_project' >> .env
GEN=`echo $RANDOM | md5sum | head -c 4`
echo "DBUSER=theuser${GEN}" >> .env
GEN=`echo $RANDOM | md5sum | head -c 12` GEN=`echo $RANDOM | md5sum | head -c 12`
echo "DBPASSWORD=${GEN}" >> .env echo "DBPASSWORD=${GEN}" >> .env
echo 'MYSQL_DATABASE=theapp' >> .env
GEN=`echo $RANDOM | md5sum | head -c 4`
echo "MYSQL_DATABASE=theuser${GEN}" >> .env
# TODO: move these here after you have symfony production ready
echo "Creating a docker-compose" echo "Creating a docker-compose"
wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/docker-compose.yml wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/docker-compose.yml
echo "Creating a Dockerfile" echo "Creating a Dockerfile"
wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/Dockerfile wget https://raw.githubusercontent.com/nickyeoman/phpframework/main/docker/Dockerfile
################################################################################
# Database
################################################################################
composer req -n orm && sleep 1
# TODO: In the future you may want to replace this with code
# ( but not here if you are sharing the script)
# sed -n -e '/^DATABASE_URL/p' .env
################################################################################ ################################################################################
# Instructions # Instructions
################################################################################ ################################################################################
php bin/console --version
echo "Symfony Installed" echo "Symfony Installed"
echo "sudo docker-compose up -d" echo "sudo docker-compose up -d"
echo "For more, go to: https://www.nickyeoman.com" echo "For more, go to: https://www.nickyeoman.com"