How to create/start an APP in quickest way


Stanley Shen <meteorping@...>
 

Hello, all

As we know, right now if we want to create an APP, we need push it to CF, which will cause us some time.
It needs to download buildpack, upload APP bits etc, it may takes several minutes.

We have scenario that we want to launch this APP for serveral instances, the only difference is that they are binding to different services, routes, right now we only push them separately.

But we do want to have a quick way to do that, do we have something like cloning an APP, and then just change something binding as we needed?

We can scale APP instance number by running "cf scale APP_NAME -i 3" for example, and I can see the other 2 instances are started soon after running this "scale" command, how we did that?


Daniel Mikusa
 

Have you looked at `cf copy-source`? You can use that to copy one app to
another. You could then change service bindings, environment variables and
scale the copy of the app separately. I believe you will still need to
stage the app though, at least if you change env variables or service
bindings it is recommended.

Dan

On Thu, May 5, 2016 at 6:40 AM, Stanley Shen <meteorping(a)gmail.com> wrote:

Hello, all

As we know, right now if we want to create an APP, we need push it to CF,
which will cause us some time.
It needs to download buildpack, upload APP bits etc, it may takes several
minutes.

We have scenario that we want to launch this APP for serveral instances,
the only difference is that they are binding to different services, routes,
right now we only push them separately.

But we do want to have a quick way to do that, do we have something like
cloning an APP, and then just change something binding as we needed?

We can scale APP instance number by running "cf scale APP_NAME -i 3" for
example, and I can see the other 2 instances are started soon after running
this "scale" command, how we did that?


Stanley Shen <meteorping@...>
 

yes, I looked at "copy-source".

copy-source - Make a copy of app source code from one application to another. Unless overridden, the copy-source command will restart the application.

cf copy-source test1 cc
FAILED
App cc not found

I tried it too, is seems it needs the target APP is an existed APP, or I did something wrong?


Daniel Mikusa
 

Correct. There's a couple ways you can create the target app. Push a
dummy app or use the API directly (i.e. `cf curl` [1]). Once you create
the target app, copy source will override whatever is in the target.

Dan

[1] - http://apidocs.cloudfoundry.org/236/apps/creating_an_app.html

On Thu, May 5, 2016 at 9:27 AM, Stanley Shen <meteorping(a)gmail.com> wrote:

yes, I looked at "copy-source".

copy-source - Make a copy of app source code from one application to
another. Unless overridden, the copy-source command will restart the
application.

cf copy-source test1 cc
FAILED
App cc not found

I tried it too, is seems it needs the target APP is an existed APP, or I
did something wrong?


Stanley Shen <meteorping@...>
 

Does this "copy-source" work for docker image?
I tried to copy-source on a docker image based APP, and it failed with errors like:

Copying source from app stanley1 to target app stanley2 in org stanley / space stanley as admin...
Note: this may take some time

FAILED
An unknown error occurred.