Skip to content

googleinterns/recomator

Repository files navigation

Recomator

This is not an officially supported Google product.

Google Cloud Platform shows recommendations for underutilized/overutilized resources. Recomator extends these functionalities by allowing to also apply recommendations with one click and by giving an overview of recommendations for all projects. Customers will be able to deploy a premade package on one of the serverless solutions and run it in AppEngine in their own GCP account.

Frontend config

src/config.ts contains two web addresses that you should provide: For testing purposes (using npm run serve), use the first one. For production (npm run build), use the second one.

  public static DEVELOPMENT_BACKEND_ADDRESS = "http://dev.yourbackend.com";
  public static PRODUCTION_BACKEND_ADDRESS = "http://yourbackend.com";

Frontend commands

Note: The following commands need to be run in the ./frontend/ directory:

Install dependencies

npm install

Compile and hot-reload for development

npm run serve

Compile and minify for production

npm run build

Run your unit tests

npm run test:unit

Lint and fix files

npm run lint

Customize Vue configuration

See Configuration Reference.

How to deploy

Create your application on App Engine

  • Choose preferred region, language - Go, environment - standard.

Install Google Cloud SDK

Note that you don’t need to install it, if you are using Cloud Shell. Otherwise, to install you need to follow this tutorial https://cloud.google.com/sdk/docs/install

Create the directory

Run the following commands:

git clone https://github.com/googleinterns/recomator
cd recomator
gcloud init 

You will be asked to choose an account and project. Choose the project in which you created the app.

Now run

gcloud app describe | grep defaultHostname

You will see the value of defaultHosthame (your future app address).

Copy it, you’ll need it in the next step.

Create credentials

  • Go to APIs & Services -> OAuth consent screen.

  • Choose your app’s name, support email.

  • Click Add domain and add the address of your app (from previous section, last step).

  • Add developer’s email address and click Save & continue.

  • Add scopes:

.../auth/userinfo.email
.../auth/cloud-platform
  • Click Save, then Back to dashboard.

  • Go to Credentials-> Create Credentials -> OAuth client ID

  • Choose Web application

  • Add authorized URI: https://<YOUR APP ADDRESS>/auth, where <YOUR APP ADDRESS> is the address of your application.

  • Copy clientID and clientSecret.

Deploy the app

  • Install npm https://www.npmjs.com/get-npm
  • Go to your app directory (the one where you cloned the recomator repository).
  • Set up some environmental variables:
export CLIENT_ID=<YOUR CLIENT ID>
export CLIENT_SECRET=<YOUR CLIENT SECRET>
export APP_ADDRESS=<YOUR ADDRESS>
  • Set up configs:
echo "{\"clientID\":\"$CLIENT_ID\",\"clientSecret\":\"$CLIENT_SECRET\",\"redirectURL\":\"https://$APP_ADDRESS/auth\"}" > config.json
echo "VUE_APP_BACKEND_ADDRESS=https://$APP_ADDRESS/api" > frontend/.env
  • Build frontend:
cd frontend
npm install
npm run build
  • Deploy the app:
cd ..
cat deploy_gcloudignore.txt >> .gcloudignore
gcloud app deploy

Source Code Headers

Every file containing source code must include copyright and license information. This includes any JS/CSS files that you might be serving out to browsers. (This is to help well-intentioned people avoid accidental copying that doesn't comply with the license.)

Apache header:

Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •