Skip to content

Latest commit

 

History

History
233 lines (208 loc) · 7.98 KB

installation.md

File metadata and controls

233 lines (208 loc) · 7.98 KB

Installation Guidelines 🚀

Before you start following the guidelines, make sure to go through the prerequisites guide to install the required tools and packages on your machine.

  1. Navigate to the right diretory where your project will be locally saved

    • For WAMP:
      cd C:\wamp64\www\
    • For XAMPP:
      cd C:\xampp\htdocs\
    • For MAMP(macOS):
      cd /Application/MAMP/htdocs/
  2. Clone this repository and move to portal directory

    git clone https://github.com/coloredcow/portal
    cd portal
  3. Install dependencies

    composer install
    npm install
  4. npm build

    npm run dev

    A possible error may arise with cross-env. So try running the following commands.

    • To clear a cache in npm, we need to run the npm cache command in our terminal and install cross-env.
    npm cache clear --force
    npm install cross-env
    
    npm install
    npm run dev
  5. Make a copy of the .env.example file in the same directory and save it as .env:

    cp .env.example .env
  6. Run the following command to add the Laravel application key:

    php artisan key:generate

    Note: Make sure that the 'php.ini' file in XAMPP/WAMP has this code uncommented/written extension=gd

  7. Add the following settings in .env file:

    1. Laravel app configurations
    APP_NAME="ColoredCow Portal"
    APP_ENV=local
    APP_DEBUG=true
    APP_URL=http://portal.test
    1. Database configurations
    • Create a database in your local server. Check out this link and skip to 0:21.
    • Configure your Laravel app with the right DB settings. Check out this link. Relevant parts are 2:00-2:42 and 4:20-5:40.
    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=portal
    DB_USERNAME=root
    DB_PASSWORD=

    Note: Use the default values for MySQL database in .env file

    DB_USERNAME=root
    DB_PASSWORD=
    
    1. (Optional) Google configurations.
    GOOGLE_CLIENT_ID=
    GOOGLE_CLIENT_SECRET=
    GOOGLE_CLIENT_CALLBACK=
    GOOGLE_CLIENT_HD=
    GOOGLE_API_KEY=
    GOOGLE_APPLICATION_CREDENTIALS=
    GOOGLE_SERVICE_ACCOUNT_IMPERSONATE=
    1. (Optional) ColoredCow website Configurations In case you want to use website integration functionality, then you need to enable WORDPRESS_ENABLED as true and add wordpress database configurations.
    DB_WORDPRESS_DATABASE=
    DB_WORDPRESS_USERNAME=
    DB_WORDPRESS_PASSWORD=
    DB_WORDPRESS_PREFIX=
    WORDPRESS_ENABLED=true
  8. Run migrations

    php artisan migrate
  9. Run seeders

    1. Portal
      php artisan db:seed
      (Optional) In case you want to run a specific seeder class, use the --class option:
      php artisan db:seed --class=CLASSNAME
    2. Module:
      php artisan module:seed
      (Optional) In case you want to run seeders inside a specific module, run:
      php artisan module:seed MODULE_NAME
  10. Setup Virtual Host

    1. For WAMP:

      • Go to C:\WINDOWS\system32\drivers\etc\ and open the hosts (not the one with ICS extension) file in notepad (run as administrator). Add the following line at the end:
        127.0.0.1      portal.test
        
      • Go to C:\wamp64\bin\apache\apache2.4.46\conf\extra\httpd-vhosts.conf and add the following code snippet at the end of the file. Copy the absolute file path for the public directory of the project and paste it below where your_project_path is written. For example, your project path may look like C:\wamp64\www\portal\public.
        <VirtualHost *:80>
            ServerName portal.test
            DocumentRoot "/path/to/your/project"
            <Directory "/path/to/your/project">
                DirectoryIndex index.php
                AllowOverride All
                Order allow,deny
                Allow from all
            </Directory>
        </VirtualHost>
      • Restart WAMP. Next, open this url in your browser: http://portal.test
    2. For XAMPP:

      • Go to C:\WINDOWS\system32\drivers\etc\ and open the hosts (not the one with ICS extension) file in notepad (run as administrator). Add the following line at the end:

        127.0.0.1      portal.test
        
      • Go to C:\xampp\apache\conf\extra\httpd-vhosts.conf and add the following code snippet at the end of the file. Copy the absolute file path for the public directory of the project and paste it below where your_project_path is written. For example, your project path may look like C:\xampp\htdocs\portal\public.

        <VirtualHost *:80>
            ServerName portal.test
            DocumentRoot "/path/to/your/project"
            <Directory "/path/to/your/project">
                DirectoryIndex index.php
                AllowOverride All
                Order allow,deny
                Allow from all
            </Directory>
        </VirtualHost>
      • Restart XAMPP. Next, open this url in your browser: http://portal.test

    3. For MAMP(macOS):

      • Go to etc/hosts file or edit this in the terminal use the following command.

        sudo nano /etc/hosts
      • Add this line

        127.0.0.1   portal.test
        
      • Go to httpd.conf file or edit this file in the terminal itself use this command

        sudo nano /etc/apache2/httpd.conf

        And search for vhosts and uncomment line like this

        # Virtual hosts
        # Include /private/etc/apache2/extra/httpd-vhosts.conf

        Change above to:

        # Virtual hosts
        Include /private/etc/apache2/extra/httpd-vhosts.conf
        • Open the vhost file in the terminal

          sudo nano /etc/apache2/extra/httpd-vhosts.conf

          Add the following line at the end of the file: Copy the absolute file path for the public directory of the project and paste it below where your_project_path is written. For example, your project path may look like /Application/MAMP/htdocs/portal/public.

           <VirtualHost *:80>
               ServerName portal.test
               DocumentRoot "/path/to/your/project"
               <Directory "/path/to/your/project">
                   DirectoryIndex index.php
                   AllowOverride All
                   Order allow,deny
                   Allow from all
               </Directory>
           </VirtualHost>
        • In case you are using Apache version 2.4 or above, the above code will give you a 403 Forbidden error. Make the following changes:

          <Directory>
              # some code above
              Order allow,deny
              Allow from all
          </Directory>

          Change to:

          <Directory>
               # some code above
               Require all granted
          </Directory>
        • Restart MAMP. Next, open this url in your browser: http://portal.test

  11. Login to the portal using the newly created user in the database. Go to http://localhost/phpmyadmin/index.php and search for the users table and you can find the user email in it. The default password to log in is 12345678.