congraph / cms
Congraph CMS Project.
Installs: 77
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 24 063
Type:project
Requires
- php: ^7.1.3
- fideloper/proxy: ^4.0
- laravel/framework: 5.6.*
- laravel/tinker: ^1.0
Requires (Dev)
- filp/whoops: ^2.0
- fzaninotto/faker: ^1.4
- mockery/mockery: ^1.0
- nunomaduro/collision: ^2.0
- phpunit/phpunit: ^7.0
- dev-master
- v5.6.33
- v5.6.21
- v5.6.12
- v5.6.7
- v5.6.0
- 5.5.x-dev
- v5.5.28
- v5.5.22
- v5.5.0
- 5.4.x-dev
- v5.4.30
- v5.4.23
- v5.4.21
- v5.4.19
- v5.4.16
- v5.4.15
- v5.4.9
- v5.4.3
- v5.4.0
- 5.3.x-dev
- v5.3.30
- v5.3.16
- v5.3.10
- v5.3.0
- 5.2.x-dev
- v5.2.31
- v5.2.29
- v5.2.27
- v5.2.24
- v5.2.23
- v5.2.15
- v5.2.0
- 5.1.x-dev
- v5.1.33
- v5.1.11
- v5.1.4
- v5.1.3
- v5.1.1
- v5.1.0
- 5.0.x-dev
- v5.0.22
- v5.0.16
- v5.0.1
- v5.0.0
- v4.2.11
- v4.2.0
- v4.1.27
- v4.1.18
- v4.1.0
- v4.0.9
- v4.0.8
- v4.0.7
- v4.0.6
- v4.0.5
- v4.0.4
- v4.0.0
- v4.0.0-BETA4
- v4.0.0-BETA3
- dev-cms
- dev-develop
This package is auto-updated.
Last update: 2024-10-29 05:17:09 UTC
README
Installation
Congraph CMS Installation has 3 parts: Laravel API installation, NodeJS Admin installation and Nuxt Frontend App Your folder structure should be:
/projects-folder
---- /new-project
--------- /new-project-api
--------- /new-project-admin
--------- /new-project-app
api folder for laravel app, admin folder for admin app and app folder for frontend Nuxt application
Laravel API
With Composer install version dev-master:
composer create-project congraph/cms [folder-name] [version]
composer create-project congraph/cms new-project-api dev-master
This should pull all the files to your computer and install all php dependencies
Next thing you should do is setup your database, recomended naming for DB is to have 'cg_' prefix, and have utf8_general_ci collation
Once you have DB setup, you should edit .env file.
Go to root of your new-project-api
folder and find .env
file, if for some reason that file doesn't exist you can duplicate the .env.example
file and name it .env
Here you can find all the settings for your environment
Settings that you need to set before going further are:
DB_DATABASE
- name for your mysql databaseDB_USERNAME
- username for accessing mysql DBDB_PASSWORD
- password for that user (leave blank if you don't use password)USING_ELASTIC
- flag for use of elasticsearch DB, you will know if you are using it, otherwise set this tofalse
. If you are using elasticsearch in your project you should uncomment EntityElasticServiceProvider in your app config/config/app.php
.
Now we need to run few artisan commands in CMD/Terminal
- First we want to generate a random App Key for the new application
php artisan key:generate
- We want to generate optimized loader for laravel
php artisan optimize
- Next we want to run Congraph init script that will a) migrate DB tables. b) run seeders for initaial DB data c) create 2 new client apps for Congraph.
php artisan congraph:init
This command should print out settings for 2 apps (Administration App, Frontend App). You should copy these settings to some file or note. Later you can find them in your database.
Setting WAMP Server for Laravel API
- choose a url for your API, recomended url should start with 'api.', for example
http://api.new-project.com
|http://api.new-project.test
|http://api.new-project.localhost
for local development - change hosts file: you can find it in
C:\Windows\System32\drivers\etc
- add new line in hosts file and write your new URL
127.0.0.1 api.new-project.localhost
- change apache config for virtual hosts, you can find it in
C:\wamp64\bin\apache\apache2.4.33\conf\extra
config filehttpd-vhosts.conf
- add new virtual host
<VirtualHost *:80>
ServerName api.new-project.localhost
DocumentRoot "${INSTALL_DIR}/www/new-project/new-project-api/public"
<Directory "${INSTALL_DIR}/www/new-project/new-project-api/public">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
- restart WAMP Server
- try going to that URL in your browser - you should get white page with "Laravel 5" heading
NodeJS Administration App
We will install the admin app by cloning the repository from github
git clone git@github.com:congraphcms/admin.git [directory]
git clone git@github.com:congraphcms/admin.git new-project-admin
after cloning the repo we want to move to the admin project folder and run npm installer
npm install
This should install all dependencies to our local environment
We need to setup our environment like with laravel project. First we need to duplicate the .env.example
file and name it .env
.
cp .env.example .env
And now we can change the .env
file. Settings we need to set:
APP_URL
usually 'localhost:8080' but you can set it to any port or custom URL. Note: If you are using custom URL that is not localhost you need to have ngnix or appache set to proxy requests to your app. For local development it's recommended to stick to the localhost scheme.APP_PORT
should be same as port inAPP_URL
APP_HOST
should be same as host inAPP_URL
CG_URL
URL where we can find Congraph API (include the/
at the end of URL)CG_CLIENT_ID
paste the value from Laravel APP for Administration App IDCG_CLIENT_SECRET
paste the value from Laravel APP for Administration App SECRETNODE_ENV
set to 'local' for local dev environment or 'production' for use on the production server
With these parameters set, we can run the Administration App
npm run start
Aplication should be available at your specified location default http://localhost:8080 You should successfully login with credentials: email: john.doe@example.com password: secret
Troubleshoot
- If you get CORS policy error when trying to log in (check DevTools console for that).
Go to your Laravel API project folder and then go to
/vendor/congraph/api/Http/routes.php
file Uncomment the 5. lineheader('Access-Control-Allow-Origin: *');
Try to log in again.
Nuxt Frontend App
We will install the frontend app by cloning the repository from github
git clone git@github.com:congraphcms/nuxt-starter.git [directory]
git clone git@github.com:congraphcms/nuxt-starter.git new-project-app
after cloning the repo we want to move to the frontend project folder and run npm installer
npm install
This should install all dependencies to our local environment
We need to setup our environment like with laravel project. First we need to duplicate the .env.example
file and name it .env
.
cp .env.example .env
And now we can change the .env
file. Settings we need to set:
CG_URL
URL where we can find Congraph API (include the/
at the end of URL)DEFAULT_LOCALE
the code for default locale used by App example:en_US
With these parameters set, we can run the Frontend App
npm run dev
Deployment
Info
3 Apps need deployment
- API app (api)
- Admin app (admin|cms)
- Frontend app
API Deployment
Requirements:
- MySQL | MariaDB installed
- Elasticsearch installed
- PHP ^7.0 installed
Steps:
- Copy files
- Configuration
- DB Seed
Copy files
- Copy all files compressed in a .zip file including "vendor" folder if composer is not available on the server.
- Unzip files on the server over ssh.
- Set permissions for files. Hokosoft servers:
chown -R {$domain}:www /usr/local/www/data/{$domain}
chmod -R 750 /usr/local/www/data/{$domain}
Configuration
- Change .env file (mysql settings, es settings, index name, app key etc.)
- If using apache server add this to .htaccess file in /public folder
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
- Change domain in app.php file in /config folder
DB Seed
- Upload empty Congraph db to server and import it
- Check DefaultWorkflowSeeder.php and OAuthSeeder.php in /database/seeds folder, if data is ok for this setup run the seeders
- Run the seeders with
php artisan db:seed --class=DefaultWorkflowSeeder
php artisan db:seed --class=OAuthSeeder
Admin App Depoloyment
Requirements:
- node and npm installed on server
- preferably pm2 install on server