pyceo/web
Max Erenberg 68cb9d4600
continuous-integration/drone/pr Build is passing Details
use margin-top
2024-02-13 05:26:52 -05:00
..
internal use margin-top 2024-02-13 05:26:52 -05:00
pkg change cookie name 2024-02-05 01:53:42 -05:00
scripts change cookie name 2024-02-05 01:53:42 -05:00
systemd Add web UI for resetting one's password 2024-02-03 20:02:42 -05:00
tests change cookie name 2024-02-05 01:53:42 -05:00
.gitignore change cookie name 2024-02-05 01:53:42 -05:00
README.md change cookie name 2024-02-05 01:53:42 -05:00
dev.json Add web UI for resetting one's password 2024-02-03 20:02:42 -05:00
go.mod change cookie name 2024-02-05 01:53:42 -05:00
go.sum change cookie name 2024-02-05 01:53:42 -05:00
main.go Add web UI for resetting one's password 2024-02-03 20:02:42 -05:00
prod.json Add web UI for resetting one's password 2024-02-03 20:02:42 -05:00

README.md

ceod-web

This directory contains an experimental self-service web portal for CSC members to use. It is an alternative to the ceo TUI. Currently it is only meant to be used by general members, but in the future it may be extended to be used by syscom/office members as well.

Implemented APIs:

  • Password reset
  • Change login shell
  • Change forwarding addresses
  • Show membership terms

Development

Make sure the Docker containers for ceo are running. Build the "web" executable on the host, then run it in the phosphoric-acid container:

# Don't use cgo because the glibc version in the container will likely be
# older than the one on the host
CGO_ENABLED=0 go build -o ceod-web
docker-compose exec phosphoric-acid bash
cd web
./ceod-web -c dev.json

The application will listen on a Unix socket. In production, it expects to receive ADFS information from Apache, which is acting as a reverse proxy. In development, we will use our own proxy instead:

# On the host
go run scripts/proxy.go -s app.sock -u ctdalek -f Calum

Now you should be able to visit http://localhost:9988 in your browser.

You can change the -u (username) and -f (first name) arguments to simulate a different user. See the .drone/data.ldif file in the parent directory to see all mock users.

Templates and static assets

In development, the templated views and static assets will be loaded from the internal/views and internal/static folders, respectively. Unfortunately I think that the Echo framework caches those files internally so you will need to restart the app process if you modify them.

Emails

By default, no emails will be sent; they will only be printed to stdout. To send real emails, add these fields to the dev.json (replace your_username):

{
  ...
  "mta": "mail.csclub.uwaterloo.ca:25",
  "forced_email_recipient": "your_username@csclub.uwaterloo.ca"
}

This will send all of the emails to your email address (the To header will still be preserved, however).

Tests

# On the host
CGO_ENABLED=0 go test -c -o test ./tests
# In the container
./test -test.v

Deployment

Apache configuration on caffeine:

Redirect permanent /ceo /ceo/
<Location /ceo/ >
  Include snippets/adfs-require-auth.conf
  SetHandler "proxy:unix:/run/ceod-web/app.sock|fcgi://ceod-web/"
</Location>