C
Coder.com7mo ago
jjj

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:
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...
Jump to solution
23 Replies
Codercord
Codercord7mo ago
<#1236659771227111464>
Category
Help needed
Product
Coder OSS (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys7mo ago
could you send your env variables for the Coder server over ? e.g /etc/coder/coder.env or your Docker config, etc redacted of course
jjj
jjjOP7mo ago
I 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.
jjj
jjjOP7mo ago
Solution
jjj
jjj7mo ago
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
jjj
jjjOP7mo ago
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"
Phorcys
Phorcys7mo ago
did you follow this?
jjj
jjjOP7mo ago
yeah
Phorcys
Phorcys7mo ago
what does systemctl status coder output ?
jjj
jjjOP7mo ago
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)"
Phorcys
Phorcys7mo ago
yeah git auth and oauth2 are separate
jjj
jjjOP7mo ago
i'm just starting coder server with the command above
Phorcys
Phorcys7mo ago
you should start via the service instead start it and see if /etc/coder/coder.env gets created
jjj
jjjOP7mo ago
ok, where are the docs how to do it as a service?
jjj
jjjOP7mo ago
Installation - Coder v2 Docs
How to install and deploy Coder
Phorcys
Phorcys7mo ago
just use systemctl to manage the service are you familiar with systemd?
jjj
jjjOP7mo ago
not really, i can look it up (probably tomorrow). do edit coder.env to set env variables that coder needs?
Phorcys
Phorcys7mo ago
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" part
jjj
jjjOP7mo ago
ok thanks, will try it tomorrow
Phorcys
Phorcys7mo ago
for the flags you're passing to coder server look up their environment equivalent on https://coder.com/docs
jjj
jjjOP7mo ago
appreciate your help If I run with systemctl can I still use the built in postgres or I to setup a separate service?
Phorcys
Phorcys7mo ago
yeah you can
Want results from more Discord servers?
Add your server