Skip to content
This repository has been archived by the owner on Sep 3, 2022. It is now read-only.

Commit

Permalink
Merge pull request #801 from GoogleCloudPlatform/gcloud
Browse files Browse the repository at this point in the history
Added back support for mapping in gcloud config. This is not used by …
  • Loading branch information
Graham Wheeler committed Apr 21, 2016
2 parents 0ea72a0 + b9eedb6 commit c59caf3
Show file tree
Hide file tree
Showing 12 changed files with 5 additions and 41 deletions.
3 changes: 0 additions & 3 deletions containers/datalab/Dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,10 @@ RUN wget -nv https://dl.google.com/dl/cloudsdk/release/google-cloud-sdk.zip && \
component_manager/fixed_sdk_version 102.0.0 && \
tools/google-cloud-sdk/bin/gcloud -q components update \
gcloud core bq gsutil compute preview alpha beta && \
rm -rf /root/.config/* && \
ln -s /root/.config /config && \
touch /tools/google-cloud-sdk/lib/third_party/google.py

# Container configuration
EXPOSE 8080
VOLUME [ "/notebooks" ]

# Path configuration
ENV PATH $PATH:/tools/node/bin:/tools/google-cloud-sdk/bin
Expand Down
10 changes: 0 additions & 10 deletions containers/datalab/content/run-debug.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@

# Runs the docker container locally.

# We use the presence of /root/.config to tell whether to show landing page.
# Running gcloud will create it in whatever volume we mapped in which may
# not be the user's home, so we guard against calling gcloud below unless
# it already exists.
if [ -d /root/.config/gcloud ]
then
PROJECT_ID=`gcloud -q config list --format yaml | grep project | awk -F" " '{print $2}'`
export DATALAB_PROJECT_NUM=`gcloud -q projects describe $PROJECT_ID | grep projectNumber | awk '{print substr($2,2,length($2)-2)}'`
fi

export DATALAB_INSTANCE_NAME=debug
export DATALAB_ENV=local

Expand Down
10 changes: 0 additions & 10 deletions containers/datalab/content/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@

# Runs the docker container locally.

# We use the presence of /root/.config to tell whether to show landing page.
# Running gcloud will create it in whatever volume we mapped in which may
# not be the user's home, so we guard against calling gcloud below unless
# it already exists.
if [ -d /root/.config/gcloud ]
then
PROJECT_ID=`gcloud -q config list --format yaml | grep project | awk -F" " '{print $2}'`
export DATALAB_PROJECT_NUM=`gcloud -q projects describe $PROJECT_ID | grep projectNumber | awk '{print substr($2,2,length($2)-2)}'`
fi

export DATALAB_INSTANCE_NAME=local
export DATALAB_ENV=local

Expand Down
1 change: 1 addition & 0 deletions containers/datalab/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ fi

docker run -it --entrypoint=$ENTRYPOINT \
-p 8081:8080 \
-v "$HOME/.config:/root/.config" \
-v "$CONTENT:/content" \
-e "PROJECT_ID=$PROJECT_ID" \
datalab
Expand Down
2 changes: 1 addition & 1 deletion sources/lib/api/gcp/context/_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Credentials(oauth2client.client.OAuth2Credentials):
"""OAuth credentials using auth tokens.
"""

_NODE_TOKEN_FILE = '/datalab/tokens.json'
_NODE_TOKEN_FILE = '/root/tokens.json'

def _get_token(self):
try:
Expand Down
6 changes: 0 additions & 6 deletions sources/web/datalab/common.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,6 @@ declare module common {
*/
instanceUser: string;

/**
* Id of the cloud project that the datalab instance runs in.
*/
projectId: string;
projectNumber: string;

release: string;
versionId: string;
instanceId: string;
Expand Down
2 changes: 0 additions & 2 deletions sources/web/datalab/jupyter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,6 @@ function responseHandler(proxyResponse: http.ClientResponse,
if ((path.indexOf('/tree') == 0) || (path.indexOf('/notebooks') == 0)) {
var templateData: common.Map<string> = {
feedbackId: appSettings.feedbackId,
projectNumber: appSettings.projectNumber,
projectId: appSettings.projectId,
versionId: appSettings.versionId,
instanceId: appSettings.instanceId,
instanceName: appSettings.instanceName,
Expand Down
4 changes: 2 additions & 2 deletions sources/web/datalab/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ let scopes = [
];

// Datalab config file for things like default project. If this doesn't exist the EULA hasn't been accepted.
let configFile = '/notebooks/.datalabconfig';
let configFile = '/root/.config/datalab';

let tokensFile = '/datalab/tokens.json'; // Where we store credentials.
let tokensFile = '/root/tokens.json'; // Where we store credentials.

/**
* The application settings instance.
Expand Down
3 changes: 0 additions & 3 deletions sources/web/datalab/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ export function loadSettings(): common.Settings {
settings.instanceId = metadata.instanceId;
settings.instanceName = process.env['DATALAB_INSTANCE_NAME'] || '';
settings.instanceUser = process.env['DATALAB_USER'] || '';
settings.projectId = process.env['DATALAB_PROJECT_ID'] || '';
settings.projectNumber = process.env['DATALAB_PROJECT_NUM'] || '';
settings.versionId = process.env['DATALAB_VERSION'] || '';
settings.metadataHost = process.env['METADATA_HOST'] || 'metadata.google.internal';
if (process.env['DATALAB_CONFIG_URL']) {
settings.configUrl = process.env['DATALAB_CONFIG_URL'];
}
Expand Down
2 changes: 0 additions & 2 deletions sources/web/datalab/templates/nb.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
data-notebook-name="<%notebookName%>"
data-notebook-path="<%notebookPath%>"
data-feedback-id="<%feedbackId%>"
data-project-num="<%projectNumber%>"
data-project-id="<%projectId%>"
data-version-id="<%versionId%>"
data-instance-id="<%instanceId%>"
data-instance-name="<%instanceName%>"
Expand Down
2 changes: 0 additions & 2 deletions sources/web/datalab/templates/tree.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
data-notebook-path="<%notebookPath%>"
data-terminals-available="False"
data-feedback-id="<%feedbackId%>"
data-project-num="<%projectNumber%>"
data-project-id="<%projectId%>"
data-version-id="<%versionId%>"
data-instance-id="<%instanceId%>"
data-instance-name="<%instanceName%>"
Expand Down
1 change: 1 addition & 0 deletions sources/web/datalab/updateDocs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function startUpdate(settings: common.Settings) {
childProcess.execSync('rm -r -f ' + docsDownloadDir, {env: process.env});
}
fs.mkdirSync(docsDownloadDir);
// TODO(gram): must replace this with a git clone.
var downloadCommand = 'gsutil -m cp -r ' + docsSourceGcsPath + ' ' + docsDownloadDir;
childProcess.exec(downloadCommand, {env: process.env}, function(err, stdout, stderr) {
if (err) {
Expand Down

0 comments on commit c59caf3

Please sign in to comment.