C
Coder.com2mo ago
saun

Restarting a workspace is taking too much time

its taking around 30-40 mins to restart a workspace.
No description
No description
75 Replies
Codercord
Codercord2mo ago
<#1339246490886864926>
Category
Bug report
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys2mo ago
which template are you using?
saun
saunOP2mo ago
dev container template
Phorcys
Phorcys2mo ago
Kubernetes or Docker?
saun
saunOP2mo ago
dokcer
Phorcys
Phorcys2mo ago
could you expand the build timeline and send a screenshot of that?
saun
saunOP2mo ago
No description
saun
saunOP2mo ago
No description
saun
saunOP2mo ago
it was stuck in the init
Phorcys
Phorcys2mo ago
have you made any edits to the template? could you send your template over?
saun
saunOP2mo ago
so editing template effects the init?
Phorcys
Phorcys2mo ago
no, but there could be changes that did
saun
saunOP2mo ago
not sure but I think this was code, because I demotedit to the first version
Phorcys
Phorcys2mo ago
does this happen all the time?
saun
saunOP2mo ago
Nope Just now I ran a new workspace , it worked fine
Phorcys
Phorcys2mo ago
let me know if it happens again, in the meantime i'll ask internally about this issue
saun
saunOP2mo ago
Yup, thanks update? its happening again and again
Phorcys
Phorcys2mo ago
hey, I haven't heard back yet, just asked again hey, sorry for the delay, I've got a reply with some info on this init is the stage when modules & providers are downloaded if you are redeploying your provisioners often, that might be causing issues with the cache another thing could be to check network issues with your deployment sorry for the pretty vague answer, but this much delay when downloading modules and providers is not normal so it's tough to debug you could try running the terraform CLI manually on a periodic basis inside the same environment as your Coder instance to see if you notice the same behavior
saun
saunOP2mo ago
how can I solve this? ok I will try this
saun
saunOP2mo ago
also I tried adding filebrowser module, but it is not workin, this is the code module "filebrowser" { count = data.coder_workspace.me.start_count source = "registry.coder.com/modules/filebrowser/coder" version = "1.0.29" agent_id = coder_agent.main.id folder = "/workspaces" order = 4 }
No description
Phorcys
Phorcys2mo ago
not sure, we need to identify what's causing this before, would you be able to send the logs when this happens?
saun
saunOP2mo ago
sure
Phorcys
Phorcys2mo ago
is it stuck on any particular module for example
saun
saunOP2mo ago
this is the log
saun
saunOP2mo ago
i dont think so, it seems the whole process is slower
zounce
zounce2mo ago
The latest version of the filebrowser module is broken right now https://github.com/coder/modules/issues/399 Not sure why terraform init might be taking 40 minutes though 😕
saun
saunOP2mo ago
also, how can I clone a private repo using coder? so I want to create a devcontainer template which installs my private python libraries, do you have any idea how to do this?
tsa
tsa2mo ago
setup the github integration
saun
saunOP2mo ago
how can I do that?
saun
saunOP2mo ago
GitHub OAuth Setup Guide | Coder Docs
Set up GitHub OAuth for Coder, enabling GitHub and GitHub Enterprise authentication with OAuth app configuration and Helm deployment steps.
From An unknown user
From An unknown user
tsa
tsa2mo ago
External Auth for Git Providers | Coder Docs
Learn about external authentication options in Coder. Configure and manage external provider connections for your development environment.
From An unknown user
From An unknown user
saun
saunOP2mo ago
can you explain more?
tsa
tsa2mo ago
well you set it up, and you give it access to your private repos, and you can clone private repos
saun
saunOP2mo ago
Ok so if I setup a GitHub app and give it access to my private repos Then every users creating a workspace can clone it?
tsa
tsa2mo ago
yea not every user though every user needs to authenticate with their github account, or organization if they are in an org that will work fine
saun
saunOP2mo ago
how can I attach a Dockerfile with main.tf of devcontainer (new to this so no clue) I know that we can clone a github repo with .devcontainer.json to build the devcontainer but I want a template to install the Dockerfile directly when creating a workspace and they can clone a repo with other codes.
tsa
tsa2mo ago
well you can attach a dockerfile for the dev container?
saun
saunOP2mo ago
how, any guide is there?
tsa
tsa2mo ago
Using Images, Dockerfiles, and Docker Compose
When creating a development container, you have a variety of different ways to customize your environment like “Features” or lifecycle scripts. However, if y...
saun
saunOP2mo ago
also the Docker image is private so i have to do this https://github.com/coder/envbuilder/blob/main/docs/container-registry-auth.md
GitHub
envbuilder/docs/container-registry-auth.md at main · coder/envbuilder
Build development environments from a Dockerfile on Docker, Kubernetes, and OpenShift. Enable developers to modify their development environment quickly. - coder/envbuilder
saun
saunOP2mo ago
can we just create a build folder and add a Dockerfile and .devcontainer.json there inside the coder template and it will build it?
tsa
tsa2mo ago
create a .devcontainer folder with the devcontainer.json file and Dockerfile that would work
saun
saunOP2mo ago
.devcontainer/devcontainer.json
No description
saun
saunOP2mo ago
.devcontainer/Dockerfile
No description
saun
saunOP2mo ago
I just copied the devcontainer coder template (main.tf) am I doing something wrong its not working?
tsa
tsa2mo ago
you copied it into the editor? well you need to install the coder cli git clone the coder templates repo coder templates create coder templates push
saun
saunOP2mo ago
i directly edited this on the ui (coder.example.com) this won't work?
tsa
tsa2mo ago
i don't think so
saun
saunOP2mo ago
kk
tsa
tsa2mo ago
https://coder.com/docs/admin/templates/creating-templates#cli, instead of creating the folder, clone the coder-templates repo
saun
saunOP2mo ago
i did "coder pull template ./template" it pulled these files
No description
saun
saunOP2mo ago
but after doing coder template push . --name 0.0.1 it uploaded only the main.tf
tsa
tsa2mo ago
do the foll:
mkdir coder-templates
cd coder-templates
mkdir docker-devcontainer
paste the files
coder templates push
mkdir coder-templates
cd coder-templates
mkdir docker-devcontainer
paste the files
coder templates push
tsa
tsa2mo ago
and put it in a directory / git clone now coder templates push
saun
saunOP2mo ago
ok done now?
saun
saunOP2mo ago
can see this on the coder for this template
No description
tsa
tsa2mo ago
cool now create a git repo with those devcontainer files Dockerfile, and devcontainer.json public if you haven't setup the github integration
saun
saunOP2mo ago
.
tsa
tsa2mo ago
what do you mean install the dockerfile?
saun
saunOP2mo ago
Like I have created my own custom docker image and want to integrate to the devcontainer
tsa
tsa2mo ago
sorry, didn't get you
saun
saunOP2mo ago
So, If I create a workspace on coder using the template (without cloning any github repo), I can have all the custom libraries on the docker image I created to be there inside the workspace
tsa
tsa2mo ago
you want a default devcontainer image?
saun
saunOP2mo ago
yes, the devcontainer should be built on top of the docker image so I can work on other github repos, on top of the custom docker image inside the devcontainer
tsa
tsa2mo ago
i'm not sure of anything as a built on top of devcontainer but a blank devcontainer can have a default devcontainer image
data "coder_parameter" "fallback_image" {
default = "codercom/enterprise-base:ubuntu"
description = "This image runs if the devcontainer fails to build."
display_name = "Fallback Image"
mutable = true
name = "fallback_image"
order = 3
}
data "coder_parameter" "fallback_image" {
default = "codercom/enterprise-base:ubuntu"
description = "This image runs if the devcontainer fails to build."
display_name = "Fallback Image"
mutable = true
name = "fallback_image"
order = 3
}
this can be changed to microsoft's aio devcontainer
saun
saunOP2mo ago
ok so there is no other way to do this? beacuse I was able to achive the same using coder docker template
saun
saunOP2mo ago
No description
saun
saunOP2mo ago
resource "docker_image" "main" { name = "coder-${data.coder_workspace.me.id}" build { context = "./build" build_args = { USER = local.username } } triggers = { dir_sha1 = sha1(join("", [for f in fileset(path.module, "build/*") : filesha1(f)])) } }
saun
saunOP2mo ago
using this I was able to create a docker workspace coming with all the ubuntu lib installed. for example,
No description
saun
saunOP2mo ago
@Phorcys hey do you have any idea how to do this? sorry to ping you directly if you were busy, i am stuck on this for a long time How to build a custom private image using coder's docker template?
Phorcys
Phorcys2mo ago
no worries, i check issues when i can and usually work on the week-end, just haven't been able to look yet given this is different from your other issue, do you still need help with this too?
saun
saunOP2mo ago
no, resolved the taking time, not sure how it resolved, just created a new template and everything working fine now thanks, how can I close this thread?
Phorcys
Phorcys2mo ago
you can use /close
Codercord
Codercord2mo ago
@saun closed the thread.

Did you find this page helpful?