Based on Symfony 5 + Webpack
Requirements:
- PHP 8
- MySQL or MariaDB
- Node with NPM (to build the frontend assets)
For ubuntu find below, you need the php-cli & php-mysql add-ins
sudo apt install php libapache2-mod-php
sudo apt install php-cli
sudo apt install php-mysql
Composer is the PHP package manager. Install it first and then run
composer install
We use Node and NPM to install frontend dependencies. You can install both from here and then run
npm install
npm run build
Once you have a MySQL instance running, you can connect to it with sudo mysql
and:
CREATE USER 'thot'@'localhost' IDENTIFIED BY 'thot';
CREATE DATABASE thot;
GRANT ALL PRIVILEGES ON thot.* TO 'thot'@'localhost';
This will create a user thot
with password thot
and a database named thot
.
You can then change the MySQL connection line with theses credentials in the .env.local
file that you must create at the root of the folder, for instance:
DATABASE_URL=mysql://thot:[email protected]:3306/thot
After you have done that, you can create the schema running into a terminal:
bin/console doctrine:schema:update --force
And then run the fixtures; for instance, you can connect on your local mysql instance and run the fixtures (in fixtures.sql) with:
sudo mysql -D thot < fixtures/fixtures.sql
Just run
php -S localhost:8000 -t public
You can then go to http://localhost:8000 to interact with the frontend
The admin is at http://localhost:8000/admin/ and the login/password is: admin
/ changeMe
(if you haven't changed it in your .env.local
file)
To deploy on the remote server (thot-fle.fr), we use Deployer.
Create a deploy/servers.yml
file with the necessary content.
Example:
production:
hostname: XX.YY.ZZ.WW
user: debian
forward_agent: ~
stage: production
deploy_path: "/var/www/thot-fle.fr"
branch: master
And then run
./vendor/bin/dep deploy
It should yield the following log if everything runs smoothly:
❯ ./vendor/bin/dep deploy
✈︎ Deploying master on thot-fle.fr
✔ Executing task deploy:prepare
✔ Executing task deploy:lock
✔ Executing task deploy:release
✔ Executing task deploy:update_code
✔ Executing task deploy:build_assets
✔ Executing task deploy:shared
✔ Executing task deploy:vendors
✔ Executing task deploy:writable
✔ Executing task deploy:cache:clear
✔ Executing task deploy:cache:warmup
✔ Executing task deploy:symlink
✔ Executing task folder:rights
✔ Executing task php-fpm:restart
✔ Executing task deploy:unlock
✔ Executing task cleanup
Successfully deployed!
To extract translations from templates :
bin/console translation:update --output-format xlf --xliff-version=2.0 fr --force
bin/console translation:update --output-format xlf --xliff-version=2.0 en --force
bin/console translation:update --output-format xlf --xliff-version=2.0 fa --force
bin/console translation:update --output-format xlf --xliff-version=2.0 ps --force
bin/console translation:update --output-format xlf --xliff-version=2.0 ar --force