##connec to the server from this ip to mysql
iptables -A INPUT -i eth0 -p tcp -d xx.xx.xx.xx --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
##connect to the server from this ip
/sbin/iptables -A INPUT -p tcp -s XXX.XXX.XXX.XXX -j ACCEPT
| Elastic Load Balancer, CloudFront and Let's Encrypt |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(query_start, clock_timestamp()), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| ;################################################### | |
| ; NOTE | |
| ;#################################################### | |
| ; change your curl.ini on /etc/php.d/curl.ini | |
| ; | |
| ;This config was only tested on amazon AMI | |
| ;Please check if /etc/ssl/certs/ca-bundle.crt exists | |
| ; | |
| ;If you don't have the ca-bundle root certificate you | |
| ; can get this in |
##connec to the server from this ip to mysql
iptables -A INPUT -i eth0 -p tcp -d xx.xx.xx.xx --dport 3306 -m state --state NEW,ESTABLISHED -j ACCEPT
##connect to the server from this ip
/sbin/iptables -A INPUT -p tcp -s XXX.XXX.XXX.XXX -j ACCEPT
| -- Create a group | |
| CREATE ROLE readaccess; | |
| -- Grant access to existing tables | |
| GRANT USAGE ON SCHEMA public TO readaccess; | |
| GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess; | |
| -- Grant access to future tables | |
| ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess; |
-- Firstly, remove PRIMARY KEY attribute of former PRIMARY KEY
ALTER TABLE <table_name> DROP CONSTRAINT <table_name>_pkey;-- Then change column name of your PRIMARY KEY and PRIMARY KEY candidates properly.
ALTER TABLE <table_name> RENAME COLUMN <primary_key_candidate> TO id;| <?php | |
| /** | |
| * System Log using monolog | |
| */ | |
| $di->set('log', function ($file = 'debug') use ($config, $di) { | |
| // Create the logger | |
| $logger = new MonoLogger('GEWAER.API'); | |
| $client = new Raven_Client('https://' . getenv('SENTRY_RPOJECT_SECRET') . '@sentry.io/' . getenv('SENTRY_PROJECT_ID')); |
| <?php | |
| require_once __DIR__ . '/../vendor/autoload.php'; | |
| /** | |
| * Get mailgun report | |
| * | |
| * @param string $url | |
| * @return array | |
| */ |