Skip to content

Commit 3a62425

Browse files
Merge pull request #1 from greg-the-coder/main
Sync AWS Workshop Development changes
2 parents 7b45c92 + 9b73b41 commit 3a62425

File tree

12 files changed

+417
-967
lines changed

12 files changed

+417
-967
lines changed

README.md

Lines changed: 138 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,141 @@
11
# aws-workshop-samples
2-
This project is currently underdevelopment, but meant to aid anyone that needs to quickly spin up Cloud Development Environments for Demos, Labs, Workshops, Hackathons, or simple POC's in AWS using [Coder](https://coder.com/cde). These templates and basic Coder admin scripts can be used in any Coder deployment, but are focused on using the [Coder AWS Marketplace](https://coder.com/docs/install/cloud/ec2) AWS EC2 single VM deployment.
2+
This project is designed to help you quickly spin up Cloud Development Environments for Demos, Labs, Workshops, Hackathons, or simple POC's in AWS using [Coder](https://coder.com/cde). These templates and basic Coder admin scripts can be used in any Coder deployment, but are focused on using either the [Coder AWS Marketplace](https://coder.com/docs/install/cloud/ec2) AWS EC2 single VM deployment or an AWS EKS deployment.
33

4-
1) Follow the steps in the [AWS EC2 Installation Guide](https://coder.com/docs/install/cloud/ec2). Complete the optional step to provide Developers EC2 Workspaces, as the AWS Specific templates provided rely on this capability. Login using the provided pubic IP, and setup your first Coder user.
5-
2) After successfully logging in, clone this Github repo locally so that the provided AWS Workshop Admin template can be uploaded.
4+
## Deployment Options
65

7-
[Under Development - Detailed Instructions for completing Setup]
6+
### Option 1: AWS EC2 Single VM Deployment
7+
8+
1) Follow the steps in the [AWS EC2 Installation Guide](https://coder.com/docs/install/cloud/ec2). Complete the optional step to provide Developers EC2 Workspaces, as the AWS Specific templates provided rely on this capability.
9+
2) Login using the provided public IP, and setup your first Coder user.
10+
3) After successfully logging in, clone this Github repo locally so that the provided AWS Workshop Admin template can be uploaded.
11+
12+
### Option 2: AWS EKS Deployment
13+
14+
This guide walks you through deploying Coder on AWS EKS for workshops or demonstrations.
15+
16+
#### Prerequisites
17+
- AWS Account with appropriate permissions
18+
- Latest versions of the following CLI tools installed:
19+
- AWS CLI
20+
- eksctl
21+
- kubectl
22+
- helm
23+
24+
#### Step 1: Create an EKS Cluster
25+
```bash
26+
# Create EKS Cluster (customize the cluster name and region as needed)
27+
eksctl create cluster --name=your-cluster-name --enable-auto-mode --region your-region
28+
```
29+
30+
#### Step 2: Configure Storage for the Cluster
31+
```bash
32+
# Deploy a K8S StorageClass for dynamic EBS volume provisioning
33+
kubectl apply -f - <<EOF
34+
apiVersion: storage.k8s.io/v1
35+
kind: StorageClass
36+
metadata:
37+
name: gp3-csi
38+
annotations:
39+
storageclass.kubernetes.io/is-default-class: "true"
40+
provisioner: ebs.csi.eks.amazonaws.com
41+
volumeBindingMode: WaitForFirstConsumer
42+
parameters:
43+
type: gp3
44+
encrypted: "true"
45+
allowVolumeExpansion: true
46+
EOF
47+
```
48+
49+
#### Step 3: Set Up Coder with PostgreSQL Database
50+
```bash
51+
# Create Coder namespace
52+
kubectl create namespace coder
53+
54+
# Install PostgreSQL using Helm
55+
helm repo add bitnami https://charts.bitnami.com/bitnami
56+
helm install coder-db bitnami/postgresql \
57+
--namespace coder \
58+
--set auth.username=coder \
59+
--set auth.password=coder \
60+
--set auth.database=coder \
61+
--set persistence.size=10Gi
62+
63+
# Create database connection secret for Coder
64+
kubectl create secret generic coder-db-url -n coder \
65+
--from-literal=url="postgres://coder:coder@coder-db-postgresql.coder.svc.cluster.local:5432/coder?sslmode=disable"
66+
```
67+
68+
#### Step 4: Install Coder
69+
Find the latest stable release from the [Coder Releases Page](https://github.com/coder/coder/releases)
70+
```bash
71+
# Add Coder Helm repository
72+
helm repo add coder-v2 https://helm.coder.com/v2
73+
74+
# Install Coder using the provided values file
75+
# Make sure the coder-core-values-v2.yaml file is in your current directory
76+
helm install coder coder-v2/coder \
77+
--namespace coder \
78+
--values coder-core-values-v2.yaml \
79+
--version <Latest Stable Release>
80+
```
81+
82+
#### Step 5: Update Coder Configuration
83+
```bash
84+
# Update the coder-core-values-v2.yaml file with your specific configuration:
85+
# - Update CODER_ACCESS_URL with your actual domain or load balancer URL
86+
# - Update CODER_WILDCARD_ACCESS_URL with your wildcard domain
87+
# - Update CODER_OIDC_ISSUER_URL with your Cognito User Pool URL
88+
# - Update any other settings as needed
89+
90+
# Apply the updated configuration
91+
helm upgrade coder coder-v2/coder \
92+
--namespace coder \
93+
--values coder-core-values-v2.yaml \
94+
--version <Latest Stable Release>
95+
```
96+
97+
#### Step 6: Configure IAM for EC2 Workspace Support
98+
```bash
99+
# Create IAM Role & Trust Relationship for EC2 Workspace Support
100+
# First, make sure you have the ekspodid-trust-policy.json file in your current directory
101+
aws iam create-role --role-name your-coder-ec2-workspace-role --assume-role-policy-document file://ekspodid-trust-policy.json
102+
103+
# Attach necessary policies to the role
104+
aws iam attach-role-policy \
105+
--role-name your-coder-ec2-workspace-role \
106+
--policy-arn arn:aws:iam::aws:policy/AmazonEC2FullAccess
107+
108+
aws iam attach-role-policy \
109+
--role-name your-coder-ec2-workspace-role \
110+
--policy-arn arn:aws:iam::aws:policy/IAMReadOnlyAccess
111+
112+
# Add IAM Pod Identity association for EC2 Workspace support
113+
aws eks create-pod-identity-association \
114+
--cluster-name your-cluster-name \
115+
--namespace coder \
116+
--service-account coder \
117+
--role-arn arn:aws:iam::your-aws-account-id:role/your-coder-ec2-workspace-role
118+
```
119+
120+
#### Step 7: Access Your Coder Deployment
121+
After completing the setup, you can access your Coder deployment using the Load Balancer URL provided by the Kubernetes service. For production use, it's recommended to:
122+
123+
1. Set up a CloudFront distribution in front of the Kubernetes Load Balancer to support HTTPS/SSL connections
124+
2. Configure a custom domain name pointing to your CloudFront distribution
125+
3. Update the Coder configuration with your custom domain
126+
127+
## Additional Configuration
128+
129+
### Customizing the Coder Deployment
130+
The `coder-core-values-v2.yaml` file in the [coder-admin](./coder-admin) directory contains various configuration options for your Coder deployment, including:
131+
132+
- Access URLs and wildcard domains
133+
- Authentication settings (password, OIDC)
134+
- Resource limits and requests
135+
- Service configurations
136+
- High availability settings
137+
138+
Review and modify this file to match your specific requirements before deploying or upgrading Coder.
139+
140+
### Template Management
141+
After accessing your Coder Deployment and setting up your Coder Admin account, tryout the [GitOps Demo](https://github.com/greg-the-coder/partner-demo-gitops) to review the different Coder CDE capabilities and test out a basic GitOps template management flow.

coder-admin/coder-core-values-v2.yaml

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# The Coder Helm values and defaults can be found here
2+
# https://github.com/coder/coder/blob/main/helm/coder/values.yaml
3+
4+
coder:
5+
# coder.env -- The environment variables to set for Coder. These can be used
6+
# to configure all aspects of `coder server`. Please see `coder server --help`
7+
# for information about what environment variables can be set.
8+
env:
9+
- name: CODER_ACCESS_URL
10+
value: "https://coder.example.com/"
11+
- name: CODER_WILDCARD_ACCESS_URL
12+
value: "*.coder.example.com"
13+
# - name: CODER_HTTP_ADDRESS
14+
# value: "127.0.0.1:80"
15+
# - name: CODER_TLS_ADDRESS
16+
# value: "0.0.0.0:443"
17+
- name: CODER_PG_CONNECTION_URL
18+
valueFrom:
19+
secretKeyRef:
20+
key: url
21+
name: coder-db-url
22+
- name: CODER_DISABLE_PASSWORD_AUTH
23+
value: "false"
24+
- name: CODER_SWAGGER_ENABLE
25+
value: "true"
26+
- name: CODER_REDIRECT_TO_ACCESS_URL
27+
value: "false"
28+
- name: CODER_TLS_ENABLE
29+
value: "false"
30+
31+
# OIDC/SSO configuration
32+
# - name: CODER_OIDC_ISSUER_URL
33+
# value: https://cognito-idp.us-east-2.amazonaws.com/us-east-2_lsXthgPxX
34+
# - name: CODER_OIDC_EMAIL_DOMAIN
35+
# value: coder.com,gmail.com
36+
# - name: CODER_OIDC_CLIENT_ID
37+
# valueFrom:
38+
# secretKeyRef:
39+
# key: client-id
40+
# name: aws-cognito-id
41+
# - name: CODER_OIDC_CLIENT_SECRET
42+
# valueFrom:
43+
# secretKeyRef:
44+
# key: client-secret
45+
# name: aws-cognito-secret
46+
# - name: CODER_OIDC_SCOPES
47+
# value: openid,profile,email
48+
# - name: CODER_OIDC_SIGN_IN_TEXT
49+
# value: AWS Cognito
50+
# - name: CODER_OIDC_ICON_URL
51+
# value: /icon/aws.png
52+
53+
# External Authentication - Github
54+
#- name: CODER_EXTERNAL_AUTH_0_ID
55+
# value: primary-github
56+
#- name: CODER_EXTERNAL_AUTH_0_TYPE
57+
# value: github
58+
#- name: CODER_EXTERNAL_AUTH_0_CLIENT_ID
59+
# value:
60+
#- name: CODER_EXTERNAL_AUTH_0_CLIENT_SECRET
61+
# value:
62+
63+
# External Authentication - Jfrog
64+
#- name: CODER_EXTERNAL_AUTH_1_ID
65+
# value: jfrog
66+
#- name: CODER_EXTERNAL_AUTH_1_TYPE
67+
# value: jfrog
68+
#- name: CODER_EXTERNAL_AUTH_1_DISPLAY_NAME
69+
# value: JFrog Artifactory
70+
#- name: CODER_EXTERNAL_AUTH_1_DISPLAY_ICON
71+
# value: /icon/jfrog.svg
72+
#- name: CODER_EXTERNAL_AUTH_1_CLIENT_ID
73+
# value:
74+
#- name: CODER_EXTERNAL_AUTH_1_CLIENT_SECRET
75+
# value:
76+
#- name: CODER_EXTERNAL_AUTH_1_AUTH_URL
77+
# value: https://coderintegration.jfrog.io/ui/authorization
78+
#- name: CODER_EXTERNAL_AUTH_1_TOKEN_URL
79+
# value:
80+
#- name: CODER_EXTERNAL_AUTH_1_SCOPES
81+
# value: applied-permissions/user
82+
83+
# Internal Provisioner
84+
- name: CODER_PROVISIONER_DAEMONS
85+
value: "3"
86+
- name: CODER_LOG_FILTER
87+
value: "false"
88+
- name: CODER_DERP_SERVER_ENABLE
89+
value: "true"
90+
91+
# Telemetery and prometheus metric config
92+
#- name: CODER_TELEMETRY_ENABLE
93+
# value: "true"
94+
#- name: CODER_PROMETHEUS_ADDRESS
95+
# value: 0.0.0.0:2112
96+
#- name: CODER_PROMETHEUS_ENABLE
97+
# value: "true"
98+
#- name: CODER_PROMETHEUS_COLLECT_AGENT_STATS
99+
# value: "true"
100+
101+
# Enable metric scraping
102+
#podAnnotations:
103+
# prometheus.io/port: "2112"
104+
# prometheus.io/scrape: "true"
105+
106+
# Enable HA for Coderd
107+
replicaCount: 1
108+
109+
resources:
110+
limits:
111+
cpu: 2000m
112+
memory: 4096Mi
113+
requests:
114+
cpu: 2000m
115+
memory: 4096Mi
116+
117+
# Additional pod labels
118+
#podLabels:
119+
# app: coder
120+
121+
# Pod Topology Spread Constraints
122+
#topologySpreadConstraints:
123+
#- maxSkew: 1
124+
# topologyKey: kubernetes.io/hostname
125+
# whenUnsatisfiable: ScheduleAnyway
126+
# labelSelector:
127+
# matchLabels:
128+
# app: coder
129+
130+
# Service object to expose for Coder
131+
service:
132+
enable: true
133+
type: LoadBalancer
134+
sessionAffinity: None
135+
externalTrafficPolicy: Local
136+
annotations:
137+
service.beta.kubernetes.io/aws-load-balancer-type: nlb
138+
service.beta.kubernetes.io/aws-load-balancer-additional-resource-tags: "Environment=demo,Name=coder-cntrlpln-nlb"
139+
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
140+
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
141+
142+
# Service account configuration - cannot be diabled
143+
serviceAccount:
144+
# Whether or not to grant the coder service account permissions to manage workspaces.
145+
# This includes permission to manage pods and persistent volume claims in the deployment namespace.
146+
# It is recommended to keep this on if you are using Kubernetes templates within Coder.
147+
workspacePerms: true
148+
149+
# Provides the service account permission to manage Kubernetes deployments.
150+
# Depends on workspacePerms.
151+
enableDeployments: true
152+
153+
# TLS secret name
154+
#tls:
155+
# secretNames:
156+
# - gcp-tls
157+
158+
# External Provisioner Daemon
159+
#provisionerDaemon:
160+
# pskSecretName: "coder-provisioner-psk"
161+
162+
163+
# Additional Configurations
164+
#- name: CODER_BLOCK_DIRECT
165+
# value: "false"
166+
#- name: CODER_DERP_FORCE_WEBSOCKETS
167+
# value: "false"
168+
#- name: CODER_DANGEROUS_ALLOW_PATH_APP_SHARING
169+
# value: "true"
170+
#- name: CODER_DANGEROUS_ALLOW_PATH_APP_SITE_OWNER_ACCESS
171+
# value: "true"

0 commit comments

Comments
 (0)