Skip to content

AppScale on Google Compute Engine

Meni Vaitsi edited this page May 14, 2016 · 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.

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

  1. Begin by logging into the Google Developers Console
  2. Select the project ID you want to start with.
  3. Navigate to the API Manager.
  4. Next, go to the Credentials section.
  5. Click Create credentials and choose OAuth client ID.
  6. Set the Application type to Other. It may ask you to configure a consent screen before completing this step.
  7. Download your newly created OAuth 2.0 client ID and note where you saved this JSON file.

Step 2: Add the AppScale image to your repository

  1. Via the GCP web console

  2. Via the CLI:

Install gcloud and confirm that you are able to communicate with Google Compute Engine. Set your login credentials:

$ gcloud auth login
$ gcloud config set project VALUE

Test to make sure gcloud is configured properly:

$ gcloud compute instances list

Next, add the AppScale image to your image repository. You can find a link to the latest GCE Image here:

$ gcloud compute images create appscale-X-Y-Z --source-uri <Public GCE Image URI>

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 the AppScalefile 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-X-Y-Z'

Make sure that you've selected a valid GCE availability zone:

zone: 'us-central1-a' # For Google Compute Engine

Set your Project ID (not your Project Name or Project Number):

project: 'project-id-here'

Include the location to the client secrets you downloaded in Step 1:

client_secrets: '~/my-client-secrets.json'

Optionally, use a static IP if you require one:

static_ip: 1.2.3.4

Start AppScale

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 over the gce cloud.
Verifying that SSH key exists locally
Starting 1 machines with machine id appscale-X-Y-Z, 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

Deploy an app

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 persisting 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