Start by getting installing pip from the following link:
https://pip.pypa.io/en/stable/installing.html
Insall supervisor (there's no stable release of supervisor at the time of this writing, use the --pre flag):
> pip install supervisor --pre
Supervisor should be running already.
Copy the config to /etc
> echo_supervisord_conf > /etc/supervisord.conf
If supervisord is not already started, run supervisord in the directory your desired config is located. If you don't want to use the /etc/supervisord.conf and you have it somewhere else, run it there.
Start supervisord
> supervisord
Restart all supervisor processes.
> sudo supervisorctl restart all
If you want to start a program, you need to use :*, as supervisord names each program along with it's process name. Assume you defined your program as [program:hello]:
> supervisorctl
> start hello:*
Stop supervisor:
> ps -ef | grep supervisord
This should show the process id running supervisord. Terminate it by issuing a kill command.
501 95787 1 0 Fri07pm ?? 0:02.92 /usr/bin/python /usr/local/bin/supervisord
> kill -s SIGTERM 95787
For a sample supervisord config, check here.
Wednesday, May 13, 2015
Tuesday, April 14, 2015
Thursday, April 9, 2015
phpstorm xdebug php.ini settings
Put the following into your php.ini
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.5.22/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
xdebug.profiler_enable=1
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.5.22/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so"
xdebug.profiler_enable=1
xdebug.remote_enable=1
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
Friday, March 13, 2015
Bee run failed for Golang and Beego
If you are using beego and bee in your Golang project, you may run into an issue that says "Run failed" when you started "bee run"
Assuming you cd into your folder and the error still persists, try running "bee version".
If you see the above message, you may find that the newest Golang SDK from google is naming "go" command as "goapp".
What you need to do is to rename "go_appengine/goapp" to "go_appengine/go".
And rename "go_appengine/goroot/goapp" to "go_appengine/goroot/go".
Assuming you cd into your folder and the error still persists, try running "bee version".
bee :1.2.4
beego :1.4.3
exec: "go": executable file not found in $PATH
What you need to do is to rename "go_appengine/goapp" to "go_appengine/go".
And rename "go_appengine/goroot/goapp" to "go_appengine/goroot/go".
Thursday, June 5, 2014
Setting up Wordpress on Elastic Beanstalk
ElasticBeanStalk is a service that automates scaling, load-balancing, and deploying applications so you can concentrate on only software development. In a way, it is very similar to Google App Engline.
In this article, we will visit how we can set up Wordpress on Elastic Beanstalk.
Configuration the Elastic Beanstalk Environment
First log into your ElasticBeansTalk and click on Create a New Application.
Enter the Application Name and Description and click Next.
Click on "Create one now" to create a new environment.
Environment tier: Web Server 1.0
Predefined configuration: PHP
Environment type: Load balancing, autoscaling
Note for Environment tier, Web Server handles web requests (HTTP/S) while workers handle background processes.
Choose sample application for now
You will then be prompted to input an Environment Name. Label it whatever, as we will use CNAME later.
For Additional Resources, check create an RDS DB instance with this environment.
In Configuration Details, select your EC2 key pair and leave the other details as it is. You can always change these later.
For RDS configuration, put 5GB for allocated storage. Input the username and password. Select Create snapshot and single availability zone.
Click Launch.
Once it's launched, click Configuration on the left sidebar, then Software Configuration. In PARAM1, set to production, staging or something else.
Installing Wordpress
We need to have different wp-config files for local development and Elastic BeanStalk. Let's define the local config as local-config.php.
Set up wordpress in your local computer.
In wp-config, replace the database configs with the following:
if ( file_exists( dirname( __FILE__ ) . '/local-config.php' ) ) {
define( 'WP_LOCAL_DEV', true );
include( dirname( __FILE__ ) . '/local-config.php' );
} else {
define( 'WP_LOCAL_DEV', false );
define('WP_HOME','');
define('WP_SITEURL','');
define('DB_NAME', 'database');
define('DB_USER', 'username');
define('DB_PASSWORD', 'password');
define('DB_HOST', 'localhost');
}
Fill in the above db_name, db_user, db_password, db_host with the appropriate settings.
Create a file called local-config.php at the same directory as wp-config.php
Put in the following with your local database information.
<?php
define('WP_HOME','');
define('WP_SITEURL','');
define('DB_NAME', '');
define('DB_USER', '');
define('DB_PASSWORD', 'root');
define('DB_HOST', '');
Install AWS ElasticBeanstalk Tools and AWSDevTools
Download from http://aws.amazon.com/code/6752709412171743
Read this: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/GettingStarted.GetSetup-devtools.html
Check to make sure eb is running properly:
eb --version
Configure your ElasticBeanstalk Git settings:
git aws.config
Reading Credentials from C:\Users\Kenneth\.elasticbeanstalk\aws_credential_file.
The file does not exist. You can supply credentials by creating the file or editing .elasticbeanstalk/config to reference a different file.
The credential file should have the following format:
AWSAccessKeyId=your key
AWSSecretKey=your secret
AWS Access Key:
AWS Secret Key:
AWS Region [default to us-east-1]: (Check this in your Elastic Beanstalk console)
AWS Elastic Beanstalk Application: <put in the application name you created above>
AWS Elastic Beanstalk Environment: <put in the environment name you created above>
Check if Elastic Beanstalk can detect your app:
eb status --verbose
Now deploy your application:
git aws.push
Remember to use Route53 to map to Elastic Beanstalk.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customdomains.html
After you point the domain to the Elastic Load Balancer. If the site does not load up in the browser, do not panic. Give it 15 mins. It will be back up.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customdomains.html
After you point the domain to the Elastic Load Balancer. If the site does not load up in the browser, do not panic. Give it 15 mins. It will be back up.
Wednesday, May 14, 2014
AWS s3 - The specified bucket is not valid.
If you receive the message "The specified bucket is not valid." while trying "enable website hosting", make sure your bucket name adhere to the following:
- Should not contain uppercase characters
- Should not contain underscores (_)
- Should be between 3 and 63 characters long
- Should not end with a dash
- Cannot contain two, adjacent periods
- Cannot contain dashes next to periods (e.g., "my-.bucket.com" and "my.-bucket" are invalid)
- Should not contain uppercase characters
- Should not contain underscores (_)
- Should be between 3 and 63 characters long
- Should not end with a dash
- Cannot contain two, adjacent periods
- Cannot contain dashes next to periods (e.g., "my-.bucket.com" and "my.-bucket" are invalid)
Sunday, April 27, 2014
composer update killed on ec2 micro
I was updating my symfony plugins using composer and I received the following error in ssh:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Killed
My research founded that it's because the ec2 instance does not have enough ram to perform such an update.
What you can do is to do a "composer.phar update" in a local machine. This would produce a composer.lock file.
Upload this .lock file to production, and run "composer.phar install" instead.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Killed
My research founded that it's because the ec2 instance does not have enough ram to perform such an update.
What you can do is to do a "composer.phar update" in a local machine. This would produce a composer.lock file.
Upload this .lock file to production, and run "composer.phar install" instead.
Subscribe to:
Posts (Atom)