Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

startup-script does not get invoked on the remote VM instance #466

Closed
kaushalshriyan opened this issue May 13, 2020 · 4 comments
Closed
Labels
question Further information is requested

Comments

@kaushalshriyan
Copy link

Hi,

When I ran the below command, the startup-script does not get invoked on the remote VM instance.

bazel run cmd/apply:apply -- --config_path=config.yaml --projects=ghcdrupalproject

cat config.yaml
# Copyright 2019 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.

# This sample configuration provides the minimum configuration required by the DPT scripts.
# Audit resources will be created locally in the project.
overall:
  organization_id: '752989131665'
  billing_account: 01B8CG-A6J720-GF5JC6
  domain: example.com

generated_fields_path: ./generated_fields.yaml

projects:
- project_id: ghcdrupalproject
  owners_group: ghcdrupalproject-owners@example.com
  auditors_group: ghcdrupalproject-auditors@example.com
  audit:
    logs_bigquery_dataset:
      dataset_id: digitalapicraft_ghcdrupalproject001_logs  # Bigquery Dataset names must use underscores.
      location: US
  devops:
    state_storage_bucket:
      name: digitalapicraft-ghcdrupalproject-state
      location: US
  compute_firewalls:
  - name: ghcdrupal-firewall
    network: default
    allow:
      protocol: "tcp"
      ports: ["22","80","443"]
  compute_instances:
  - name: ghcdrupalinstance
    zone: us-central1-a
    machine_type: n1-standard-2
    boot_disk:
      initialize_params:
        image: centos-cloud/centos-7-v20200309
    network_interface:
      network: default
      access_config: {}
    metadata:
      startup-script: "yum -y install git.x86_64; cd /opt; touch /root/.gitcookies; chmod 0600 /root/.gitcookies; git config --global http.cookiefile /root/.gitcookies tr , \\t <<\__END__ >>/root/.gitcookies source.developers.google.com,FALSE,/,TRUE,2147483647,o,git-kaushal.example.com=UV0cSkzM9t4BCjjy6VwnqDO3m-F3BbJbDSgkL9qNx8VzUaiLna3yvvvG92miujo __END__; git clone https://source.developers.example.com/p/dacthir/r/testhealth portalCode; cd /opt/portalCode/scripts; sh -xv /opt/portalCode/scripts/installnginxmariadbdrupalghc.sh"
    service_account:
      email: ghcdrupalprojectowner@ghcdrupalproject.iam.gserviceaccount.com
      scopes:
      - cloud-platform

@stevei101
Copy link

stevei101 commented May 13, 2020 via email

@kaushalshriyan
Copy link
Author

/usr/local/bin/bazel run cmd/apply:apply -- --config_path=config.yaml --projects=ghcdrupalproject

The below one does not get executed on the newly spawned instance in GCP.

metadata:
      startup-script: "yum -y install git.x86_64; cd /opt; touch /root/.gitcookies; chmod 0600 /root/.gitcookies; git config --global http.cookiefile /root/.gitcookies tr , \\t <<\__END__ >>/root/.gitcookies source.developers.google.com,FALSE,/,TRUE,2147483647,o,git-kaushal.example.com=UV0cSkzM9t4BCjjy6VwnqDO3m-F3BbJbDSgkL9qNx8VzUaiLna3yvvvG92miujo __END__; git clone https://source.developers.example.com/p/dacthir/r/testhealth portalCode; cd /opt/portalCode/scripts; sh -xv /opt/portalCode/scripts/installnginxmariadbdrupalghc.sh"

Please suggest further

@stevei101
Copy link

stevei101 commented May 13, 2020 via email

@xingao267
Copy link
Member

@kaushalshriyan is the VM created? If you go to that VM, do you see your startup-script shown under Custom metadata?

@nikklassen nikklassen added the question Further information is requested label Jul 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants