/UserEntriesTwitter

PHP Jobsity Challenge

Primary LanguagePHP

Build Status Total Downloads Latest Stable Version License

About Laravel

Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:

Laravel is accessible, powerful, and provides tools required for large, robust applications.

UserEntriesTwitter

Create a web app that will have two parts. The first part involves entries (similar to blog posts) from registered users (functionality to view, create, and edit entries). The second part is to be able to see a single user's entries and tweets (from Twitter).

Online Testing server

Application Info

Framework: Laravel 6 + VueJs

Operation System: Debian 9 | Apache 2.4.25 | PHP 7.3.11 | MariaDB (MySQL) 10.1.41

Dependencies: Laravel 6 Dependencies, cURL PHP extension, NodeJS

General Deployment Instructions

  1. Clone the repository:

        $ git clone https://github.com/rmendoza83/UserEntriesTwitter.git user-entries
  2. Move to the new cloned folder:

        $ cd user-entries
  3. Prepare the VueJS frontend code:

        $ npm install
        $ npm run prod
  4. Prepare the Lavarel code:

        $ composer install
        $ cp .env.example .env
  5. Fill the following configuration in your .env file:

  • Configure your MariaDB Connection
        DB_CONNECTION=mysql
        DB_HOST=localhost
        DB_PORT=3306
        DB_DATABASE={YOUR_DESIRED_DBNAME}
        DB_USERNAME={MARIADB_USERNAME}
        DB_PASSWORD={MARIADB_PASSWORD}
  • Configure your Twitter App keys
        TWITTER_CONSUMER_KEY=
        TWITTER_CONSUMER_SECRET=
        TWITTER_ACCESS_TOKEN=
        TWITTER_ACCESS_TOKEN_SECRET=
    For this step you can get this values in the following address developer.twitter.com/en/apps
  1. Create an empty database inside MariaDB:

        $ mysql -u root -p
        $ Enter password: [type your {MARIADB_PASSWORD}]
        MariaBD [()]> CREATE DATABASE {YOUR_DESIRED_DBNAME};
        MariaBD [()]> quit
  2. Configure Laravel Framework to get up the app (Create the Key App, Create the database, and Create Test data)

        $ php artisan key:generate
        $ php artisan migrate
        $ php artisan db:seed
  3. Done. Just navigate to the configurated folder on Apache using a Navigator.

Deployment Instructions (JobSity Specific)

In this case we need to create a new Virtual Host on Apache Environment, the steps are very similar to the General Instructions, but we need to add some steps before:

  1. Create the project directory inside Apache documents folder (In Debian 9 by default: /var/www)

        $ mkdir -p /var/www/jobsitychallenge/reinaldo_mendoza
        $ cd /var/www/jobsitychallenge/reinaldo_mendoza
  2. Clone repository

        $ git clone https://github.com/rmendoza83/UserEntriesTwitter.git .
  3. Create Virtual Host reinaldo-mendoza.jobsitychallenge.com

        $ cd /etc/apache2/sites-available
        $ touch reinaldo-mendoza.jobsitychallenge.com.conf

    Add the following code in the new file reinaldo-mendoza.jobsitychallenge.com.conf created in the previous step:

        <VirtualHost *:80>
            # The ServerName directive sets the request scheme, hostname and port that
            # the server uses to identify itself. This is used when creating
            # redirection URLs. In the context of virtual hosts, the ServerName
            # specifies what hostname must appear in the request's Host: header to
            # match this virtual host. For the default virtual host (this file) this
            # value is not decisive as it is used as a last resort host regardless.
            # However, you must set it for any further virtual host explicitly.
            ServerName reinaldo-mendoza.jobsitychallenge.com
            ServerAlias reinaldo-mendoza.jobsitychallenge.com
            ServerAdmin rmendoza83@gmail.com
            DocumentRoot /var/www/jobsitychallenge/reinaldo_mendoza/public
    
            <Directory /var/www/jobsitychallenge/reinaldo_mendoza/public>
                Options -Indexes +FollowSymLinks
                Allowoverride All
            </Directory>
    
            # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
            # error, crit, alert, emerg.
            # It is also possible to configure the loglevel for particular
            # modules, e.g.
            #LogLevel info ssl:warn
    
            ErrorLog ${APACHE_LOG_DIR}/reinaldo-mendoza.jobsitychallenge.com_error.log
            CustomLog ${APACHE_LOG_DIR}/reinaldo-mendoza.jobsitychallenge.com_access.log combined
        </VirtualHost>
  4. Enable the new site reinaldo-mendoza.jobsitychallenge.com and restart the Apache service:

        $ a2ensite reinaldo-mendoza.jobsitychallenge.com
        $ sudo /etc/init.d/apache2 restart
        $ cd /var/www/jobsitychallenge/reinaldo_mendoza
  5. Now the folders are configurated for Apache Service, from here we can continue from the step 3 specified in General Instructions to get the site working fine.

Contact