Important
This repo is for the older Presentator v2 and it is no longer maintained.
Presentator Starter is a skeleton Presentator v2 installation setup best suited for production environment.
It wraps all required components for a Presentator installation in a single package and allows seamless upgrades just by using Composer.
This repository is READ-ONLY. Report issues and send pull requests in the main Presentator repository.
If you prefer a dockerized version of the starter package, please check presentator-docker.
-
Apache/Nginx HTTP server
-
SQL database (MySQL/MariadDB/PostgreSQL)
For MySQL up to 5.6 and MariaDB up to 10.1 you may need to set
innodb_large_prefix=1
andinnodb_default_row_format=dynamic
to prevent migration errors (see #104). -
PHP 7.1+ with the following extensions:
Reflection PCRE SPL MBString OpenSSL Intl ICU version Fileinfo DOM extensions GD or Imagick
In addition, here are some recommended
php.ini
configuration settings:post_max_size = 64M upload_max_filesize = 64M max_execution_time = 60 memory_limit = 256M
-
Install through Composer:
composer create-project presentator/starter /path/to/starter/
For security reasons, if you are using a shared hosting service it is recommended to place the project files outside from your default public_html(www) directory!
-
Setup a vhost/server address (eg. https://your-presentator.com/) and point it to
/path/to/starter/web/
.By default a generic
.htaccess
file will be created for you after initialization. If you are using Nginx, you could check the following sample configuration. -
Create a new database (with
utf8mb4_unicode_ci
collation). -
Adjust the db, mailer and other components configuration in
config/base-local.php
accordingly.Check base.php for all available options.
-
Adjust your environment specific parameters (public urls, support email, etc.) in
config/params-local.php
accordingly.Check params.php for all available options.
-
(optional) If needed, you could also adjust the frontend (aka. SPA) settings by editing the
extra.starter.spaConfig
key in yourcomposer.json
file.Check .env for all available options.
-
Run
composer install
to make sure that the application is properly inited. -
(optional) Setup a cron task to process unread screen comments:
# Every 30 minutes processes all unread screen comments and sends an email to the related users. */30 * * * * php /path/to/starter/yii mails/process-comments
That’s it! Check the application in your browser to verify that everything is working fine.
# set Super User access rights to a single User model
php /path/to/starter/yii users/super [email protected]
# set Regular User access rights to a single User model
php /path/to/starter/yii users/regular [email protected]
# regenerates all screen thumbs
php /path/to/starter/yii screens/generate-thumbs
The default base-local.php
comes with commented various auth clients configurations.
For example, if you want to allow your users to login with their Facebook account:
-
Register a Facebook app (only the account email is required, so there is no need for any special permissions).
Make sure for Valid OAuth Redirect URIs to set the same url as
authClientRedirectUri
from yourparams-local.php
(by default it should be something like https://your-presentator.com/#/auth-callback).NB! Some clients may not support hash/fragment URIs (aka.
/#/
). In this case, define your redirect uri without the hash (eg. https://your-presentator.com/auth-callback) and add a redirect/rewrite rule to your Nginx/Apache configuration that should prepend/#/
to the request path address. Here is a generic Nginx redirect rule:location ~ ^/(?!(index\.html|#|api|storage|spa-resources|assets)).+ { rewrite ^\/(.*)$ /#/$1 redirect; }
-
Register the Facebook auth client in your
base-local.php
:'components' => [ ... 'authClientCollection' => [ 'class' => 'yii\authclient\Collection', 'clients' => [ 'facebook' => [ 'class' => 'yii\authclient\clients\Facebook', 'clientId' => 'YOUR_APP_CLIENT_ID', 'clientSecret' => 'YOUR_APP_CLIENT_SECRET', ], ], ], ]
By default all uploaded files are stored locally on your server in /path/to/starter/web/storage
.
If you are worried about disk space or want to store your uploads on a different server, you could override the default fs
component configuration.
For example, if you want to store your files on AWS S3:
-
Update the
baseStorageUrl
in yourparams-local.php
// base public url to the storage directory (could be also a cdn address if you use S3 or other storage mechanism) 'baseStorageUrl' => 'https://example.com/storage',
-
Add the AWS S3 filesystem adapter to your dependencies
composer require league/flysystem-aws-s3-v3
-
Override the default
fs
component in yourbase-local.php
:'components' => [ 'fs' => new \yii\helpers\ReplaceArrayValue([ 'class' => 'creocoder\flysystem\AwsS3Filesystem', 'key' => 'YOUR_KEY', 'secret' => 'YOUR_SECRET', 'bucket' => 'YOUR_BUCKET', 'region' => 'YOUR_REGION', 'options' => [ 'ACL' => 'public-read', ], // other parameters: // 'version' => 'latest', // 'baseUrl' => 'YOUR_BASE_URL', // 'prefix' => 'YOUR_PREFIX', // 'endpoint' => 'http://your-url' ]), ... ]
For other adapters and more options, go to https://github.com/creocoder/yii2-flysystem.
To update your Presentator application to the latest available version, just run composer update
while in the project root directory.
For a finer control, check the packages version constraint in the
require
section of/path/to/starter/composer.json
.
To backup your Presentator application:
-
Export your Presentator database via the DBMS cli tools (eg.
mysqldump
,pg_dump
) or via Adminer/phpMyAdmin/etc. -
Backup the app
config/
folder and the uploaded users content (usuallyweb/storage/
).
To restore your Presentator application you can apply the following steps for an old or new installation:
-
Import your Presentator database via the DBMS cli tools (eg.
mysqldump
,pg_dump
) or via Adminer/phpMyAdmin/etc. -
Return the previously backuped
config/
and uploaded users content to their original location. -
Run
php /path/to/starter/yii migrate up
to ensure that the latest app database changes are applied.