Opsworks deploy to custom layer

2019-09-03 09:44发布

问题:

I'm new to Opsworks, so hopefully this is a very easy question!

My setup is a custom PHP/Apache AMI (Amazon Linux) server layer, an RDS layer, and a PHP app named "abc_app" in an S3 bundle.

I tried to deploy the app to a server instance. It deployment finished successfully, but the code is not anywhere on the server, and nothing was in the /var/www/html directory where I expected it to be. The deploy log was not very helpful except that there was no mention of "abc-app" in it. I'm not sure if it should have it though.

So next I created the following JSON which explicitly sets the "deploy_to" attribute as described at http://docs.aws.amazon.com/opsworks/latest/userguide/attributes-json-deploy.html

{
    "deploy" : {
        "abc_app" : {
            "deploy_to" : "/var/www/html"
        }
    }
}

Once again, the deployment finished successfully, but the code is still not at /var/www/html or anywhere else.

Any ideas or suggestions would be very much appreciated!

回答1:

The issue here is that you're using a custom layer, which is absolutely ok, you just need a custom deploy recipe which tells opsworks how to deploy your application.

To deploy apps to a custom layer, you must implement custom Deploy recipes that download the app's files from a repository to the appropriate location on the instance. However, you can often limit the amount of code you must write by using the built-in deploy cookbook to handle some aspects of deployment.

http://docs.aws.amazon.com/opsworks/latest/userguide/create-custom-deploy.html

Hope this helps.