Setup
Installation for Development
- clone the repository:
git clone https://github.com/Dino-Kupinic/Schulbuchaktion.git
Frontend
- go into the frontend directory
cd frontend
- install packages
pnpm i
TIP
If you don't have pnpm installed, checkout https://pnpm.io/installation to install for your operating system.
- define environment variables
Create a .env
file and checkout the .env.example
. Copy the content into your .env
and replace the following fields with your own. You may edit some existing fields aswell.
Field | Description |
---|---|
BACKEND_URL | URL to the Symfony Backend server (e.g. http://localhost:8000/api/v1 in dev) |
Make sure to include the /api/v1
suffix at the end of the URL. This environment variable is used for the Base URL for fetch requests.
- run dev server
pnpm run dev
- Head to
http://localhost:3000/
If it works, great!
WARNING
Following instruction is optional and may be skipped. If you have slow internet, it may take a while to install Chrome, Safari and Firefox (~150 MB)
- Install playwright browsers
npx playwright install
Backend
- go into the backend directory
cd ../backend
or
cd backend
- define environment variables
Create a .env
file and checkout the .env.example
. Copy the content into your .env
and replace the following fields with your own. You may edit some existing fields aswell.
Field | Description |
---|---|
APP_SECRET | A secret key that's used to secure your application's services. |
SECRET_PASSWORD | Database password |
USERNAME | Database user |
BIND_PORT | Database port |
DATABASE_URL | The URL String to your database. It will use the env variables above. |
LDAP_PORT | The port of your LDAP server. |
LDAP_URL | The URL of your LDAP server. |
LDAP_BASE | The base of your LDAP server. (dc=schulbuchaktion,dc=env ) |
ROLES | String of all roles seperated with commas (default 'SBA_ADMIN,SBA_LEHRER,SBA_FV,SBA_AV' ) |
SBA_ADMIN | Group number of the admin group. (default 500 ) |
SBA_LEHRER | Group number of the teacher group. (default 501 ) |
SBA_FV | Group number of the subject responsible group. (default 502 ) |
SBA_AV | Group number of the head of department group. (default 503 ) |
TOKEN_TIMEOUT | How long a token is valid. (default 1800 ) |
HOURS_AHEAD | Timezone (default 2 ) |
JWT_SECRET_ABSOLUT_PATH | The absolute path to the private key for the JWT. |
CORS_ALLOW_ORIGIN | The origin that is allowed to access the API. (default localhost ) |
TOKEN_NAME | Name of Cookie which contains bearer token (default bearer ) |
CADDY_MERCURE_JWT_SECRET | Used to securely sign JWTs for client authentication and authorization in a Caddy server setup with Mercure. |
TRUSTED_PROXIES | Specifies the IP addresses or ranges of proxies that are trusted to correctly set client-related headers in a server configuration. |
TRUSTED_HOSTS | Specifies a list of hostnames or patterns that are considered trusted and allowed to make requests. |
CADDY_MERCURE_URL | Specifies the URL of the Mercure hub used by the Caddy server. |
CADDY_MERCURE_PUBLIC_URL | Specifies the publicly accessible URL of the Mercure hub. |
HTTP_PORT | Port which will be open for http connections. (default 80 ) |
HTTPS_PORT | Port which will be open for https connections. (default 443 ) |
SHELL_VERBOSITY | Verbosity level of server and symfony. (default 0 ) |
DANGER
For the APP_SECRET
checkout https://symfony.com/doc/current/reference/configuration/framework.html#secret to see the latest requirements.
- start docker
docker compose up -d
TIP
If you don't have docker installed, checkout https://www.docker.com/products/docker-desktop/ to install for your operating system.
- install dependencies
composer update
DANGER
If you get errors, you might have to comment out modules like ldap
or zip
in your php.ini
file. Composer will tell you what to do.
- start the dev server
symfony server:start
WARNING
If you don't have symfony cli installed, checkout https://symfony.com/download#step-1-install-symfony-cli to install for your operating system.
- head to
http://127.0.0.1:8000
Docs
- go into the docs directory
cd ../docs
or
cd docs
- install packages
pnpm i
TIP
If you don't have pnpm installed, checkout https://pnpm.io/installation to install for your operating system.
- run dev server
pnpm run docs:dev
- Head to
http://localhost:5173/