Skip to content

Commit a715c6a

Browse files
Merge branch 'improve_documentation' into 'master'
fix bad markdown formatting and improve documentation See merge request lap/alma-user-load!48
2 parents 0690013 + 17aa96b commit a715c6a

1 file changed

Lines changed: 78 additions & 32 deletions

File tree

README.md

Lines changed: 78 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,93 @@
11

22
# Alma-User-Load
33

4-
Application for fetching patron records for both SIS (aka students) and UCPath (aka employees) and formatting those records into XML to be loaded by Ex Libris into Alma using their sync process.
4+
Application for fetching patron records for both studens and employees and formatting those records into XML to be loaded by Ex Libris into Alma using their sync process.
55

6-
Ex Libris pulls the XML files from our SFTP server.
7-
UCPath: upload.lib.berkeley.edu/alma/patron_employees
8-
SIS: upload.lib.berkeley.edu/alma/patron_students
6+
Additional documentation can be found on B-Drive: [link](https://drive.google.com/drive/folders/1pOEKi2d5SQ4VZpwjQzUwuArwBbUJzvcF)
97

10-
Additional documentation can be found on B-Drive: [link](https://drive.google.com/drive/folders/1qO_7oD4tzDO9H4UMHrms7-ONzHdQ4gU2)
8+
### Important Note
9+
Because of differences in the two APIs (SIS and UCPath), these do not operate exactly the same. UCPath's API is driven by a "change log". When it runs, it looks back 7 days from the current date for any recods that have been added or updated and then processes those. SIS does not have a change log. Instead we pull the entire collection of users for the current semester everytime we run SIS.
1110

12-
___
11+
If the SIS Alma-User-Load fails to run on it's scheduled day, it's not considered detrimental - the next scheduled run will pick up any new or updated records the previous run would have picked up.
1312

14-
#### Info
15-
Alma-User_load is deployed via the Docker Swarm.
16-
It is kept in the `lap/alma-user-load` repo.
13+
If UCPath **fails to run on it's scheduled day**, a manual run is necessary. The `startdate` (see Commandline Options below) needs to be the date 7 days prior to the scheduled date that was missed. (e.g., if UCPath was scheduled to run on April 10, 2025 and failed and you wanted to run it on April 11th, you'd need to pass -startdate 2025-04-03 as a commandline arguement).
1714

18-
#### Schedule
19-
SIS : Monday and Wednesday Mornings 1am
20-
UCPath : Thursday Mornings 1am
15+
You can perform that locally and manually copy the zipped file to the patron_employees folder (see XML and Zip File Output below)
2116

22-
The schedules are defined in the `ops/docker-swarm` repo:
23-
`files/production/swarm/stacks/alma_user_loader.yml`
17+
## Info
2418

25-
#### XML and Zip File Output
26-
Files are saved to:
27-
SIS: ```upload.lib.berkeley.edu/alma/patron_students```
19+
### Dependencies
20+
21+
Alma-User_load is deployed via the Docker Swarm and is kept in the `lap/alma-user-load` repo.
22+
Data is harvested from several sources:
23+
24+
UCPath: https://developers.api.berkeley.edu/api/8
25+
SIS: https://developers.api.berkeley.edu/api/6
26+
Additional data is pulled from CalNet via LDAP
27+
28+
### Schedule
29+
30+
* SIS : Monday and Wednesday Mornings 1am
31+
* UCPath : Thursday Mornings 1am
32+
33+
The schedules are defined in the `ops/docker-swarm`
34+
repo: `files/production/swarm/stacks/alma_user_loader.yml`
35+
36+
### XML and Zip File Output
37+
38+
Files are saved to:
39+
SIS: ```upload.lib.berkeley.edu/alma/patron_students```
2840
UCPath: ```upload.lib.berkeley.edu/alma/patron_employees```
2941

30-
#### Logging
42+
### Logging
43+
3144
Production logs can be found in Amazon CloudWatch under the following log groups:
3245

33-
[production/alma_user_loader/sis](https://us-west-1.console.aws.amazon.com/cloudwatch/home?region=us-west-1#logsV2:log-groups/log-group/production$252Falma_user_loader$252Fsis)
46+
[production/alma_user_loader/sis](https://us-west-1.console.aws.amazon.com/cloudwatch/home?region=us-west-1#logsV2:log-groups/log-group/production$252Falma_user_loader$252Fsis)
3447
[production/alma_user_loader/ucpath](https://us-west-1.console.aws.amazon.com/cloudwatch/home?region=us-west-1#logsV2:log-groups/log-group/production$252Falma_user_loader$252Fucpath)
3548

3649
You'll need to sign in with the IAM account alias uc-berkeley-library-it
3750
and then with your IAM user name and password (created by the DevOps team).
3851

39-
---
52+
In the event Alma-User-Load fails to run:
53+
SIS: Because SIS pull the full collection of users for the current semester every run, there are no special steps for recovery. You can either let it run
54+
55+
4056
## Development
41-
#### Configuring
42-
To run locally, clone the repo, then add a .env file to the root of the project. Check `config>secrets.yml` for necessary UCPath, SIS and LDAP settings.
4357

44-
#### Running
45-
Note - you cannot run students and employees at the same time, you can only run them one at a time.
58+
### Configuring
59+
60+
To run locally, clone the repo, then add a .env file to the root of the project. (API info can be found in LastPass)
4661

47-
You can run this directly or using Docker
62+
> \# UCPath Secrets:
63+
> UCPATH_API_URL=https://gateway.api.berkeley.edu/hr/v3/
64+
> UCPATH_API_ID=[API ID]
65+
> UCPATH_API_KEY=[API KEY]
66+
>
67+
> \# SIS Secrets:
68+
> SIS_API_URL=https://gateway.api.berkeley.edu/sis/v2/students
69+
> SIS_API_ID=[API ID]
70+
> SIS_API_KEY=[API KEY]
71+
>
72+
> \# LDAP Secrets:
73+
> LDAP_HOST=ldap.berkeley.edu
74+
> LDAP_PASS=[LDAP Password]
75+
76+
77+
78+
### Running
79+
80+
Note - you cannot run students and employees at the same time, you can only run them one at a time.
81+
Alma-User-Load can be run directly or using Docker.
82+
83+
### Run locally without Docker:
4884

49-
##### Run locally without Docker:
5085
```sh
5186
ruby alma_user_load.rb -t <ucpath|sis>
5287
```
5388

54-
##### Run with Docker:
89+
### Run with Docker:
90+
5591
Build the container:
5692
```sh
5793
docker build -t alma-user-load .
@@ -77,6 +113,17 @@ docker build -t alma-user-load .
77113
ruby alma_user_load.rb -t ucpath -u '10671129,10674086'
78114
```
79115

116+
### Run the test suite:
117+
```sh
118+
> rspec
119+
```
120+
121+
Note - to run the test suite you need to change the LDAP setting in your `.env` file
122+
> \# For testing:
123+
> LDAP_HOST=ldap.fake.edu
124+
> LDAP_PASS=FAKEPW
125+
126+
80127
**Commandline Options**
81128
* --type [ucpath|sis] *required*
82129
* --term [term-code] *SIS only*
@@ -85,13 +132,12 @@ docker build -t alma-user-load .
85132
* --outdir Set the output directory for xml/zip files
86133
* --help
87134

88-
___
89135

90-
##### Future Improvements:
91-
- Get "current term" dynamically from API (awaiting access to API)
92-
- Replace fixtures w/some sort of factory (factorybot?)
136+
## Future Improvements:
137+
- Replace fixtures w/some sort of factory (VCR)
93138
- DRY things up (UCPath vs. SIS --> phone, email, address, names, etc...)
94139
- SIS - add run by user id (similar to how I setup ucpath)
95140
- Move 'create_user_record' from user.rb to a separate class
96141
- Add a check to make sure all necessary config settings are set!
97-
- Add run by campus-uid to ucpath
142+
- Fix LDAP tests to override the
143+
- Setup a rake command to run the test suite

0 commit comments

Comments
 (0)