Here are a few steps to run your local copy of CodeX site.
Make sure that you have installed Docker and docker-compose.
git clone --recursive https://github.com/codex-team/codex
cd codex
Copy .env
file for docker containers and update field inside.
cp .env.sample .env
Then build and run containers.
docker-compose up -d
docker-compose exec php composer install
You can copy env file skeleton from sample file codex/www/.env.sample
.
cd www
cp .env.sample .env
This site uses Hawk as error catching service. You can create an account and add a new project.
codex (project's root directory)
|- docker
|- docs
|- www ( <- You are here )
| |- application
| | |- cache
| | |- logs
| | ...
| ...
| |- upload
| ...
...
Create a directory for uploaded files e.g. editor's images and users' profile pictures.
mkdir upload
chmod 777 upload
Then you need to go to the application
directory. Create these two directories and set full access permissions for every user.
cd application
mkdir cache logs
chmod 777 cache logs
Open phpMyAdmin in localhost:8885/phpmyadmin/.
Check port which defined in .env file.
Use these credentials to sign in.
- server:
mysql
- login:
root
- password: defined in .env file
Create a new database with the name, say, codexdb
with utf8_general_ci
collation.
Open IMPORT
tab and choose !_codexdb.sql
file to import. In this file you can find SQL-requests to make a complete database skeleton.
codex
|- www
| |- migrations
| | |- !_codexdb.sql
| | ...
| ...
...
Go to codex/www/application/config
and duplicate sample files without .sample
in their names.
Set redis
as a hostname, to match the hostname of the docker container with Redis.
Other fields you can left with default values.
On 10th line in host
param you should set Memcached container's hostname memcached
.
'host' => 'memcached', // Memcache Server
Set mysql
as a hostname of MySQL container. Type database name, username and password.
Password defined in .env file.
'hostname' => 'mysql',
'database' => 'codexdb',
'username' => 'root',
'password' => 'root',
Somewhere in the project we use notifications from @codex_bot. You can get a notifications link from it typing a command /notify_start
. You have to add @codex_bot in Telegram for that and start conversation.
To enable authorisation via GitHub on your local site you need to create a new GitHub OAuth app.
Open https://github.com/settings/applications/new and fill the form.
Set any Application name
and enter a correct link (with protocol) to your site as a Homepage URL
.
In the field Authorization callback URL
you should type a link to your local site with /auth/github
uri:
http://localhost:8885/auth/github
After registering an application you will be redirected to app's settings page. Get there Client ID
and Client Secret
params and put then into the APP_ID
and APP_SECRET
fields in oauth.php
on lines 30 and 31.
...
'github' => array(
'APP_ID' => '',
'APP_SECRET' => '',
...
8. Open http://localhost:8885. You'll see a CodeX site's homepage. Try to auth.
In phpMyAdmin choose database for this site (codexdb) 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 we use caching to reduce the database load. You can also clear cache yourself by restarting Memcached container.
docker restart codex_memcached_1