AppScale on Google Compute Engine
Clone this wiki locally
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
- Begin by logging into the Google Developers Console
- Select the project ID you want to start with.
- Navigate to the API Manager.
- Next, go to the Credentials section.
- Click Create credentials and choose OAuth client ID.
- Set the Application type to Other. It may ask you to configure a consent screen before completing this step.
- 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
Via the GCP web console
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:
Also, indicate that you want to use the AppScale machine image you added:
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):
Include the location to the client secrets you downloaded in Step 1:
Optionally, use a static IP if you require one:
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 firstname.lastname@example.org Copying over local copy of AppScale from ~/appscale Head node successfully initialized at 22.214.171.124. It is now starting up cassandra. Copying over deployment credentials Starting AppController at 126.96.36.199 Please wait for the AppController to finish pre-processing tasks. Please wait for AppScale to prepare your machines for use. UserAppServer is at 188.8.131.52 Using default admin username/password Creating new user account email@example.com Creating new user account firstname.lastname@example.org Your XMPP username is email@example.com Granting admin privileges to firstname.lastname@example.org AppScale successfully started! View status information about your AppScale deployment at http://184.108.40.206: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 220.127.116.11: 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 18.104.22.168 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://22.214.171.124/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: email@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://126.96.36.199: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.
If you run into any problems, please send an email to us via the AppScale Community group or join us on #appscale on freenode.