Evaluation Project for Hackathons
Follow these steps to set up the project on your local machine.
Ensure you have git and docker (including the Docker Compose plugin) installed.
git clone git@github.com:ownHackathon/hackathon-api.git
cd hackathon-apiCopy the environment template and adjust it:
cp .env.dist .envOpen the .env file and set your USERMAP_UID and USERMAP_GID. This ensures correct file permissions within the container. You can find your IDs by running:
id -u && id -gCheck the configuration files in config/autoload/. If changes are needed, copy the desired .dist file, remove the extension, and adjust the settings.
We provide a management script to automate the entire process (infrastructure start, dependency installation, database migrations, and documentation generation).
Once finished, the script automatically displays a table with all service URLs, ports, and database credentials.
Caution
NOTE: This script is provided as-is and unsupported. Use it at your own risk.
# Make the script executable
chmod +x bin/hackathon
# Run the automated setup
./bin/hackathon setupAlternatively, you can run the commands manually:
Show manual steps
docker-compose up -d
docker-compose exec php composer install
docker-compose exec php composer run doctrine migrations:sync-metadata-storage
docker-compose exec php composer run doctrine migrations:migrate
docker-compose exec php composer run openapiThe management script consolidates all essential developer commands into a single tool.
Run the script from the project root directory:
./bin/hackathon [COMMAND]start: Starts the containers. Note: It checks for initialization (vendor/ and volumes) and prevents start if the project isn't set up.stop/down: Pauses containers or stops/removes containers and networks.setup: Complete initial setup (Start, Install, Migrate, OpenAPI, Info).services: Lists all available service names used in this project.logs [svc]: Tails logs for all or a specific service (e.g.,./bin/hackathon logs php).info: Displays connectivity info (URLs, Ports, and DB Credentials) for running services.openapi: Regenerates the API documentation.
clean {docker|app|all}:docker: Removes containers, volumes, and all project images.app: Removesvendor/and all cache files (.phplint,.phpunit, etc.).all: Performs both docker and app cleanup.
reset {database|vendor|all}:database: Wipes database volumes and re-runs migrations.vendor: Wipes and reinstalls thevendor/folder (Database remains untouched).all: Wipes database, vendor, and all caches, followed by a freshsetup.
composer [...]: Run Composer commands in the PHP container.php [...]: Run PHP commands in the PHP container.test [...]: Shortcut to run PHPUnit tests (passes arguments to PHPUnit).bash: Direct interactive shell access to the PHP container.mysql: Direct access to the MariaDB database console.indocker [service] [command]: Access any specific container (php,apache,database,database-testing,mailhog).
You can create an alias in your .bashrc or .zshrc to work even faster:
alias h='./bin/hackathon' -> Then simply use h setup, h info, h bash or h test.