1. 首先安装git,不用装乌龟。
2. 然后配置git的username和email,global方面的。
3. 生成ssh可以
4. 在github上注册一个账户,邮件用配置git的邮件,然后把ssh.pub的内容添加到账户的ssh key 中
5. 测试一下是否成功
6. 在cloudcontrol中注册一个账户,邮件用你配置git的邮件
7. 在cloudcontrol中添加ssh key
8. 用git测试clone cloudcontrol的实例代码,如下
然后添加一个php的应用程序,名称为locationmonitor
网站会给一个实例,如下
To show how easy it is to extend an app with Add-ons let's add a free shared MySQL database. To access the database we need to read the credentials from the deployment's private JSON file.
# read the credentials file $string = file_get_contents($_ENV['CRED_FILE'], false); if ($string == false) { die('FATAL: Could not read credentials file'); } # the file contains a JSON string, decode it and return an associative array $creds = json_decode($string, true); # use credentials to set the configuration for MySQL $config = array( 'MYSQL_HOSTNAME' => $creds['MYSQLS']['MYSQLS_HOSTNAME'], 'MYSQL_DATABASE' => $creds['MYSQLS']['MYSQLS_DATABASE'], 'MYSQL_USERNAME' => $creds['MYSQLS']['MYSQLS_USERNAME'], 'MYSQL_PASSWORD' => $creds['MYSQLS']['MYSQLS_PASSWORD'] );
The tutorial app we cloned from Github is already prepared. You can see the full example of this code in the _config.php file. For now go ahead and add the Add-on.
进入到下一步1. Push the code
$ cd cctrl_tutorial_app $ git remote add cctrl ssh://locationmonitor@cloudcontrolled.com/repository.git $ git push cctrl master
2. Deploy the app
After you pushed your code, let's deploy it.
照着做一遍,结果如下: