Restarting a workspace is taking too much time
its taking around 30-40 mins to restart a workspace.


75 Replies
<#1339246490886864926>
Category
Bug report
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
which template are you using?
dev container template
Kubernetes or Docker?
dokcer
could you expand the build timeline and send a screenshot of that?


it was stuck in the init
have you made any edits to the template? could you send your template over?
so editing template effects the init?
no, but there could be changes that did
not sure but I think this was code, because I demotedit to the first version
does this happen all the time?
Nope
Just now I ran a new workspace , it worked fine
let me know if it happens again, in the meantime i'll ask internally about this issue
Yup, thanks
update?
its happening again and again
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 behaviorhow can I solve this?
ok I will try this
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
}

not sure, we need to identify what's causing this before, would you be able to send the logs when this happens?
sure
is it stuck on any particular module for example
this is the log
i dont think so, it seems the whole process is slower
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 😕
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?
setup the github integration
how can I do that?
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.
External Auth for Git Providers | Coder Docs
Learn about external authentication options in Coder. Configure and manage external provider connections for your development environment.
can you explain more?
well
you set it up, and you give it access to your private repos, and you can clone private repos
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?
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
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.
well you can attach a dockerfile for the dev container?
how, any guide is there?
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...
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
can we just create a build folder and add a Dockerfile and .devcontainer.json there inside the coder template and it will build it?
create a .devcontainer folder with the devcontainer.json file and Dockerfile
that would work
.devcontainer/devcontainer.json

.devcontainer/Dockerfile

I just copied the devcontainer coder template (main.tf)
am I doing something wrong its not working?
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
i directly edited this on the ui (coder.example.com)
this won't work?
i don't think so
kk
https://coder.com/docs/admin/templates/creating-templates#cli, instead of creating the folder, clone the coder-templates repo
i did "coder pull template ./template" it pulled these files

but after doing coder template push . --name 0.0.1
it uploaded only the main.tf
do the foll:
GitHub
coder/examples/templates/docker-devcontainer at main · coder/coder
Provision remote development environments via Terraform - coder/coder
and put it in a directory / git clone
now coder templates push
ok done
now?
can see this on the coder for this template

cool
now create a git repo with those devcontainer files
Dockerfile, and devcontainer.json
public if you haven't setup the github integration
.
what do you mean install the dockerfile?
Like I have created my own custom docker image and want to integrate to the devcontainer
sorry, didn't get you
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
you want a default devcontainer image?
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
i'm not sure of anything as a built on top of devcontainer
but a blank devcontainer can have a default devcontainer image
this can be changed to microsoft's aio devcontainer
ok so there is no other way to do this?
beacuse I was able to achive the same using coder docker template

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)]))
}
}
using this I was able to create a docker workspace coming with all the ubuntu lib installed. for example,

@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?
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?
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?
you can use
/close
@saun closed the thread.