JustATempest
JustATempest
Explore posts from servers
CCoder.com
Created by JustATempest on 9/19/2024 in #help
AWS EC2 (Devcontainer) fails with custom repo
Sure ... I've been fighting for 4 hours today... I'll be taking a break today. Send it some time tomorrow.... 🥱
13 replies
CCoder.com
Created by JustATempest on 9/19/2024 in #help
AWS EC2 (Devcontainer) fails with custom repo
This
13 replies
CCoder.com
Created by JustATempest on 9/19/2024 in #help
aws_ecr_repository auth error on EC2 envbuilder
resource "aws_ecr_repository" "cache_repo" {
name = "coder-${data.coder_workspace.me.id}-${data.coder_workspace.me.name}-cache"
tags = {
Coder_Provisioned = "true"
}
}

data "aws_ecr_authorization_token" "envbuilder_cache" {}

locals {
...
dockerconfig_json = jsonencode({
"auths" = {
"${aws_ecr_repository.cache_repo.repository_url}" = {
"auth" = data.aws_ecr_authorization_token.envbuilder_cache.authorization_token
}
}
})

envbuilder_env = {
"CODER_AGENT_TOKEN" = try(coder_agent.dev[0].token, "")
"CODER_AGENT_URL" = data.coder_workspace.me.access_url
"GIT_URL" = data.coder_parameter.repo_url.value
"FALLBACK_IMAGE" = "codercom/enterprise-base:ubuntu"
"ENVBUILDER_CACHE_REPO" = aws_ecr_repository.cache_repo.repository_url
"ENVBUILDER_PUSH_IMAGE" = 1
"AWS_SDK_LOAD_CONFIG" = true
"ENVBUILDER_DOCKER_CONFIG_BASE64" = base64encode(local.dockerconfig_json)
}

docker_env = [
for k, v in local.envbuilder_env : "${k}=${v}"
]

user_data = <<-EOT
...

# Create the necessary environment variables
ENV_VARS=$(
echo "${join(" ", [for k, v in local.envbuilder_env : "-e ${k}=${v}"])}"
)

# Start envbuilder
docker run --rm \
-h ${lower(data.coder_workspace.me.name)} \
-v /home/${local.linux_user}/envbuilder:/workspaces \
-e INIT_SCRIPT="echo ${base64encode(try(coder_agent.dev[0].init_script, ""))} | base64 -d | sh" \
$ENV_VARS \
ghcr.io/coder/envbuilder

...
EOT
}
resource "aws_ecr_repository" "cache_repo" {
name = "coder-${data.coder_workspace.me.id}-${data.coder_workspace.me.name}-cache"
tags = {
Coder_Provisioned = "true"
}
}

data "aws_ecr_authorization_token" "envbuilder_cache" {}

locals {
...
dockerconfig_json = jsonencode({
"auths" = {
"${aws_ecr_repository.cache_repo.repository_url}" = {
"auth" = data.aws_ecr_authorization_token.envbuilder_cache.authorization_token
}
}
})

envbuilder_env = {
"CODER_AGENT_TOKEN" = try(coder_agent.dev[0].token, "")
"CODER_AGENT_URL" = data.coder_workspace.me.access_url
"GIT_URL" = data.coder_parameter.repo_url.value
"FALLBACK_IMAGE" = "codercom/enterprise-base:ubuntu"
"ENVBUILDER_CACHE_REPO" = aws_ecr_repository.cache_repo.repository_url
"ENVBUILDER_PUSH_IMAGE" = 1
"AWS_SDK_LOAD_CONFIG" = true
"ENVBUILDER_DOCKER_CONFIG_BASE64" = base64encode(local.dockerconfig_json)
}

docker_env = [
for k, v in local.envbuilder_env : "${k}=${v}"
]

user_data = <<-EOT
...

# Create the necessary environment variables
ENV_VARS=$(
echo "${join(" ", [for k, v in local.envbuilder_env : "-e ${k}=${v}"])}"
)

# Start envbuilder
docker run --rm \
-h ${lower(data.coder_workspace.me.name)} \
-v /home/${local.linux_user}/envbuilder:/workspaces \
-e INIT_SCRIPT="echo ${base64encode(try(coder_agent.dev[0].init_script, ""))} | base64 -d | sh" \
$ENV_VARS \
ghcr.io/coder/envbuilder

...
EOT
}
6 replies
CCoder.com
Created by JustATempest on 9/19/2024 in #help
aws_ecr_repository auth error on EC2 envbuilder
It's working here it's the fix for anyone in the future.
6 replies
CCoder.com
Created by JustATempest on 9/19/2024 in #help
AWS EC2 (Devcontainer) fails with custom repo
I'm using the latest docker compose version of coder
13 replies
CCoder.com
Created by JustATempest on 9/19/2024 in #help
AWS EC2 (Devcontainer) fails with custom repo
The devlogs above are the logs that I get.
13 replies
CCoder.com
Created by JustATempest on 9/19/2024 in #help
AWS EC2 (Devcontainer) fails with custom repo
13 replies
CCoder.com
Created by Phet(Dam) on 9/17/2024 in #help
what url callback in external auth ?
I believe you can just use your domain. The integration automatically changed to the correct URL for github.
13 replies
CCoder.com
Created by JustATempest on 9/14/2024 in #help
Github Single Sign On Unauthorized
This error happens when the pimary email don't match on github and coder
2 replies
TTCTheo's Typesafe Cult
Created by RevengeTime on 7/31/2023 in #questions
Third party authenticator
You would create a user table in your backend. With an external ID column. You create an API endpoint that will listen to the user created web hook event. You'll then create the user when a new users created.
4 replies
TTCTheo's Typesafe Cult
Created by RevengeTime on 7/31/2023 in #questions
Third party authenticator
When a user is created in clerk. An event is created and you can create wehhooks to sync your back end with clerk users.
4 replies
TTCTheo's Typesafe Cult
Created by meeepsss on 7/25/2023 in #questions
bloody confused by the new Next.js server actions
@meeepsss The reason why you can't find anything about server actions implementation It's because they're built a top react actions, which is an experimental react feature. This might be a better search query.
8 replies
TTCTheo's Typesafe Cult
Created by locusdagraca on 7/25/2023 in #questions
fetching dynamic data in layout, not page
While you can make the layout a client component, from my experience, I would recommend making layouts server components, and client components as the last resort. Ideally, with the features the app router gives, a lot of the advantages are lost by making the layout a client component.
5 replies
TTCTheo's Typesafe Cult
Created by locusdagraca on 7/25/2023 in #questions
fetching dynamic data in layout, not page
You can pull the navbar into its own component, and make the underlying layout a server component. The use refresh should work after that.
5 replies
TTCTheo's Typesafe Cult
Created by meeepsss on 7/25/2023 in #questions
bloody confused by the new Next.js server actions
Tldr; The best way to use server actions is in the forms as they simplify submission, and in client components that mutate the database or load data from the database, where the component does not have shared state with the rest of the application. As of now.
8 replies
TTCTheo's Typesafe Cult
Created by meeepsss on 7/25/2023 in #questions
bloody confused by the new Next.js server actions
I'm making an application that uses them extensively and I've gotten quite familiar with some of the caveats. Primarily, They simplify the logic of forms. They don't really mesh with redux as they require use transitionz and I can't figure out how to combine with Redux. You can use them for form submission still, but I wouldn't use them everywhere should you like the remix pattern from my experience. They're also good for routes or components, that don't require a lot of shared state.
8 replies