(for dummmies...I mean novice web developers)
- Install dependencies
sudo apt-get install postgresql postgresql-contrib
sudo apt-get install php php-fpm php-bcmath php-sqlite php-pgsql php-mcrypt php-curl php-mbstring
sudo apt-get install npm
sudo npm install ---global gulp-cli
sudo apt-get install rabbitmq-server
- Enable Tracy debugger
To really see what is going wrong, it is VERY helpful to setup debugging environment Tracy. It should suffice to:
cp app/bootstrap.php.debug app/bootstrap.php:
Then you should get extremely nice debug info right in the browser! To see available commands in the app:
php www/index.php list
- Configure Postgre
According to a guide for Ubuntu
sudo -u postgres createuser --superuser $USER
sudo -u postgres psql
postgres=# \password $USER
createdb khanovaskola
(if you create DB under different psql user, you need to execute something like this)
GRANT ALL PRIVILEGES ON DATABASE khanovaskola to khanovaskola;
- Configure app/config/config.local.neon Tip: Get the template from:
cp app/config/stages/dev.neon app/config/config.local.neon
Note: the database parameters must match what you did in step 3.
- Creating initial database inside PSQL
- Use migrations
php www/index.php migrations:migrate --init
php www/index.php migrations:migrate
LOKI: After this step you can import data from KA. See production/crontab to see how.
- Alternatively, import previous backup
php index.php backup:list
php index.php backup:restore TIMESTAMP (first number form previous command)
- Clear the data in the database
php www/index.php data:drop
To understand the database schema, look into SQL.md
- Setting up NGINX
- Setting up file permissions according to 20-chmod.sh
you may need to execute this for git to ignore these changes:
git config core.fileMode false
-
sudo nginx -s stop
-
Setup the web at localhost via an nginx conf file. For development, you can use (production/nginx-dev.conf) [production/nginx-dev.conf]. For production with HTTPS, look at (production/nginx.conf)[production/nginx.conf]
cp production/nginx-dev.conf /etc/nginx/sites-available/ka-dev.conf
ln -s /etc/nginx/sites-available/ka-dev.conf /etc/nginx/sites-enabled/ka-dev.conf
-
Make sure that user www-data is in the group that you previously used for the repo
-
Modify /etc/hosts , include e.g.
127.0.0.1 ks.cz
sudo nginx
- TODO: How to setup elasticsearch server
- Setting up workers via cron jobs for async tasks (this is supremely important for production servers)
- See README for async tasks
- Modify and put production/crontab into Cron jobs
sudo cp production/crontab /etc/cron.d/KA
- Granting admin privileges to a user UPDATE USERS SET privileges = '["all"]' WHERE id = '1';
(The following are messages from Tracy and corresponding corrective action)
Problem: ERROR in Kdyby/Facebook: Use of undefined constant URLOPT_CONNECTTIMEOUT – assumed ‚CURLOPT_CONNECTTIMEOUT‘
Solution:
sudo apt-get install php-curl
Problem: Missing parameter ‘locale’
Solution: add parameter locale: “en” in app/config/config.local.neon (watch out, must be escaped with a TAB)
Problem: Call to undefined function App\Models\Services\mcrypt_get_iv_size()
Solution: sudo apt-get install php5-mcrypt