baldeweg Desk contains services like letter.
- doc https://github.com/abaldeweg/desk_docu - Documentation
- docker https://github.com/abaldeweg/desk_docker - Docker Example
- core https://github.com/abaldeweg/desk_core - Backend
- letter https://github.com/abaldeweg/desk_letter - UI for letter
- PHP 8.1
- PHP Composer
- NodeJS 14LTS
- Yarn
- MySQL
- SSH Access
Installation with Docker is the preferred way!
Clone the examples repo from git@github.com:abaldeweg/desk_docker.git
.
Change into the new created directory, create a .env
file and define/change the env vars - particularly the passwords.
//.env
COMPOSE_PROJECT_NAME=desk
PORT_CORE=9011
PORT_LETTER=9012
DATABASE_SERVER=db
DATABASE_PORT=3306
DATABASE_NAME=desk
DATABASE_USER=admin
DATABASE_PASSWORD=password
DATABASE_ROOT_PASSWORD=password
APP_ENV=prod
APP_SECRET=secret
JWT_PASSPHRASE=passphrase
CORS_ALLOW_ORIGIN='^https?://(localhost|DOMAIN)(:[0-9]+)?$'
VUE_APP_API='DOMAIN'
Run ./setup
to start the container.
Run ./setup
to update the container.
docker exec ID sh -c 'exec mysqldump $MYSQL_DATABASE -uroot -p"$MYSQL_ROOT_PASSWORD"' > dump.sql
docker exec -i ID sh -c 'exec mysql $MYSQL_DATABASE -uroot -p"$MYSQL_ROOT_PASSWORD"' < dump.sql
This is only needed if you do not want to install it with Docker.
Clone the repository.
git clone https://github.com/abaldeweg/desk_core.git
Change into the created directory.
Create the file .env.local
and .env.test.local
with the following content. Please fit it to your needs.
DATABASE_URL=mysql://DB_USER:DB_PASSWORD@localhost:3306/DB_NAME
Then install the composer dependencies and create the database.
In prod
run the following command.
composer install
composer dump-env prod
bin/console doctrine:database:create --if-not-exists
bin/console doctrine:migrations:migrate -n
If you are in dev
run the following commands.
composer install
bin/console doctrine:database:create --if-not-exists
bin/console doctrine:migrations:migrate -n
bin/console doctrine:fixtures:load -n
The fixtures will create an account admin
with password password
. This is only for development, you should not use the fixtures in production!
In production you can run bin/console user:new [USERNAME] [ROLE]
. The first user should have the role ROLE_ADMIN
for others use ROLE_USER
or just omit the role.
To authenticate your users, you need to generate the SSL keys under config/jwt/
.
bin/console lexik:jwt:generate-keypair
Point the web root to the public
dir.
You also need this header for apache.
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
More info on that: https://github.com/lexik/LexikJWTAuthenticationBundle/blob/master/Resources/doc/index.md#important-note-for-apache-users
Configure your webserver to redirect all requests to the index.php
file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]
RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule>
Download the files from the repository.
git clone https://github.com/abaldeweg/desk_letter.git
Change into the created directory.
Create the file .env.local
and overwrite env vars from .env
, if needed.
Start the build process.
yarn build
The files in dest/
should be located in your web root.
Configure your webserver to redirect all requests to the index.html
file.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
Change into the corresponding directory. Check out the latest version from git. Then, just call the following commands, if you are updating the production environment.
git checkout tags/[VERSION]
composer install
composer dump-env prod
bin/console doctrine:migrations:migrate -n
Change into the corresponding directory. Then, run the following commands.
git checkout tags/[VERSION]
yarn build
- APP_ENV - Environment, like
prod
,dev
ortest
- APP_SECRET - A secret key
- DATABASE_SERVER - Domain to the db server
- DATABASE_PORT - Port of the db server
- DATABASE_URL - Schema with credentials e.g.
mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=8.0
- DATABASE_NAME - Name of the db
- DATABASE_USER - Username for the db
- DATABASE_PASSWORD - Password of the db
- DATABASE_ROOT_PASSWORD - The root password of the MySQL Server
- JWT_PASSPHRASE - Password for the JWT key files
- CORS_ALLOW_ORIGIN - Defines from which domains requests are allowed (CORS on Browsers)
- VUE_APP_API - URL to the backend
- VUE_APP_BASE_URL - The Base URL, in case the app is installed in a subdir.
- PORT_CORE - Port for core
- PORT_LETTER - Port for letter
- PROXY_DOMAIN - Service name of the php-fpm instance
All Code needs to be checked. For that Linter, CI-Tools, Unit-Tests and E2E-Tests should be in place. Security Alerts for dependencies should be active and Best Practices for coding needs to be followed. As frameworks were chosen Symfony and VueJS because of their free licenses and wide spread. The resulting code should also be released under a free license.