github authentication
I'm trying to use devcontainers (on GCP VM).
It appears the devcontainer setup only supports cloning using https. However, for private repos I can't get github authentication to work.
In the coder web dashboard I can see I've connected github to my coder account.
And it seems like I should add something like the following to my template
data "coder_external_auth" "github" {
id = "github"
}
However, as soon as I do this when I push the template I get an error "Error: external auth provider "github" is not configured
"
Solution:Jump to solution
export CODER_EXTERNAL_AUTH_0_ID="something-github"
export CODER_EXTERNAL_AUTH_0_TYPE="github"
export CODER_EXTERNAL_AUTH_0_CLIENT_ID=some_id
export CODER_EXTERNAL_AUTH_0_CLIENT_SECRET=some_secret...
23 Replies
<#1236659771227111464>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
could you send your env variables for the Coder server over ?
e.g
/etc/coder/coder.env
or your Docker config, etc
redacted of courseI think I don't quite understand. /etc/coder/coder.env doesn't exist.
I'm running coder server on an Ubuntu VM (not docker image).
I just installed it using the standard install, stable version.
coder --version
Coder v2.9.4+864ba21 Mon Apr 22 20:10:30 UTC 2024
https://github.com/coder/coder/commit/864ba21a327e41be5fbc95d6f697e3ffa7574519
Solution
export CODER_EXTERNAL_AUTH_0_ID="something-github"
export CODER_EXTERNAL_AUTH_0_TYPE="github"
export CODER_EXTERNAL_AUTH_0_CLIENT_ID=some_id
export CODER_EXTERNAL_AUTH_0_CLIENT_SECRET=some_secret
export GOOGLE_APPLICATION_CREDENTIALS=/home/j/e/templates/gcp_auth.json
export TF_LOG="trace"
export TF_LOG_PATH=/tmp/terraform.log
coder server \
--oauth2-github-allowed-orgs=someorg \
--access-url https://someurl \
--enable-terraform-debug-mode
is this the information you wanted, on a related note users still need to have to setup an account with password, they can't login with github, although once logged in we can connect our github accounts.
like if I go to the external authentication tab of the web dashboard it shows Github as "authenticated"
did you follow this?
Installation - Coder v2 Docs
How to install and deploy Coder
yeah
what does
systemctl status coder
output ?i'm currently just launching coder directly so it shows
"systemctl status coder
Warning: The unit file, source configuration file or drop-ins of coder.service changed on disk>
○ coder.service - "Coder - Self-hosted developer workspaces on your infra"
Loaded: loaded (/usr/lib/systemd/system/coder.service; disabled; preset: enabled)
Active: inactive (dead)"
yeah git auth and oauth2 are separate
i'm just starting coder server with the command above
you should start via the service instead
start it and see if
/etc/coder/coder.env
gets createdok, where are the docs how to do it as a service?
i just followed; https://coder.com/docs/v2/latest/install
Installation - Coder v2 Docs
How to install and deploy Coder
just use
systemctl
to manage the service
are you familiar with systemd?not really, i can look it up (probably tomorrow). do edit coder.env to set env variables that coder needs?
quick rundown is
systemctl start <service>
-- starts the service
systemctl stop <service>
-- stops the service
systemctl enable <service>
-- enables the service to start at boot
systemctl disable <service>
-- disables the service to start at boot
instead of doing coder server
manually you use systemctl
commands to manage the service
and put those env variables in /etc/coder/coder.env
, without the "export" partok thanks, will try it tomorrow
for the flags you're passing to
coder server
look up their environment equivalent on https://coder.com/docsAbout - Coder v2 Docs
About Coder
appreciate your help
If I run with systemctl can I still use the built in postgres or I to setup a separate service?
yeah you can