Skip to content

Instantly share code, notes, and snippets.

View hn-support's full-sized avatar

Hypernode Support hn-support

View GitHub Profile
@hn-support
hn-support / redis-sessions-magento.xml
Last active December 9, 2016 14:44
Setup redis sessions for Magento 1
<session_save>db</session_save>
<redis_session>
<host>redismaster</host>
<port>6379</port>
<password></password>
<timeout>2.5</timeout>
<persistent></persistent>
<db>2</db>
<compression_threshold>2048</compression_threshold>
<compression_lib>gzip</compression_lib>
@hn-support
hn-support / iopsmon.sh
Created March 13, 2017 12:25
Monitor I/O heavy SQL queries and PHP requests on Hypernode
#!/bin/bash
# monitors iops per 30 sec interval, and prints current http and sql transactions if iops avg > 100
while true; do
iops=$(iostat xvdf -d 30 2 | tail -2 | head -1 | awk '{print $2}' | cut -d. -f1)
if [[ "$iops" -gt 100 ]]; then
echo "-------------------------------------------------------------------"
echo "IOPS: $iops"
echo
@hn-support
hn-support / redis-sessions.php
Last active March 20, 2017 13:26
Setup redis sessions for Magento 2
'session' => array(
'save' => 'redis',
'redis' => array(
'host' => 'redismaster',
'port' => '6379',
'password' => '',
'timeout' => '2.5',
'persistent_identifier' => '',
'database' => '2',
'compression_threshold' => '2048',
@hn-support
hn-support / env.php
Last active March 20, 2017 13:26
Setup redis caching for magento2
'cache' => array(
'frontend' => array(
'default' => array(
'backend' => 'Cm_Cache_Backend_Redis',
'backend_options' => array(
'server' => '127.0.0.1',
'port' => '6379',
),
),
),
@hn-support
hn-support / env.php
Last active March 20, 2017 13:28
Setup redis page cache for magento2
'cache' => array (
'frontend' => array (
'default' => array (
'backend' => 'Cm_Cache_Backend_Redis',
'backend_options' => array (
'server' => '127.0.0.1',
'port' => '6379',
),
),
// Start of snippet
@hn-support
hn-support / server.robots.md
Last active April 12, 2017 16:08
Robots.txt for multisite magento 1 installations
location /robots.txt { return 200 "### Autogenerated robots.txt\n

# Sitemap
Sitemap: https://$http_host/sitemap.xml

# Crawlers Setup
User-agent: *
Crawl-delay: 20
@hn-support
hn-support / check-enough-space.sh
Last active May 3, 2017 12:47 — forked from gwillem/check-enough-space.sh
Create Hypernode copy of live site
#!/bin/bash
# This script checks if there is enough diskspace available on your hypernode
# to create a basic staging environment as explained in
# - https://support.hypernode.com/knowledgebase/using-a-basic-staging-environment-magento1/
# and
# - https://support.hypernode.com/knowledgebase/using-a-basic-staging-environment-magento2/
# To use it, download or copy the script and make it executable.
# is there enough space?
DBNAME=$(magerun --root-dir=~/public db:info dbname)
@hn-support
hn-support / testtls.php
Last active May 3, 2017 13:05
Verify curl ssl connections with php
<?php
/*
This script tests whether your php installation is able to create TLS connections.
*/
foreach ([6, 7, 8] as $version) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://tlstest.paypal.com/");
curl_setopt($ch, CURLOPT_SSLVERSION, $version);
var_dump(curl_exec($ch));
var_dump(curl_error($ch));

Magento testing scenarios

For use after an upgrade to verify the correct working of Magento

SHIP IT

Frontend

General

  • Activate all logs on the server (PHP, MySQL, Magento, mail, etc)
  • Check meta tags in HTML
# Original blog post: <https://mnx.io/blog/a-proper-server-naming-scheme/>
# Original word list: <http://web.archive.org/web/20091003023412/http://tothink.com/mnemonic/wordlist.txt>
# Sample usage: `curl <gist> | tail --lines +4 | shuf | head --lines 1`
acrobat
africa
alaska
albert
albino
album
alcohol