Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run auth service on a separate machine #94

Closed
bickelj opened this issue Aug 24, 2023 · 11 comments
Closed

Run auth service on a separate machine #94

bickelj opened this issue Aug 24, 2023 · 11 comments
Assignees

Comments

@bickelj
Copy link
Collaborator

bickelj commented Aug 24, 2023

We would benefit from auth running on a separate machine from PDC service. Deployment of PDC backend would be more cleanly separated, e.g. PDC deployment does not impact auth, sessions, etc.

@bickelj bickelj self-assigned this Aug 24, 2023
@bickelj
Copy link
Collaborator Author

bickelj commented Aug 24, 2023

#86 would be resolved by this.

@bickelj
Copy link
Collaborator Author

bickelj commented Aug 29, 2023

My assumption when creating this ticket was the goal of a single, unified Keycloak instance across several projects. That assumption was incorrect because PDC infrastructure needs to be cleanly separate from other infrastructure.

In light of this, I think we could work on #86 first rather than adding another machine to maintain while the first machine is not maxed out in any way. @jasonaowen How does that sound?

@jasonaowen
Copy link
Contributor

@bickelj I'm not sure I follow the distinction you're making between this and #86! I agreed with your earlier comment that working on this would resolve #86. Can you say more?

@bickelj
Copy link
Collaborator Author

bickelj commented Sep 1, 2023

@jasonaowen Sure, I don't think this is immediately needed for #86, but I can see that now is a good time to make a dedicated auth machine if that's desired. So doing.

@bickelj
Copy link
Collaborator Author

bickelj commented Sep 1, 2023

The plan is this:

  • Create a test machine with associated managed DB.
  • Restore a backup of the existing test DB to the new test DB.
  • Install new Keycloak as if it is the actual domain name (keeping the test domain name pointed to the existing/old instance) but add a local hosts entry to point to the new instance.
  • Use a copy of existing certificates until DNS cutover.
  • Compile and use updated extension jars (if needed).
  • Point the domain name to the new instance. Either accept some downtime until propagation and certbot creation of certs or copy the existing certificates and keys from the old system to the new.
  • Generate new certificates with certbot after DNS has been updated.
  • Rotate Keycloak's signing key.
  • Repeat the above for production (same order but not necessarily waiting for all steps before starting this).
  • Remove the auth service from compose.yml.
  • Remove the environment variables related to auth service from .env files on service machines.
  • Remove the auth service reverse proxy config from service machines.
  • Remove the keycloak database from old machines.
  • Remove the auth user from old machines.

@bickelj
Copy link
Collaborator Author

bickelj commented Sep 13, 2023

I staged most of the changes in the new production machine while the DNS change for test is pending. I didn't yet take a backup of the production machine (or restore it) because we want that step to be as close to the DNS change as practical. But the prerequisites, the database user and (empty) database, Keycloak software and config, nginx config, systemd unit, env vars are at least there and ready for the dump/restore and DNS change.

@bickelj
Copy link
Collaborator Author

bickelj commented Oct 9, 2023

Let's Encrypt certificates are now are on auth test machine using certbot.

bickelj added a commit that referenced this issue Nov 13, 2023
The authentication and authorization server is getting split off onto
its own host. As of this writing, the test auth server is separated.
This change removes the attempts to renew certificates for the auth
service now that it is going to be on a different machine.

See #94 Run auth service on a separate machine
@bickelj
Copy link
Collaborator Author

bickelj commented Jan 26, 2024

The new production auth machine is running now, pending DNS change.

@bickelj
Copy link
Collaborator Author

bickelj commented Jan 27, 2024

DNS change is complete, and the prod machine also is using Let's Encrypt certificates now.

@bickelj
Copy link
Collaborator Author

bickelj commented Jan 30, 2024

All but the unchecked cleanup steps are complete here. I have not tried a keycloak key rotation so I do not know how long that would take.

bickelj added a commit that referenced this issue Jan 31, 2024
@bickelj
Copy link
Collaborator Author

bickelj commented Jan 31, 2024

The old machines should have very little or none to do with the old keycloak instance running there now. The database, database user, system user, and leftover files from the migration should be gone. The related env vars are commented out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done & Cleared
Development

No branches or pull requests

2 participants