Useful Commands¶
Print information about the environments.
reward info
Run only the
db
containerreward env up -- db
Launch a shell session within the project environment’s
php-fpm
container:reward shell
# or launch an `sh` shell in the nginx container reward shell sh --container nginx
Start a stopped environment:
reward env start
Stop a running environment:
reward env stop
Forcefully recreate a container:
reward env up --force-recreate --no-deps php-fpm
Remove the environment and volumes completely:
reward env down -v
Import a database:
# for plain SQL database dump you can simply use os' stdin reward db import < /path/to/dump.sql
# for compressed database dump gunzip /path/to/dump.sql.gz -c | reward db import
Note
If you face some weird issues during the database import, you can try to increase the line buffer. By default it’s 10 MB.
reward db import –line-buffer 50 < /path/to/dump.sql
Pass additional flags to MySQL during the import.
Note the “empty” double dashes (
--
) here. All the stuff after them will be passed to MySQL.# mysql --force reward db import -- --force
Run complex MySQL queries directly using
reward db connect
:# Note: to pass arguments use double dash to terminate Reward's argument parsing and escape the special characters [;'"]* # Run inline query: $ reward db connect -- -e \"SELECT table_name FROM information_schema.tables WHERE table_schema=\'magento\' ORDER BY table_name LIMIT 5\;\" # Run query passing a bash variable (note the escaped quote): $ MYSQL_CMD="\"SELECT table_name FROM information_schema.tables WHERE table_schema='magento' ORDER BY table_name LIMIT 5;\"" $ reward db connect -- -e $MYSQL_CMD # Run multiple queries/commands using heredoc: $ MYSQL_CMD=$(cat <<"EOF" "SELECT table_name FROM information_schema.tables WHERE table_schema='magento' ORDER BY table_name LIMIT 5; QUERY2; QUERY3;" EOF ) $ reward db connect -- -e $MYSQL_CMD
Dump database:
reward db dump | gzip -c > /path/to/db-dump.sql.gz
Connect database using root user:
reward db connect --root
Monitor database processlist:
watch -n 3 "reward db connect -- -e \'show processlist\'"
Tail environment nginx and php logs:
reward env logs --tail 0 -f nginx php-fpm php-debug
Tail the varnish activity log:
reward env exec -T varnish varnishlog
Clean varnish cache:
reward env exec varnish varnishadm 'ban req.url ~ .'
# or you can use this, these commands are identical: reward shell --container varnish varnishadm 'ban req.url ~ .'
Connect to redis:
reward env exec redis redis-cli
Flush redis completely:
reward env exec -T redis redis-cli flushall
Further Information¶
You can call --help
for any of reward’s commands. For example reward --help
or reward env --help
for more details
and useful command information.