Publish populate
Intro
In production, with DBs with many articles, the wf:cms:publish:populate
may need special considerations.
For PRO environments, this task should be ran as make publish-populate
. This is a make task that automatically enables a PHP extension to allow sending multiple commands to Redis instead of sending them one by one.
The task runs wf:cms:publish:populate
in multi
mode, meaning the command, instead of actually running the commands against the Redis server, will only dump them into the /tmp/redis.buf
file. After the Symfony command finishes, the make task pipes this file to the Redis server (cat /tmp/redis.buf | redis -h HOST --pipe
)
Special considerations
- Make sure
redis-cli
is available on the server where this task is being ran - Make sure
redis-cli
version installed on this server accepts the host argument (-h
) by runningredis-cli --help
(version 2.4 supports it) - Some shells complain when running
make publish-populate
(./vendor/wfcms/cms-base-admin-bundle/Wf/Bundle/CmsBaseAdminBundle/Resources/bin/publish-populate: 7: ./vendor/wfcms/cms-base-admin-bundle/Wf/Bundle/CmsBaseAdminBundle/Resources/bin/publish-populate: [[: not found
). It's safe to skip the make command and run it manually/bin/bash ./vendor/wfcms/cms-base-admin-bundle/Wf/Bundle/CmsBaseAdminBundle/Resources/bin/publish-populate
Slow piping to Redis
In some cases, piping the resulting .buf file to Redis can be very slow (this process should finish in less than a minute, even for considerably large DBs). This process can be sped up by taking the following approach:
- Make sure the redis-server is running on the same host as the CMS
- Change the
tracking.redis.dsn
to point to the local redis server (redis://127.0.0.1
) - Run the make task
- After it completes, save a dump of the local Redis:
redis-cli save
- Check the location of the resulting
dump.rdb
file by checking redis-server conf (/etc/redis/redis.conf
). The directory is taken from thedir
config (e.g./var/lib/redis
), the name of the dumpfile is taken fromdbfilename
config (e.g.dump.rdb
). So the final path to the dump file should be/var/lib/redis/dump.rdb
- Stop the PRO Redis server
- Copy this file to the PRO Redis server, to the path it uses for the dump, determined the same way as #5
- Start the PRO Redis server