Code Monkey home page Code Monkey logo

adventurelookup's Introduction

Adventure Lookup

Repository of Adventure Lookup, proposed by /u/mattcolville.

Setting up a development environment

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.

Running the application

# 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.

Running tests

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

Running the application in production

Apache configuration

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.

Permissions

Make sure to read the Symfony guide on permissions if you run into permission problems.

MySQL

Make sure to run mysql_secure_installation. Adjust port, username, host and password in app/config/parameters.yml.

Tools used

  • 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

adventurelookup's People

Contributors

cmfcmf avatar burnhamrobertp avatar johnnyflash avatar jsaugustyn avatar

Watchers

James Cloos avatar Tristan Adams avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.