https://github.com/jream/php-saas-jream
Previous JREAM.com SaaS/LMS with Video Streaming built with: AWS S3/CF/RMTP/RDB, Phalcon PHP, Stripe/PayPal API, Screen Recorded w/Yeti Mic,NodeJS, Python Fabric and Ruby Mailcatcher..
https://github.com/jream/php-saas-jream
apache bash codeception fabric lms mailcatcher node paypal-rest-api phalcon php python webpack
Last synced: 11 months ago
JSON representation
Previous JREAM.com SaaS/LMS with Video Streaming built with: AWS S3/CF/RMTP/RDB, Phalcon PHP, Stripe/PayPal API, Screen Recorded w/Yeti Mic,NodeJS, Python Fabric and Ruby Mailcatcher..
- Host: GitHub
- URL: https://github.com/jream/php-saas-jream
- Owner: JREAM
- Created: 2016-09-23T00:13:57.000Z (over 9 years ago)
- Default Branch: main
- Last Pushed: 2024-08-02T08:12:03.000Z (over 1 year ago)
- Last Synced: 2025-01-13T04:08:34.458Z (about 1 year ago)
- Topics: apache, bash, codeception, fabric, lms, mailcatcher, node, paypal-rest-api, phalcon, php, python, webpack
- Language: JavaScript
- Homepage: https://jream.com
- Size: 35 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JREAM 7.0
This is the website I built for JREAM LLC several years ago.
This remains for a portfolio piece of code. This document is not conclusive. The code was written by me and for me. :-)
- **Overview**
- Written in [Phalcon PHP](https://phalcon.io) framework.
- VPS Hosted on Ubuntu LTS Server ([Linode](https://www.linode.com)).
- PHP 7
- Apache 2
- WebPack for Assets
- SaaS
- Misc Images
- Webpack Mix
- _Packages are out of date of course :)_
- Ruby Mailcatcher for Testing Emails
- PHP Codeception for Tests
- Python Fabric for Basic Deployment Tasks
- Bash `cli.sh` for Phalcon Based `app/Tasks`
- Developed as a paid SaaS/LMS for courses I recorded.
- Blog Submodule, however `.gitmodules` of `jream/blog` is no longer available.
- Features Hosted through AWS:
- Multi A-Z MySQL Database.
- AWS MySQL RDB (Upfront).
- Streaming Video and Images:
- AWS S3 Storage.
- AWS CloudFront for RMTP Streaming.
- 3rd Party Streaming Video Player
- Paid Members for Full Courses (Stripe API).
- API Keys are Rolled/Not Active:
- Paypal REST API.
- Stripe REST API.
## Preview Images


## Dev Subdomain
At the time, this was setup using Apache. I'd likely use Nginx now but here's the configuration.
- Make a `.htpasswd` to protect the `dev` URL.
```bash
cd /etc/apache2/htpasswd
htpasswd -cB dev_jream.htpasswd jesse
```
- Setup the Apache Config:
```apacheconfig
ServerName dev.jream.com
ServerAdmin hello@jream.com
# Notice the /dev/ subfolder
DocumentRoot /var/www/dev/jream.com/public
DirectoryIndex index.php
Options Indexes FollowSymLinks
AllowOverride All
#Require all granted
# Path to the generated .htpasswd
AuthUserFile /etc/apache2/htpasswd/dev_jream.htpasswd
AuthType Basic
AuthName "Develop Area"
Require valid-user
Order Allow,Deny
Deny from All
Satisfy Any
```
## Setup Mailcatcher
- For localhost email testing use mailcatcher with Ruby
```bash
gem install mailcatcher
mailcatcher
```
- Configure PHP settings for Mailcatcher
```yaml
Mailpath: /usr/bin/sendmail
Protocol: smtp
Host: localhost
Port: 1025
```
- Go to http://localhost:1080/
- Send mail through smtp://localhost:1025
### Using Codeception
- From the root folder (Where you can see `/vendor/`) run:
```bash
vendor/bin/codecept run
```
### Server Cache
- Make sure the application/cache folder is writable.
- If setting up a `/dev` path it would also be required there.
```bash
chown -R www-data:www-data /var/www/jream.com
usermod -a -G www-data jesse
chmod 770 -R /var/www/jream.com
```
### PayPal Test Credentials
- Get the PayPal credentials from the API.
```yaml
Paypal Test: username-facilitator@gmail.com
```
## Apache Configuration
To create an .htpasswd for the development environment run `sudo htpasswd -c /etc/apache2/.htpasswd `
```apache
ServerName jream.com
ServerAdmin server@jream.com
ServerName jream.com
ServerAlias jream.com www.jream.com
# Indexes + Directory Root.
DirectoryIndex index.php
DocumentRoot /var/www/jream.com/htdocs/public/
# Logfiles
ErrorLog /var/www/logs/error.jream.com.log
CustomLog /var/www/logs/access.jream.com.log combined
ServerAdmin server@jream.com
ServerName dev.jream.com
ServerAlias dev.jream.com
# Indexes + Directory Root.
DirectoryIndex index.php
DocumentRoot /var/www/dev.jream.com/htdocs/public
# Protect
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
# Logfiles
ErrorLog /var/www/logs/error.dev.jream.com.log
CustomLog /var/www/logs/access.dev.jream.com.log combined
ServerAdmin server@jream.com
ServerName jream.com
ServerAlias jream.com
# Indexes + Directory Root.
DirectoryIndex index.php
DocumentRoot /var/www/jream.com/htdocs/public/
# Logfiles
ErrorLog /var/www/logs/error.ssl.jream.com.log
CustomLog /var/www/logs/access.ssl.jream.com.log combined
# SSL
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/jream.com/jream_com.crt
SSLCertificateKeyFile /etc/apache2/ssl/jream.com/server.key
SSLCACertificateFile /etc/apache2/ssl/jream.com/jream_com.cer
```
# Testing
- Use codeception, which can be symlinked from composer via:
```bash
ln -s vendor/bin/codecept .
```
- If nothing exists, bootstrap it with:
```bash
./codecept build
```
- Create a Test with:
```bash
./codecept generate:cept acceptance Welcome
```
- Then you'd write a file here: `tests/acceptance/WelcomeCept.php`
```php
wantTo('ensure that frontpage works');
$I->amOnPage('/');
$I->see('Home');
```
- With an active PHP directory, add the host here:
```
tests/acceptance.suite.yml
```
Then run the test with
```bash
./codecept run
```
# Crashplan
If the servers go haywire these things must be done:
- Make sure MySQL has access to the `HOST IP` (_Using AWS RDB_)
- Check the `DNS` in `AWS RDB`, Look at `Health Check`
- Make sure `Composer` is Updated
- Check `/var/logs/apache2/error.log`
## Fix for Webpack SASS
(_legacy_) So the easiest fix for now is to downgrade to npm@5.1.0 using
```bash
npm i -g npm@5.1.0
```
Then cleanup and reinstall dependencies:
```
npm cache clean -f
rm -rf node_modules/ package-lock.json
npm i
```
## TODO
This list is expired, some features will no longer be added.
- [ ] (Skip) Middleware CSRF Token.
- [ ] HLS with HTML5 through RMTP.
- [ ] Check Promotion for Expiration, ONLY IF THEY APPLY IT
- [ ] Make URL so promotion can trigger in a cookie and stay alive.
- [ ] Test out the pricing with the percentages!
- [ ] Test out the pricing with the price~
- eg:
- [ ] Promotions Table has no product_id and no user_id, it applies to ALL users globally.
- [ ] Promotions Table has two records with product_id, it applies ONLY to those products
- [ ] Promotion ALWAYS checks DELETED_AT, and EXPIRES_AT before doing anything.
- [ ] This will apply to the STANDARD promo code page (regular check)
- [ ] This will apply to the new checkout page.
---
MIT Open Source
© 2018 JREAM.com | Jesse Boyer