Built with Laravel
NOTE: This process currently only supports linux. It uses docker via vagrant so should be possible to run on other platforms with some modifications. Requirements:
- Vagrant ^1.9.1
- Docker
- NodeJS >=6.0
- PHP 5.6 (can be avoided if all relevent commands are run in docker instead)
- Composer
- Make a copy of storage/env/env.example to storage/env/env and adjust as needed. The following values were changed in my setup:
Note: The DB_HOST fields do not need to be if you do not wish to run the tests and artisan commands from the host machine
APP_URL=http://localhost:8001 DB_HOST=172.17.0.1:33306 ENCODE_DB_HOST=172.17.0.1:33306 QUEUE_DRIVER=sync DROPBOX_CLIENT_ID=<REDACTED> DROPBOX_CLIENT_SECRET=<REDACTED> [email protected]
docker run -v "$(pwd):/src" -it julusian/composer:5.6 sh -c "cd /src; composer install"
docker run -v "$(pwd):/src" -it node:6 sh -c "cd /src; npm install"
docker run -v "$(pwd):/src" -it node:6 sh -c "cd /src; npm run dev"
This should be left running as it will recompile any js/css assets as they are changed- copy vagrant-settings.yml.dist to vagrant-settings.yml
- (Optional) Modify vagrant-settings.yml as desired
vagrant up --no-parallel
docker exec -it nasta-submissions-http php artisan migrate
docker exec -it nasta-submissions-http php artisan db:seed
This will populate the database with the stations and the categories for 2017, as well as a test admin and judge user account. Additional users must be created directly in the database, except for judges who have an artisan command. If these defaults want to be modified, they are located under database/seeds.- (Optional)
docker exec -it nasta-submissions-http php artisan db:seed --class=FakeEntriesSeeder
This will create some fake entries from some stations. Useful for working on pages which need lots of submission data. This data may be incomplete, so it is advised to follow the upload process to get some real data for some pages docker exec -it nasta-submissions-http php artisan key:generate
- Submissions system: http://localhost:8001
- PHPMyAdmin: http://localhost:8002
- Mailhog (catchall email): http://localhost:8013
- test_admin: test123
- test_judge: test123
- Station credentials can be set by following the forgot password process, and viewing the email via mailhog
Unit tests can be run with docker exec -it nasta-submissions-http vendor/bin/phpunit
These include tests of scraping the dropbox api for file informations so require dropbox secrets to be defined in the env file. For this reason, it is recommended that the env file uses a throwaway account.
For 2017, this repo was setup to use ci powered by gitlab. This would build the docker images, run the unit tests and then deploy the images to a kubernetes cluster running on google cloud. (The file download was run on a secondary cluster, local to the target storage)
This will either need converting to ci scripts for another ci service, or they can be used as a reference for manual deployment.
WARNING: This will cause dropbox to send an email per folder created. When run in 2017, it took 20 minutes for gmail to receive all ~1200 emails. Be careful of what email provider you use, it could trigger spam detection rules.
The dropbox api does not currently support creating file requests. To work around this, there is a job to generate them in bulk which should be run before submissions open.
To do so, the following process is needed:
- Ensure each station has a dropbox_account_id set, that is part of one of the accounts to be used, and that all categories exist.
- Run
php artisan create-file-requests
- When prompted, supply the authentication tokens. These can be retrieved from one of the many requests shown in the chrome dev tools when using the dropbox web client.
- If an error is encountered, you may be prompted for tokens again, and you may need to rerun the command to ensure that no folder was skipped.
To allow users to login for the first time, it is possible to send welcome emails to users.
This can be done with the following command php artisan email:welcome station
. station can be replaced with judge or admin.
Upon running the command, you can choose whether to send the email to all users of the type, or only to those who do not yet have a password.