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

Support instances without public IP for GCP #1341

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

smokfyz
Copy link
Contributor

@smokfyz smokfyz commented Jun 18, 2024

Closes #1321

@smokfyz smokfyz self-assigned this Jun 18, 2024
@smokfyz
Copy link
Contributor Author

smokfyz commented Jun 18, 2024

How to test?

  1. Go to https://console.cloud.google.com/hybrid/routers/list?referrer=search&authuser=2&project=dstack
  2. Create router
image
  1. Go to https://console.cloud.google.com/net-services/nat/list?authuser=2&project=dstack
  2. Create NAT
image
  1. Deploy local dstack server with config:
projects:
  - name: main
    backends:
      - type: gcp
        project_id: dstack
        creds:
          type: default
        public_ips: true
        regions: [europe-west1]
  1. Create dev environment with current branch dstack run . -f ./dev.dstack.yml
# dev.dstack.yml content
type: dev-environment
python: "3.11"
ide: vscode
  1. Using dev environment configure server on the remote server
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-480.0.0-linux-x86_64.tar.gz
tar -xf google-cloud-cli-480.0.0-linux-x86_64.tar.gz
./google-cloud-sdk/install.sh
./google-cloud-sdk/bin/gcloud init
./google-cloud-sdk/bin/gcloud auth application-default login
export GOOGLE_CLOUD_PROJECT=dstack
pip install -e ".[all]"
apt install vim -y
mkdir -p ~/.dstack/server && vim ~/.dstack/server/config.yml
dstack server --no-default
# ~/.dstack/server/config.yml
projects:
  - name: main
    backends:
      - type: gcp
        project_id: dstack
        creds:
          type: default
        public_ips: false
        regions: [europe-west1]
  1. Deploy test workload dstack run . -f ./test.dstack.yml
mkdir test && cd ./test
dstack config --url http://127.0.0.1:3000 --project main --token <server_token>
dstack init
vim test.dstack.yml
dstack run . -f ./test.dstack.yml

Workload example:

# ./test.dstack.yml
type: task

python: 3.11
backends: [gcp]
commands:
  - echo "Hello, world!" && sleep 10 && echo "Bye!"

@smokfyz smokfyz marked this pull request as ready for review June 18, 2024 13:58
@smokfyz smokfyz requested a review from r4victor June 18, 2024 13:58
Copy link
Collaborator

@r4victor r4victor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@smokfyz smokfyz merged commit 1000256 into master Jun 19, 2024
15 checks passed
@smokfyz smokfyz deleted the issue_1321_support_instances_without_private_ip_gcp branch June 19, 2024 06:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support provisioning instances without public IPs on GCP
2 participants