-
Notifications
You must be signed in to change notification settings - Fork 0
/
.env
99 lines (88 loc) · 4.23 KB
/
.env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
# Source helper functions
source .fun
# Project settings
## VERBOSE=true(default)|false - show commands prior to executing them
export VERBOSE=true
# AWS Region
export AWS_REGION=$(aws configure get region)
#EKS Configuration MANDATORY for EKS or Hyperpod EKS
CTX=$(kubectl config current-context | cut -d '/' -f 2)
if [ ! "$?" == 0 ]; then
echo ""
echo "Could not determine current EKS cluster, please specify cluster name in .env"
echo ""
export AWS_EKS_CLUSTER="specify EKS cluster name here"
else
export AWS_EKS_CLUSTER=$CTX
fi
#Input only if you have an EKS Hyperpod Cluster
export AWS_EKS_HYPERPOD_CLUSTER=""
#Name of hyperpod cluster can be determined automatically using the line below
#export AWS_EKS_HYPERPOD_CLUSTER=$(./Container-Root/ray/ops/hyperpod-name.sh)
# EKS or HyperpodEKS
# CLUSTER_TYPE=eks (default) OR CLUSTER_TYPE=hyperpod
if [ "$AWS_EKS_HYPERPOD_CLUSTER" == "" ]; then
export CLUSTER_TYPE=eks
else
export CLUSTER_TYPE=hyperpod
fi
# Proxy settings [optional] - set if your network requires a proxy to connect to the Internet
export http_proxy=
export https_proxy=
export no_proxy=localhost
# AWS settings
if [ -f ${HOME}/.aws/credentials ]; then
## AWS_PROFILE - name of AWS CLI settings profile to use AWS_PROFILE=default(default)|aws-do-eks|...
export AWS_PROFILE=default
fi
## If no AWS CLI credentials are configured, then the instance profile is in effect
## AWS_REGION - will be set to AWS_DEFAULT_REGION if not set externally.
export AWS_DEFAULT_REGION=us-west-2
export AWS_REGION=$(aws configure get region)
if [ "${AWS_REGION}" == "" ]; then
export AWS_REGION=$AWS_DEFAULT_REGION
fi
# Docker image settings
## REGISTRY: [optional] - Docker registry path including trailing "/". Example: registry.company.com/demo/
## If REGISTRY==default, then the default elastic container registry in the account for the current region will be used
export REGISTRY=default
## Set default registry if needed
if [ "$REGISTRY" == "default" ]; then
export REGION=${AWS_REGION}
export ACCOUNT=$(aws sts get-caller-identity --query Account --output text)
if [ "$ACCOUNT" == "" ]; then
export REGISTRY=""
else
export REGISTRY=${ACCOUNT}.dkr.ecr.${REGION}.amazonaws.com/
fi
fi
if [ -n "${REGISTRY}" ]; then
if [ "${REGISTRY: -1}" != "/" ]; then
export REGISTRY="${REGISTRY}/"
fi
fi
# Docker image settings
## IMAGE: <required> - Docker image name for this project. Example: myapp
export IMAGE=aws-do-ray
## VERSION: [optional] - Version tag for this Docker image. Example: v20180302
#export VERSION=v$(date +%Y%m%d)
export VERSION=v20241125
export TAG=$(if [ -z "${VERSION}" ]; then echo ""; else echo ":${VERSION}"; fi)
## BUILD_OPTS: [optional] - arguments for the docker image build command
export BUILD_OPTS="--build-arg http_proxy=${http_proxy} --build-arg https_proxy=${https_proxy} --build-arg no_proxy=${no_proxy}"
# Docker container runtime settings
## CONTAINER_NAME: [optional] - Name of the Docker container including the --name switch. Example --name myapp
export CONTAINER=${IMAGE}
export CONTAINER_NAME="--name ${CONTAINER}"
## Port map [optional] - Mapping of external to internal ports including the -p switch. Example -p 80:8080
export PORT_MAP="-p 80:8080 -p 8265:8265 -p 9090:9090 -p 8080:8080 -p 3000:3000 -p 8000:8000"
## Volume map [optional] - Mapping of external to internal paths including the -v switch. Example $(pwd):/wd
export VOL_MAP="-v ${HOME}/.aws:/root/.aws -v ${HOME}/.kube:/root/.kube -v $(pwd):/aws-do-ray -v $(pwd)/wd/conf:/ray/conf -v /var/run/docker.sock:/var/run/docker.sock"
## Network [optional] - Network name including the --net switch. Example --net mynet
export NETWORK=
## RUN_OPTS [optional] - additional options to specify with the run comman. Example -e POSTGRES_DB=dbname
export RUN_OPTS="-e http_proxy=$http_proxy -e https_proxy=$https_proxy -e no_proxy=$no_proxy -e AWS_EKS_CLUSTER=$AWS_EKS_CLUSTER -e AWS_PROFILE=$AWS_PROFILE -e AWS_REGION=$AWS_REGION -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN -e AWS_EKS_HYPERPOD_CLUSTER=$AWS_EKS_HYPERPOD_CLUSTER -e CLUSTER_TYPE=$CLUSTER_TYPE -e VERBOSE=$VERBOSE"
if [ -f ${HOME}/.aws/credentials ]; then
export RUN_OPTS="${RUN_OPTS} -e AWS_PROFILE=$AWS_PROFILE"
fi