Skip to content

AppScale on Google Compute Engine

Navraj Chohan edited this page Feb 14, 2014 · 60 revisions

Deploying AppScale on Google Compute Engine

AppScale can deploy on Google Compute Engine to provide you with a quick, simple way to run AppScale on a public cloud. Follow the directions below to deploy AppScale on a single node in Compute Engine, or see a YouTube version of these directions.

Step 1: Create an 'Installed' OAuth2.0 Credential

  • Begin by logging into the Google Cloud Console
  • Select the project ID you want to start with.
  • Click on "API & auths".
  • Make sure that Google Compute Engine is set to "ON" in the APIs tab.
  • Next, click on "Credentials".
  • Click "CREATE NEW CLIENT ID", and choose "Installed Application" for the Application Type.
  • Make sure that the Installed Application Type is set to "Other" and click "Create Client ID".
  • You should see a new entry added called "Client ID for native application".
  • Click "Download JSON" and note where you download this file.

Step 2: Add the AppScale Image to Your Repository

Install gcutil and confirm that you are able to communicate with Google Compute Engine. Running "gcutil listinstances" is a good way to test this out. Next, add the AppScale 1.14.0 image to your image repository by running:

gcutil addimage appscale-1-14-0 gs://appscale-1-14-0/release.image.tar.gz

Step 4: Configure and start AppScale

In the machine on which the tools are installed, create an AppScale configuration file:

appscale init cloud

You only need to create this configuration file a single time. Modify this file so that only a single virtual machine is used:

min: 1
max: 1

Specify that you want to use Google Compute Engine:

infrastructure: 'gce'

Also, indicate that you want to use the AppScale machine image you added:

machine: 'appscale-1-14-0'

Finally, include your credentials:

# You can find this value at https://code.google.com/apis/console under "Project Name"
# Note: Do not set this to your project ID, you'll get errors from the tools if you do.
project: 'your project name'

# Set this to wherever you downloaded your client secrets in Step 1
client_secrets: '~/my_installed_client_secrets.json'

Optionally, use a static IP if you require one:

static_ip: 1.2.3.4

Next, start AppScale by running:

appscale up

And you should see output resembling the following:

$ appscale up
Your browser has been opened to visit:

    https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2F&response_type=code&client_id=projectid.apps.googleusercontent.com&access_type=offline

If your browser is on a different machine then exit and re-run this
application with the command-line parameter

  --noauth_local_webserver

Authentication successful.
No handlers could be found for logger "oauth2client.util"
Starting AppScale 1.14.0 over the gce cloud.
Verifying that SSH key exists locally
Starting 1 machines with machine id appscale-1-14-0, with instance type n1-standard-1, keyname appscale-key, in security group appscale-group
Waiting for your instances to start...
Started 1 on-demand instances in 39 seconds
Please wait for your instance to boot up.
Root login not enabled - enabling it now.
Log in to your head node: ssh -i /Users/you/.appscale/appscale-key.key root@173.255.114.30
Copying over local copy of AppScale from ~/appscale
Head node successfully initialized at 173.255.114.30. It is now starting up cassandra.
Copying over deployment credentials
Starting AppController at 173.255.114.30
Please wait for the AppController to finish pre-processing tasks.

Please wait for AppScale to prepare your machines for use.
UserAppServer is at 173.255.114.30
Using default admin username/password
Creating new user account test@example.com
Creating new user account test@173.255.114.30
Your XMPP username is test@173.255.114.30
Granting admin privileges to test@example.com
AppScale successfully started!
View status information about your AppScale deployment at http://173.255.114.30:1080/status

If you wish, you can navigate to this URL above to see the status of your AppScale deployment. Alternatively, you can see the status of your AppScale deployment via the tools by running appscale status, which tells us the following:

$ appscale status
Status of node at 173.255.114.30:
    Currently using 12.3 Percent CPU and 54.17 Percent Memory
    Hard disk is 44 Percent full
    Is currently: load_balancer, shadow, db_master, zookeeper, login, memcache, taskqueue_master, appengine
    Database is at 173.255.114.30
    Is in cloud: cloud1
    Current State: Preparing to run AppEngine apps if needed
    Hosting the following apps: none

View status information about your AppScale deployment at http://173.255.114.30/status

Next, you can deploy Google App Engine applications by running:

appscale deploy ~/path-to-your-app

And you should see output resembling the following:

$ appscale deploy ~/sample-apps/python/guestbook
Enter your desired e-mail address: test@example.com
Uploading initial version of app guestbook
We have reserved guestbook for your app
Creating remote directory to copy app into
Tarring application
Copying over application
Please wait for your app to start serving.
Your app can be reached at the following URL: http://173.255.114.30:8080

Navigate on your host machine's browser to this address to interact with your app.

Step 5: Shutting Down AppScale and Terminating your Instance

Shut down your apps and AppScale deployment by running:

appscale down

If you do not have disks attached then it will warn you of data loss. See Automated Data Persistence on persistencing data.

$ appscale down
About to terminate instances spawned with keyname appscale-key
No handlers could be found for logger "oauth2client.util"
Successfully shut down your AppScale deployment.

Clean up root disks which are created. Delete these disk via the cloud console or using gcutil.

Getting Help

If you run into any problems, please send an email to us via the AppScale Community group or join us on #appscale on freenode.

Clone this wiki locally