Repository of Adventure Lookup, proposed by /u/mattcolville.
To get you up and running quickly, you should use Vagrant and VirtualBox to start up a VM with all the dependencies preinstalled.
After downloading and installing Vagrant and VirtualBox:
# Clone the repo to your local machine (this is readonly; you need to fork if you want write)
git clone [email protected]:AdventureLookup/AdventureLookup.git
cd AdventureLookup
# Create and provision the VM
vagrant up
# Log into the VM
vagrant ssh
Execute the following commands to finish the installation:
# Install PHP dependencies
composer install -n
# Install Frontend dependencies
yarn install
nodejs node_modules/node-sass/scripts/install.js
npm rebuild node-sass --no-bin-links
# Setup database
php bin/console doctrine:migrations:migrate
# Create Elasticsearch index
php bin/console app:elasticsearch:reindex
# Import dummy adventures
php bin/console doctrine:fixtures:load --fixtures src/AppBundle/DataFixtures/ORM/RandomAdventureData.php
php bin/console app:elasticsearch:reindex
If you didn't use Vagrant and use an existing MySQL database, adjust the app/config/parameters.yml
file to match your database credentials.
# Start Symfony development server on port 8000 to run the application
# Must be run inside the virtual machine you used `vagrant ssh` to get into earlier
php bin/console server:start 0.0.0.0
# Start webpack to watch changes to assets and recompile them
# Can be run inside the virtual machine or outside of the virtual machine
npm run dev
The application is now running at http://localhost:8000/app_dev.php. Elasticsearch can be accessed at http://localhost:9200.
Tests use PHPUnit to run. There are two testsuites, one with functional tests and one with browser tests. Functional tests can be executed like so:
php vendor/symfony/phpunit-bridge/bin/simple-phpunit --testsuite functional
Browser tests require PhantomJS as well as the application running in the test environment.
To do that, execute bash tests/start-phantomjs.sh
once before executing the tests. There is not
need to call the script again until you reboot. Then execute the following to run the brow3ser tests:
php vendor/symfony/phpunit-bridge/bin/simple-phpunit --testsuite browser
Install apache2
and libapache2-mod-php7.0
. Create a VHost like this:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/AdventureLookup/web
<Directory /var/www/html/AdventureLookup/web>
AllowOverride All
Order Allow,Deny
Allow from All
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
</IfModule>
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
For more information about server configuration, checkout the Symfony guide on server config.
Also, adjust adjust /etc/apache2/conf-enabled/security.conf
to make Apache production-ready.
Make sure to read the Symfony guide on permissions if you run into permission problems.
Make sure to run mysql_secure_installation
. Adjust port, username, host and password in app/config/parameters.yml
.
- Ubuntu 16.04 as the server
- MySQL 5.7 to store the adventures
- Elasticsearch 5.5 to search the adventures
- PHP7.0 to run the application
- Symfony 3 as the web framework
- Composer as PHP package manager
- Yarn as Frontend package manager
- Webpack for frontend assets