5/5

Documentation

Follow this simple to use documentation to get Sourcecode Pro setup on your system. If you have any questions regarding this documentation or in using Sourcecode Pro then please get in touch.

System Requirements

Installation of Sourcecode Pro may vary from server to server. I personally use Laravel Forge. While Sourcecode Pro is not intended to be installed on Shared Hosting, it is still possible to do so. I recommend using better cloud based hosting such as Digital Ocean and Laravel forge for a seamless integration and installation.

Installation

Sourcecode Pro is built on Laravel 8 and the installation system is same as Laravel. See Laravel Installation Guide

Sourcecode Pro utilises Composer to manage its dependencies. So, before using Sourcecode Pro, make sure you have Composer installed on your server. To check you have composer run composer --version  on your servers terminal.

If you do not have composer installed then run sudo apt install -y composer to install composer.

1. Upload Files onto your server.

Upload/Unzip the contents of the Sourcecode Pro Package to web root folder of your domain. It’s most likely located in htmlwww or public_html folder name. 

2. Configure your web root folder

Configure your web server’s document root to point to the public directory of the files you previously uploaded. For example, if you’ve uploaded the files in html folder, your domain root directory should be changed to html/project_files/public folder or anything else where domain root is in project /public directory. Wherever your domain points to this has to be where the public folder sits.

3. Run Installation Script

In your browser visit your domain URL and you should be welcomed by the Sourcecode Pro Installer Screen.

4.Directory Permissions

After composer install, you may need to give some directory permissions.

chmod -R 775 bootstrap

chmod -R 775 storage

Web Installer Setup

1. System Requirements Check.

The installer will automatically check your system to ensure it meets all requirements. if it does you will see the followingscreen:

2. Folder Permissions Check.

The installer will now check to ensure certain directories have the correct permissions. If you have set this up hit next and you should see the following screen:

3. Environment Settings

Now we can edit the Environment File which contains all the important variables that are used within the Sourcecode Pro Application.

Click the blue button to open the Environment Editor File, you will then see the following screen where you can edit and Save the environment file before continuing.

In the white text editor are in the center, we are going to update some values one row at a time:

 

APP_NAME=Laravel   Add your Application Name
APP_ENV=local   local or production
APP_KEY=base64:/bEorRZ2eb+I/UrAR6Y11WLaOFqZD8sw3NjqIcPATK0=
APP_DEBUG=true   true or false for debug
APP_URL=http://localhost   your web url

LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=localhost   your database host
DB_PORT=3306   your database port
DB_DATABASE=laravel   your database name
DB_USERNAME=root   your database username
DB_PASSWORD=   your database password

BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file

SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_MAILER=smtp MAIL_HOST=smtp.mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null MAIL_FROM_ADDRESS=null MAIL_FROM_NAME="${APP_NAME}"AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

CASHIER_MODEL=App\Models\User
CASHIER_CURRENCY=usd
STRIPE_KEY=your-stripe-key   your stripe key
STRIPE_SECRET=your-stripe-secret   your stripe secret
STRIPE_WEBHOOK_SECRET=stripe-webhook-secret   your stripe webhook secret (get this by completing the webhooks section)

CASHIER_PAYMENT_NOTIFICATION=Laravel\Cashier\Notifications\ConfirmPayment

Manual Setup

Manually setup the system using SSH into your server or using terminal on your localhost.

GENERATE APPLICATION KEY

Set your application key to a random string. Typically, this string should be 32 characters long. If the application key is not set, your user sessions and other encrypted data will not be secure! Follow the command below to generate the key

php artisan key:generate

Open .env file via your favorite text editor and configure it. Use the ENV layout in the last step as reference.

DATABASE MIGRATION

To make your mysql database ready you need to run following command. Before run this command make sure you have create the database and set it name in the .env file

php artisan migrate
INSTALL INITIAL DATA

To push initial data in database, run the following command.

php artisan db:seed
Note: The website won't run without initial data.

To refresh the initial data in database after changing the seeders, run the following command (do not do it once you go live)

php artisan migrate:fresh --seed

To make them accessible from the web, you should create a symbolic link from public/storage to storage/app/public.

To create the symbolic link, you may use the storage:link command.

php artisan storage:link

Remove Dev Dependencies

To remove Sourcecode PRo dev dependencies run the following command. This will remove all packages that are not necessary in production.

composer install --optimize-autoloader --no-dev

Installing JavaScript Dependencies (Optional)

NPM offers an option which allows to only install app dependencies required for production environment. Use one of the following commands to skip the devDependencies in your package.json

npm install --production

Run the following command to build and minify the JavaScript files.

npm run production

Stripe Endpoints

To ensure your Sourcecode Pro software can handle Stripe webhooks, be sure to configure the webhook URL in the Stripe control Panel.

By default, Sourcecode Pro software webhook controller listens to the /stripe/webhook URL path.

https://yoursite.com/stripe/webhook

Configure web hooks in Stripe

In your Stripe Account,

  • Click on the Developers link in the left side menu.
  • Select Webhooks
  • Now click ‘Add Endpoint’ button.
 
 

Endpoint URL

https://yoursite.com/stripe/webhook

Your endpoint URL is where Stripe will be able to talk to your application. Put the full root url of your website and then add the /stripe/webhook at the end.

Also make sure you have an SSL Certificate active on your domain.

Description

Give a description to your webhook. For example, My Application Subscription Endpoints.

Events To Send

You need to tell Stripe which web hooks to listen to within our system. we do this by adding all the web hooks we want Stripe to listen to into our new web hook.

  • Click ‘Select Events’ and copy and paste each of the events below (1 at a time).
  • find the event in the list and choose it.
  • Then copy the next webhook below, clear the search and paste the next one, choose it

and so on.

The full list of all webhooks you should search for in the Stripe control panel are:

  • customer.subscription.updated
  • customer.subscription.deleted
  • customer.updated
  • customer.deleted
  • invoice.payment_action_required
 

Save your webhook. That’s it.

Now Stripe is configured to listen to and be in sync with subscription events in your Sourcecode Pro Software.

Webhook Signatures

To ensure your stripe endpoints are not exposed we will need to configure the web hook secret key. Once you have saved your Webhooks in Stripe, Find where it says ‘Signing Secret’ and click to reveal your webhook signing secret key. Copy and paste this into the .env file at setup

Update .env file.

STRIPE_WEBHOOK_SECRET=

Updating ENV File after setup.

If you need to update the .env file afterwards please ensure to run 

php artisan config:cache  

This will cache the .env file and the system will start recognising the updating settings in the .env file.

Stripe Billing Portal

Sourcecoe Pro integrates Stripe Billing Portal to give your customers extra peace of mind when managing their subscription. Customers can easily manage all aspects of their subscription from their Sourcecode Pro Account dashboard, but the Billing Portal just adds more secure control for those who need it.

  1. In your Stripe Account click on the Customers Link in the left navigation
  2. Now click the Blue ‘Get Started’ Button
  3. Now you can Manage the appearance, Name and more for your custom Billing Portal.
  4. Fill in each section on the following screen.

 

Try to fill in as much as possible within each of the sections on the page. Customise the billing portal to match how you will be managing your product on your website.

Final Steps

Once you have completed the web installer you will then be presented with the following screen if all went successful.

Installation Complete Screen - Sourcecode Pro

Now hit the Login Button in the top right of the screen to login to your application and start managing it. Login as the Administrator with the following information

Admin Login

username: admin@admin.com

password: password

Once you have logged in you will be presented with the Admin Dashboard.

 

Sourcecode Pro - Image copyright to Freepik

Get Notified...

When Sourcecode Pro Launches...​

Your data will always be safe