Git Product home page Git Product logo

Comments (31)

David-Promevo avatar David-Promevo commented on July 28, 2024

Hello,

You'll need to repull the code from github, it didn't get everything the first time.

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

@David-Promevo
Hi there,
I actually did a whole new repull of all the code, and started from scratch last night.
I'm pulling from "master" branch, if that makes a difference.
Thanks,

from loaner.

githerbert avatar githerbert commented on July 28, 2024

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

Alright, i'll try to do another repull.
Did you also see the note about k8-py3-fastbuild?
../bazel-out/k8-py3-fastbuild/bin/loaner/deployments/deploy_impl
i had to change this to:
../bazel-out/darwin-py3-fastbuild/bin/loaner/deployments/deploy_impl \

thanks,

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

Did another pull from master, and go the same end result.
Should i just try using Alpha 0.7.1?
Thanks,

from loaner.

David-Promevo avatar David-Promevo commented on July 28, 2024

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

Hello,
We did another pull from Alpha 0.7.1 (did pull, and downloaded to a zip)and updated all the config files.
Was able to do a successful deployment, but I still see the same errors for the cron job failing user sync.
I could be missing a step. Please let me know what other screen shot/logs I can provide.

from loaner.

templesnr avatar templesnr commented on July 28, 2024

Did you also see the note about k8-py3-fastbuild?
../bazel-out/k8-py3-fastbuild/bin/loaner/deployments/deploy_impl
i had to change this to:
../bazel-out/darwin-py3-fastbuild/bin/loaner/deployments/deploy_impl \

I built from scratch using the Master branch - I didn't touch anything after line 57 in deploy.sh so I definitely didn't have to change line 248 onwards. Aren't the k8-py3-fastbuild folders created automatically during the build process?
The Master branch does have improved diagnostic information in the Chrome app, which are helpful - and it did build properly once I sorted out the handful of mistakes that were made while we were going through the setup documents. I'd recommend to persevere and get the Master build working if you can.
Oh, just one small thing. I did go through the docs in the Master branch's setup guide and build chrome app guide - as well as checking the user guide and gsuite config as I wanted to be sure that everything was as per the guides; there are slight differences in setup from the earlier commits. I especially got caught by the Admin changes in G-Suite, as I don't have full admin rights so I had to walk it through with one of our superadmins.

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

@templesnr
I'll try again to do a new build from "scratch" using master branch?
Are you saying to use: "git clone -b master https://github.com/google/loaner.git"?

I have only been removing my build versions from google cloud console, Should I be taking additional action on the google cloud side of things?
I've reverted back to my last successful build back in Dec 21st.
I'm willing to start over completely from scratch( build new machine, build new google project), basically what ever it will take at this point, but don't want to waste much more time.
I did 3 re-deployments yesterday for Alpha 0.7.1 to be completely sure I didn't miss any steps. I still ended up with the same results of a failing cron job for user roles sync.
Thanks for any assistance you can provide.

from loaner.

templesnr avatar templesnr commented on July 28, 2024

Hi @gyoshi02, I downloaded the zip and extracted it to a new subfolder. I'm using Linux. Then I followed setup_guide and deploy_chrome_app. I double and triple checked the permissions/groups and the json keys. I didn't re-create them if they were correct. All checked the app id etc., etc.
I ran the build Web app and then migrated the services as per the instructions.
I have made provision for a dev and prod version but I decided to use exactly the same settings for dev and prod - then build as prod. I'm convinced that the build is different when I built dev, but I can't be sure. All I know is that building as prod worked.
Similarly for the chrome app - make sure key is correct and id. I didn't realise it really does take more than 30 minutes before the app has been deployed, so you have to be patient.
I also didn't work out how to access the Web app in the browser using the. myloaner.appspot.com url until very late on.

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

@templesnr
Ah, I'm using Mac, so I think I need to use "darwin-py3-fastbuild."
I'm going through the re-deployment now, but I didn't use Zip, i used a pull from master.
I noticed a couple of places where either the documentation has changed, or I made an assumption.
loaner/web_app/constants.py
APP_NAME =
I had this set to my project name, but I've left it alone this time.
CHROME_APP_CLIENT_ID=
I had this set to my Chrome App info, as I've already done that part.
I'll leave it blank for this attempt.

shared/config.ts
STANDARD_ENDPOINTS:
I didn't update anything here, but worried that I may be missing this step.

Thanks,

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

So just re-did everything using Zip files.
Same issue:
"ERROR: get_user_email failed: No user account detected."

Here's the full log that still shows:
2019-01-27 14:28:57.886 PST
[Errno 2] No such file or directory: '' (/base/alloc/tmpfs/dynamic_runtimes/python27g/f612b68945952bd1/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py:1552)
Traceback (most recent call last):
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/f612b68945952bd1/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1535, in call
rv = self.handle_exception(request, response, e)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/f612b68945952bd1/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1529, in call
rv = self.router.dispatch(request, response)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/f612b68945952bd1/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/f612b68945952bd1/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 1102, in call
return handler.dispatch()
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/f612b68945952bd1/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/base/alloc/tmpfs/dynamic_runtimes/python27g/f612b68945952bd1/python27/python27_lib/versions/third_party/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/base/data/home/apps/mgng-loaner-project/-20190127.415706629264038896/loaner/web_app/backend/handlers/cron/sync_user_roles.py", line 31, in get
sync_users.sync_user_roles()
File "/base/data/home/apps/m
gng-loaner-project/domain-20190127.415706629264038896/loaner/web_app/backend/lib/sync_users.py", line 34, in sync_user_roles
client = directory.DirectoryApiClient(constants.ADMIN_EMAIL)
File "/base/data/home/apps/mgng-loaner-project/domain-20190127.415706629264038896/loaner/web_app/backend/clients/directory.py", line 73, in init
self._client = self._create_directory_service(user_email)
File "/base/data/home/apps/m
gng-loaner-project/domain-20190127.415706629264038896/loaner/web_app/backend/clients/directory.py", line 92, in _create_directory_service
subject=constants.ADMIN_EMAIL)
File "/base/data/home/apps/mgng-loaner-project/domain-20190127.415706629264038896/external/gcloud_auth_archive/google/oauth2/service_account.py", line 209, in from_service_account_file
filename, require=['client_email', 'token_uri'])
File "/base/data/home/apps/m
gng-loaner-project/domain-20190127.415706629264038896/external/gcloud_auth_archive/google/auth/_service_account_info.py", line 71, in from_filename
with io.open(filename, 'r', encoding='utf-8') as json_file:
IOError: [Errno 2] No such file or directory: ''

Again, I'm building from a Mac.
Please let me know if something has changed, and I need to switch to Linux.
Thanks,

from loaner.

templesnr avatar templesnr commented on July 28, 2024

Please let me know if something has changed, and I need to switch to Linux.

No - I think the instructions say we can develop on Mac or Linux

I'm on my way to work so I don't have the code with me. Did you make sure you whitelisted the API.?. https://github.com/google/loaner/blob/master/docs/deploy_chrome_app.md#step-5-whitelist-the-api-to-bypass-oauth-prompts

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

@templesnr
Hey, I forgot to mention that I've got a working deployment from 12/20/2018, with everything working, but my devices kept enrolling into the Dev OU, and not the Prod Ou, so I've been trying to fix that.
I've reverted back to the older deployment from 12/20/2018, and the cron job for user roles completes.
I'd still like to be using the latest code, and fix the issue with where machines get enrolled.
Thanks,

from loaner.

templesnr avatar templesnr commented on July 28, 2024

the jump from 0.7.1 to Master shouldn't be difficult, as you have a working version - there are changes to one or two of the constant names though, so it's important to go through the setup and make the changes in the new, clean, files in the loaner folders, rather than copy the constants.py etc., files to the new folders. The devices are definitely enrolled into the correct OU in Master.
I don't fully trust the building of dev/QA/prod (no insult intended to the developers!) ... so I decided to always build Prod, rather than dev or QA. I'll probably try to build Dev once Prod goes live.

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

So after re-reading the docs, and reading what @templesnr said, i updated my constants.py file to have the path to the Json for Dev, QA, and Local. So, they are all using the same file.
I'm only deploying to Prod, so not sure why this would cause an error.
I was under the impression that if I wanted to deploy just to prod, I could leave the remaining sections blank.
thanks,

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

So I've got through all of the docs, and checked all of the files that are referenced in the setup_guide.
I've only run the command:
"bash deployments/deploy.sh web prod"
My devices unenroll and go into the OU that I've specified.
When I enroll/re-enroll a device, It goes into Dev, instead of Prod.
I've unenrolled/re-enrolled 3 of our test devices, and its the same behavior.
image

Is there any where else that I can check/confirm that I've set this correct.
Do I need to start over with a whole new project on the Google Cloud console at this point?
Thanks,

from loaner.

David-Promevo avatar David-Promevo commented on July 28, 2024

from loaner.

templesnr avatar templesnr commented on July 28, 2024

@gyoshi02 - your questions are beyond my competence, I'm afraid. Sorry. Hav you tried to ask the Group? https://groups.google.com/forum/m/?utm_medium=email&utm_source=footer#!forum/loaner

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

Hi,
Yep, I've changed all 4 services to be using the latest version:
image
Thanks,

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

Another thing I'm noticing, when I do shelf audits, I'm always seeing all 4 of the devices I have enrolled.
Its like they are never leaving the shelf. In previous versions of this app being deployed, I would have to re-assign devices to the shelf when they are supposed to returned.
Please let me know what other info I can provide.
Thanks,

from loaner.

templesnr avatar templesnr commented on July 28, 2024

I'm using the Master version - when I check a shelf, I can see the chromebooks that were assigned to that shelf under the heading "Devices on ICT Loaners" (ICT Loaners is the shelf name). If I click on one of the device rows, it drills-down showing the full device and any loan information i.e. Device model, asset tag, assigned to, current shelf (I've noticed the current shelf is blank, but we already have the shelf), due date, status, last known healthy, assignment date. I've only got two devices enrolled at the moment though - one on loan and the other "on the shelf"

from loaner.

helfrichmichael avatar helfrichmichael commented on July 28, 2024

@gyoshi02 the OU's are derived within web_app/constants.py. The logic to decide which release track it is on is determined at https://github.com/google/loaner/blob/master/loaner/web_app/constants.py#L75 to https://github.com/google/loaner/blob/master/loaner/web_app/constants.py#L81.

Do you feel comfortable sharing your constants.py file? You can hide the client ID's if you'd like or make the content a bit more generalized. There's a possibility that your application URLs/IDs are too similar or the same somewhere.

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

@helfrichmichael
Not sure if you read the previous posts above, but I was trying build with a constants.py that only had information for my Prod version. The first version (that was failing to sync user roles) only had info for Pord. I have then updated to contain all info for Prod, Dev, QA, (even though these projects have not been created yet.
Here's a copy of my current constsants.py file

'

Copyright 2018 Google Inc. All Rights Reserved.

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

http://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.

"""App constants to be set before deployment."""

from future import absolute_import
from future import division
from future import print_function

import os
import jinja2

from google.appengine.api import app_identity

import endpoints

from loaner.web_app.backend.models import template_model

The application id for this project otherwise known as the Google Cloud

Project ID.

APPLICATION_ID = os.environ.get('APPLICATION_ID', None)

Whether or not the application is running on the dev_appserver.

ON_LOCAL = (
os.getenv('SERVER_SOFTWARE') and
os.getenv('SERVER_SOFTWARE').startswith('Development/'))

Whether or not the application is running on Google App Engine.

ON_GAE = (
os.getenv('SERVER_SOFTWARE') and
os.getenv('SERVER_SOFTWARE').startswith('Google App Engine/'))

################################################################################

Everything in this comment block must be configured before the app can be

built and deployed, see the developer docs for more detail.

This is the friendly name of the application that will be displayed to users

of this application as the title of the Web App.

APP_NAME = 'Grab n Go'

The top level domain for the GSuite accounts used in this application.

APP_DOMAINS = 'gtest2.**********.com'

The GSuite Customer ID this application will interact with, if nothing is

provided it will default to the helper string 'my_customer'.

NOTE: using my_customer is an approved method for the used APIs.

CUSTOMER_ID = ('' or 'my_customer')

The absolute path to config_defaults.yaml.

CONFIG_DEFAULTS_PATH = (
os.path.join(os.path.dirname(file), 'config_defaults.yaml'))

Setup of Jinja2 Enviorment for serving backend/static_content templates.

JINJA = jinja2.Environment(
autoescape=True, loader=jinja2.FileSystemLoader(
os.path.join(os.path.dirname(file), 'backend/static_content')))

Variables defining different deployment environments, place the Google Cloud

Project ID for each environment on the appropriate line.

NOTE: These must match the Google Cloud Project ID's in the

//loaner/deployments/deploy.sh file for DEV, QA, and PROD respectively.

ON_PROD = ON_GAE and ('GnG-Loaner-Project' in APPLICATION_ID)

If you are using a QA server fill out the Google Cloud Project ID below.

ON_QA = ON_GAE and ('qa-app-engine-project' in APPLICATION_ID)

If you are using a DEV server fill out the Google Cloud Project ID below.

ON_DEV = ON_GAE and ('dev-app-engine-project' in APPLICATION_ID)

Maintenance mode, serves a splash page when the app is under maintenance.

MAINTENANCE = False

The email address of the GSuite Admin to use for Domain Wide Delegated

Authority for access to the Google Admin SDK Directory API.

NOTE: The account used here must at least have access to the OAuth2 Scopes

listed below in the DIRECTORY_SCOPES variable.

ADMIN_EMAIL = 'svc-loaner-role2@gtest2.********.com'

The email address application emails will come from.

SEND_EMAIL_AS = 'svc-loaner-role2@gtest2.********.com'

superadmins_group: str, The name of the Google Group that governs who is

a superadmin. Superadmins have all permissions by default.

SUPERADMINS_GROUP = 'cbloanertest@gtest2.********.com'

The PROD server specific configurations.

if ON_PROD:

The OAuth2 Client ID for the Chrome Application.

CHROME_CLIENT_ID = 'MyProdChromeClientID******************************************'

The OAuth2 Client ID for the Web Application Frontend.

WEB_CLIENT_ID = 'MyProdWEBClientID******************************************'

The location of the Client Secrets file relative to the Bazel WORKSPACE for

the Directory API Service Account with Domain Wide Delegated privilage.

i.e. loaner/web_app/client-secret.json

SECRETS_FILE = 'loaner/web_app/client-secret.json'

The parent Org Unit this application will use to move devices within. This

Org Unit should contain the configuration specific to ALL Grab n Go Loaner

devices.

PARENT_ORG_UNIT = 'Grab n Go/Prod'
elif ON_QA:
CHROME_CLIENT_ID = 'MyProdChromeClientID******************************************'
WEB_CLIENT_ID = 'MyProdWEBClientID******************************************'
SECRETS_FILE = 'loaner/web_app/client-secret.json'
PARENT_ORG_UNIT = 'Grab n Go/QA'

The DEV server specific configurations.

elif ON_DEV:
CHROME_CLIENT_ID = 'MyProdChromeClientID******************************************'
WEB_CLIENT_ID = 'MyProdWEBClientID******************************************'
SECRETS_FILE = 'loaner/web_app/client-secret.json'
PARENT_ORG_UNIT = 'Grab n Go/Dev'

The LOCAL server specific configurations.

else:
CHROME_CLIENT_ID = 'MyProdChromeClientID******************************************'
WEB_CLIENT_ID = 'MyProdWEBClientID******************************************'
SECRETS_FILE = 'loaner/web_app/client-secret.json'
PARENT_ORG_UNIT = 'Grab n Go/Dev'

When set to True the Application will Bootstrap, performing initialization of

the application. On first deployment this should be set to True, for all

following deployments this should be set to False.

BOOTSTRAP_ENABLED = False
################################################################################

if ON_LOCAL:
ORIGIN = 'localhost:8080'
ENDPOINTS_HOSTNAME = 'localhost:8081'
elif ON_PROD or ON_DEV or ON_QA:
ORIGIN = app_identity.get_default_version_hostname()
ENDPOINTS_HOSTNAME = 'endpoints-dot-{}'.format(ORIGIN)
else:
ORIGIN = ''
ENDPOINTS_HOSTNAME = ''

PROJECT_ROOT = os.path.dirname(file)
FRONTEND_ROOT = os.path.join(PROJECT_ROOT, 'frontend', 'src')
ANGULAR_TEMPLATE = 'index.html'
ANGULAR_TEMPLATE_PATH = os.path.join(FRONTEND_ROOT, ANGULAR_TEMPLATE)
COMPILED_JS_PATH = os.path.join(FRONTEND_ROOT, 'application.js')

The OAuth2 Client ID's that are allowed to access the Endpoints API's

configured in the endpoints.py and chrome.py files.

ALLOWED_CLIENT_IDS = (
CHROME_CLIENT_ID, WEB_CLIENT_ID, endpoints.API_EXPLORER_CLIENT_ID,
)

OAuth2 Scopes to request when an application user authenticates to the web

frontend.

ROOT_SCOPES = (
'https://www.googleapis.com/auth/userinfo.email',
)

OAuth2 Scopes for the Directory API client and the configured admin account.

DIRECTORY_SCOPES = (
'https://www.googleapis.com/auth/admin.directory.device.chromeos',
'https://www.googleapis.com/auth/admin.directory.group.member.readonly',
'https://www.googleapis.com/auth/admin.directory.orgunit',
'https://www.googleapis.com/auth/admin.directory.user.readonly',
)

Dictionary defining where Grab n Go Loaner devices will be moved to enable and

disable guest mode if guest mode is permitted for this version.

NOTE: whether Guest Mode is allowed is configured in config_defaults.yaml.

ORG_UNIT_DICT = {
'DEFAULT': PARENT_ORG_UNIT + '/Default',
'GUEST': PARENT_ORG_UNIT + '/Guest Enabled',
}

CHROME_FIELDS_MASK = 'deviceId,serialNumber,model,orgUnitPath'
CHROME_LIST_FIELDS_MASK = (
'chromeosdevices(deviceId,serialNumber,model,orgUnitPath)')
GROUP_MEMBER_FIELDS_MASK = 'members/email,nextPageToken'
USER_NAME_FIELDS_MASK = 'name/givenName'
ORG_UNIT_FIELDS_MASK = 'name'

XSRF_TOKEN_TIMEOUT = 8 * 60 * 60 * 10**6 # 8 hours in microseconds.
XSRF_ACTION_ID = ''
XSRF_HEADER = 'X-XSRF-TOKEN'
XSRF_COOKIE_NAME = 'XSRF-TOKEN'
XSRF_PARAM = 'xsrf_token'
XSRF_EXEMPT_METHODS = frozenset(['GET', 'HEAD'])

BIGQUERY_DATASET_NAME = 'loaner'
BIGQUERY_DEVICE_TABLE = 'Device'
BIGQUERY_SHELF_TABLE = 'Shelf'
BIGQUERY_SURVEY_TABLE = 'Question'
BIGQUERY_ROW_TIME_THRESHOLD = 15 # Minutes.
BIGQUERY_ROW_SIZE_THRESHOLD = 50 # Rows.
BIGQUERY_ROW_MAX_BATCH_SIZE = 500 # Rows.

DEFAULT_ACTING_USER = 'Loaner Role'

TEMPLATE_LOADER = template_model.TemplateLoader()

Search constants.

DEVICE_INDEX_NAME = 'device_index'
SHELF_INDEX_NAME = 'shelf_index'

'

from loaner.

helfrichmichael avatar helfrichmichael commented on July 28, 2024

If I had to guess quickly looking at this, it might be because your PROD project is currently defined as "GnG-Loaner-Project" not as gng-loaner-project. I'm not 100% certain, but case-sensitivity could be the culprit here. Can you try modifying this, deploying, and updating the serving versions for all of the services?

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

@helfrichmichael
I can try that now.
However, in Google Cloud Platform that's the project name:
image
I'll redeploy now.
Thanks,

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

So, as I was double checking my Constants.py, I figured I should update the other files that have this mentioned. It looks like config.ts and deploy.sh are both using lower case, so maybe this is the issue.
Still going through deployment now.

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

So, Seems to be working as it was in my prior deployments.
I removed and re-enrolled devices, and they are now showing up in the correct OUs.

from loaner.

helfrichmichael avatar helfrichmichael commented on July 28, 2024

That's great. It might be something for us to look into adding to our documentation.

If all is resolved, let us know and we'll close this issue.

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

I still wanted to deploy once more, with just prod values.
I'll attempt that later this evening, and let you know what happens.
Thanks,

from loaner.

gyoshi02 avatar gyoshi02 commented on July 28, 2024

I was able to re-deploy using an updated constants.py file which only contained the information for the Prod project. I did have to leave the info about where the client-secret.json was located.
We can close this request.
Thanks for all the assistance.
Thanks,

from loaner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.