Skip to content

Latest commit

 

History

History
173 lines (100 loc) · 4.27 KB

general-installation.md

File metadata and controls

173 lines (100 loc) · 4.27 KB

General installation

This guide will help you set up and run your own copy of CodeX Media.

Also you can read VPS setting up example page.

Clone and init

Make sure you have installed Docker and docker-compose.

Clone the repository

git clone https://github.com/codex-team/codex.media

Initialize project

cd codex.media
./bin/init.sh

You may want to know what this script does. Here is a source code with comments.

Links

Site will be run on 8880 port by default in the localhost loop.

http://localhost:8880/ — main site

http://localhost:8880/phpmyadmin — phpMyAdmin panel

Environment vars — .env files

There are two environment files:

  • .env — vars for docker
  • www/.env — vars for project

Open them and read comments for correct setting up.

Config files

Config files are located at www/application/config/ directory.

social.php — auth methods

You need to create application for auth in these social networks.

vk.com

TBA

facebook.com

TBA

twitter.com

Go to https://developer.twitter.com/en/apps.

Create a new application by pressing button "Create an app".

Fill up required fields.

Enter correct Callbacks URL for your site.

https://your-domain.com/auth/tw

In the tab 'Keys and tokens' you will find Consumer API keys:

API key: LzEFP.................E5u4
API secret key: ZqYORi..................................mRR5

Use them in social.php config file.

email.php — outgoing emails from server

CodeX Media uses a Sendgrid as a mailing service.

  1. Register a new account and choose free plan (40000 emails per month)

  2. Open Setup Guide - Integrate - Web API - PHP

Enter a name for a new key then press «Create Key»

Copy this key and paste to email.php config file.

You can fill up senderName and senderEmail.

communities.php — news autoposting to vk.com

If you want to enable auto posting news to VK community page, then follow this guide. You need to have rights to post anything to the community's wall as that community.

Shortly you need to register a new Standalone application, give it rights to post to walls from your name and get an access_token. Then you need to get group_id — a page's identifier (integer number below zero).

Then you'll be able to enable or disable posting news to community's wall.

Admin rights

In phpMyAdmin choose codexmedia database and open table Users. Find row with for your user and change role value from 1 to 3.

Changes will be applied in 5 minutes because of caching to reduce the database load. You can also clear cache yourself by restarting Memcached container.

Backups

Read: Creating and restoring backups

Apply updates

To upgrade the project on your server follow the deploy steps on releases page.

Example

Usually you just need to pull changes and rebuild static files:

# Pull changes
git pull

# Install new node.js dependencies
docker-compose exec php yarn

# Build static files
docker-compose exec php yarn build

You may need update the composer packages:

docker-compose exec php composer install

But sometimes you also need to rebuild the containers:

# Stop containers
./bin/docker/down.sh

# Pull changes
git pull

# Build containers
./bin/docker/build.sh

# Run containers
./bin/docker/up.sh

# Install new node.js dependencies
docker-compose exec php yarn

# Build static files
docker-compose exec php yarn build

You may need to apply mysql database migrations from ./www/migrations directory.

If you need to run updates via Minion use docker exec command with a target task name:

docker-compose exec php ./minion 06fixmissingfieldsintabletool