Iguy
Iguy

Reputation: 711

How can I move my application across spaces in Bluemix?

I have a couple of apps running in my own Bluemix space and I want to shift them into a different space that we use for integration purposes.

I can see no option in any part of the Bluemix UI to do this. Is there a recommended way to make the move or even to copy these apps to the new space?

Thanks.

Upvotes: 2

Views: 1368

Answers (4)

TeeMee123
TeeMee123

Reputation: 161

Due to a recent update, now you should use ibmcloud cf ... instead of plain cf ...

So this means

ibmcloud cf target -s <my space name> ibmcloud cf push <my app name>

Also, you might need to change the route-path, with --route-path ....

Upvotes: 0

Arun
Arun

Reputation: 55

Another option is to write a script to download the files from cloud foundry from your source space using cf-download plugin. Plugin can be installed using this command: cf install-plugin cf-download -r CF-Community

Use the following command to download the app from Bluemix: cf download

A script can be written to download using the plugin and then use the cf command to upload to the target space.

Some words of caution: 1) download might get some files, which are not really needed for upload. Use .cfignore file to upload only what is needed. Listed files in .cfignore will be ignored by the cf cli. 2) Generally plugins should be used with care. Changes in the platform could affect the way plugins work.

Upvotes: 1

Ram Vennam
Ram Vennam

Reputation: 3546

How about a bash script?

#!/bin/bash

    APP_NAME=$1
    OLD_SPACE=$2
    NEW_SPACE=$3

    cf target -s $OLD_SPACE
    cf delete $APP_NAME -f
    cf target -s $NEW_SPACE
    cf push $APP_NAME

Upvotes: 1

Iguy
Iguy

Reputation: 711

Apps cannot be moved or copied from one Bluemix space to another. Where they are built is where they stay until they are removed.

However you can deploy an app in multiple spaces by first Switching to the space where the existing app is to be deployed by using:

cf target -s <my space name>

Then deploying the app using:

cf push <my app name>

I'm unaware of any limits to how many spaces an app can be deployed to (I'm inferring as many as I'd like). If anyone has additional information on that point please add it here.

Upvotes: 5

Related Questions