Skip to content

Commit 499ef63

Browse files
William Wellingkaladay
andauthored
Tech debt weaver upgrade (#103)
* add pr and issue templates * Spring migration broke Web Sockets due to setAllowedOrigins behavioral change. (#104) The `setAllowedOrigins()` must now be `setAllowedOriginPatterns()`. * Standardize the multiple forms of gitignore * add contributing, add deploying, update license and readme * upgrade weaver * update dockerfile * cleanup log files * normalize pom * add deployment section and correct readme * update build workflow * Use .gitignore based off of App Repos. * Update readme and related files for consistency. - Fix simple mistakes. - Use long/full names in titles without acronyms. - Leave most of the README.md design as-is for comparison against alternative methods. - Fix license sentence. - Fix line endings where needed. - Use different documentation for cases where there is no `docker-compose` available (as in, no UI or App Repos). - Some documents have the incorrect link styling, which doesn't work. - Make readme and related files more consistent. * Use project-specific name in docker deploy instructions. * Make Dockerfile more consistent. - Remove SOURCE_DIR when not needed. - Always clean and clear apt cache to reduce docker disk usage. - Make sure the SOURCE_DIR exists when not copying it wholesale. - Remove any spurious new lines. * This is a service repo not a UI repo. Co-authored-by: Kevin Day <35114839+kaladay@users.noreply.github.com> Co-authored-by: Kevin Day <kday@library.tamu.edu>
1 parent 8335d2e commit 499ef63

14 files changed

Lines changed: 390 additions & 73 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
7+
---
8+
9+
**Describe the bug**
10+
A clear and concise description of what the bug is.
11+
12+
**To Reproduce**
13+
Steps to reproduce the behavior:
14+
1. Go to '...'
15+
2. Click on '....'
16+
3. Scroll down to '....'
17+
4. See error
18+
19+
**Expected behavior**
20+
A clear and concise description of what you expected to happen.
21+
22+
**Screenshots**
23+
If applicable, add screenshots to help explain your problem.
24+
25+
**Desktop (please complete the following information):**
26+
- OS: [e.g. iOS]
27+
- Browser [e.g. chrome, safari]
28+
- Version [e.g. 22]
29+
30+
**Smartphone (please complete the following information):**
31+
- Device: [e.g. iPhone6]
32+
- OS: [e.g. iOS8.1]
33+
- Browser [e.g. stock browser, safari]
34+
- Version [e.g. 22]
35+
36+
**Additional context**
37+
Add any other context about the problem here.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: ''
6+
7+
---
8+
9+
**Is your feature request related to a problem? Please describe.**
10+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
11+
12+
**Describe the solution you'd like**
13+
A clear and concise description of what you want to happen.
14+
15+
**Describe alternatives you've considered**
16+
A clear and concise description of any alternative solutions or features you've considered.
17+
18+
**Additional context**
19+
Add any other context or screenshots about the feature request here.

.github/pull_request_template.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Description
2+
3+
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
4+
5+
Fixes # (issue)
6+
7+
## Type of change
8+
9+
Please delete options that are not relevant.
10+
11+
- [ ] Bug fix (non-breaking change which fixes an issue)
12+
- [ ] New feature (non-breaking change which adds functionality)
13+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
14+
- [ ] This change requires a documentation update
15+
16+
# How Has This Been Tested?
17+
18+
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
19+
20+
- [ ] Test A
21+
- [ ] Test B
22+
23+
**Test Configuration**:
24+
* Toolchain:
25+
* SDK:
26+
27+
# Checklist:
28+
29+
- [ ] My code follows the style guidelines of this project
30+
- [ ] I have performed a self-review of my code
31+
- [ ] I have commented my code, particularly in hard-to-understand areas
32+
- [ ] I have made corresponding changes to the documentation
33+
- [ ] My changes generate no new warnings
34+
- [ ] I have added tests that prove my fix is effective or that my feature works
35+
- [ ] New and existing unit tests pass locally with my changes
36+
- [ ] Any dependent changes have been merged and published in downstream modules
37+

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v3
1111

1212
- name: "Maven Cache"
13-
uses: actions/cache@v2
13+
uses: actions/cache@v3
1414
with:
1515
path: ~/.m2/repository
1616
key: ${{ runner.os }}-cache-maven-${{ hashFiles('**/pom.xml') }}

.gitignore

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,70 @@
1-
.apt_generated/
2-
target/
3-
.DS_Store
1+
### Git ###
2+
!.gitkeep
3+
4+
5+
### STS ###
6+
.apt_generated
47
.classpath
58
.factorypath
69
.project
710
.settings
811
.springBeans
9-
bin/
12+
.sts4-cache
13+
14+
15+
### IntelliJ IDEA ###
16+
.idea
17+
*.iws
18+
*.iml
19+
*.ipr
20+
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
28+
/.nb-gradle/
29+
30+
31+
### VS Code ###
32+
.vscode/
33+
34+
dump.rdb
35+
36+
37+
### OS Specific ###
38+
.DS_Store
39+
.tmp/
40+
41+
tmp/
42+
43+
44+
### Maven ###
1045
logs/
46+
target/
47+
48+
.classpth
49+
.mvn/timing.properties
50+
.mvn/wrapper/maven-wrapper.jar
51+
.project
52+
53+
buildNumber.properties
54+
dependency-reduced-pom.xml
55+
pom.xml.next
56+
pom.xml.tag
57+
pom.xml.releaseBackup
58+
pom.xml.versionsBackup
59+
release.properties
60+
61+
62+
### Weaver ###
63+
dist/
64+
65+
66+
### Project Specific ###
67+
.env*
68+
69+
!**/src/main/**
70+
!**/src/test/**

CONTRIBUTING.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<a name="readme-top"></a>
2+
# Contributing to Library Service Status System Service
3+
4+
Though *Library Service Status System Service* is developed and maintained by Texas A&M University Libraries, we welcome community contributions.
5+
Involvement in *Library Service Status System Service* can take many forms.
6+
7+
<div align="right">(<a href="#readme-top">back to top</a>)</div>
8+
9+
10+
## Using
11+
12+
Deploying *Library Service Status System Service* and trying it out at your own institution is itself a way of contributing to the development process.
13+
For more information on deployment strategies please see the [Deployment Guide][deployment-guide].
14+
15+
<div align="right">(<a href="#readme-top">back to top</a>)</div>
16+
17+
18+
## Filing Issues
19+
20+
Once you are using *Library Service Status System Service* the creation of new issues through GitHub is a major method of contribution towards *Library Service Status System Service* development.
21+
Issues can be motivated by the discovery of a bug in the software, or by the desire to see either new features added or see changes to existing features.
22+
23+
There are two primary types of issues:
24+
1. Bug Report
25+
2. Feature Request
26+
27+
A **Bug Report** involves a problem with the existing software or a **Feature** is not working as designed or expected.
28+
29+
A **Feature** involves new functionality or behavior.
30+
31+
<div align="right">(<a href="#readme-top">back to top</a>)</div>
32+
33+
34+
## Creating a Pull Request
35+
36+
Community code and documentation contributions are welcome and should take the form of a **GitHub Pull Request** (*PR*).
37+
Each *PR* will need to be reviewed by a *Library Service Status System Service* developer.
38+
A review will result in the *PR* being accepted and merged, a descriptive request for changes, or the *PR* being closed along with a detailed explanation.
39+
40+
It is our intention to maintain labeling on issues that are deemed to be low difficulty in order to provide a good point of entry for those looking to begin contributing code or documentation.
41+
42+
A *PR* description should include a list of the specific issues resolved, the predicted *semantic versioning* impact of the changes, and a description which characterizes the nature of the changes made.
43+
When creating a *PR*, an issue template is automatically provided to simplify this process.
44+
45+
For more information about *semantic versioning* please see [Semantic Versioning Website][semantic-versioning].
46+
In general keep in mind:
47+
48+
- A **Major Change** is a breaking change that is not backwards compatible.
49+
- A **Minor Change** is a non-breaking change that is backwards compatible to the last **Major Change**.
50+
- A **Patch** is a trivial change or bug fix that should not impact compatibility.
51+
52+
<div align="right">(<a href="#readme-top">back to top</a>)</div>
53+
54+
55+
## Good Luck!
56+
57+
We look forward to seeing your contributions.
58+
If you have any additional questions please contact the *Library Service Status System Service* developers at helpdesk@library.tamu.edu.
59+
60+
<div align="right">(<a href="#readme-top">back to top</a>)</div>
61+
62+
63+
<!-- LINKS -->
64+
[deployment-guide]: DEPLOYING.md
65+
[semantic-versioning]: https://semver.org/

DEPLOYING.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<a name="readme-top"></a>
2+
# Library Service Status System Service Deployment Guide
3+
4+
## Production Deployments
5+
6+
For **production** deployments, deploy using `docker-compose` via the [LSSS App Repo][app-repo].
7+
This is the recommended method of deployment for production systems.
8+
Go to the [LSSS App Repo][app-repo] and following the deployment instructions there.
9+
10+
Performing the deployment using the [LSSS App Repo][app-repo] should be something similar to the following:
11+
```shell
12+
docker-compose up
13+
```
14+
15+
The **development** deployment can also use `docker-compose` in the same way.
16+
17+
<div align="right">(<a href="#readme-top">back to top</a>)</div>
18+
19+
20+
## Development Deployment using Docker
21+
22+
To manually use `docker` rather than `docker-compose`, run the following:
23+
24+
```shell
25+
docker image build -t lsssservice .
26+
docker run -it lsssservice
27+
```
28+
29+
<sub>_* Note: `-t lsssservice` and `-it lsssservice` may be changed to another tag name as desired, such as `-t developing_on_this` and `-it developing_on_this`._</sub><br>
30+
31+
<div align="right">(<a href="#readme-top">back to top</a>)</div>
32+
33+
34+
## Development Deployment using Maven
35+
36+
Manual deployment can be summed up by running:
37+
38+
```shell
39+
mvn spring-boot:run
40+
```
41+
42+
Those steps are a great way to start but they also fail to explain the customization that is often needed.
43+
There are multiple ways to further configure this for deployment to better meet the desired requirements.
44+
45+
It is highly recommended only to perform *manual installation* when developing.
46+
For **production** deployment, please use `docker-compose` via the [LSSS App Repo][app-repo] or use the **Docker** method above.
47+
48+
<div align="right">(<a href="#readme-top">back to top</a>)</div>
49+
50+
51+
### Directly Configuring the `src/main/resources/application.yml` File
52+
53+
This method of configuration works by altering the configuration file.
54+
55+
With this in mind, the deployment steps now look like:
56+
57+
```shell
58+
# Edit 'src/main/resources/application.yml' here.
59+
60+
mvn spring-boot:run
61+
```
62+
63+
<div align="right">(<a href="#readme-top">back to top</a>)</div>
64+
65+
66+
<!-- LINKS -->
67+
[app-repo]: https://github.com/TAMULib/LibraryServiceStatusSystem

Dockerfile

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
11
# Settings.
22
ARG USER_ID=3001
33
ARG USER_NAME=lsss
4-
ARG HOME_DIR=/$USER_NAME
5-
ARG SOURCE_DIR=$HOME_DIR/source
4+
ARG SOURCE_DIR=/$USER_NAME/source
65

76
# Maven stage.
87
FROM maven:3-openjdk-11-slim as maven
98
ARG USER_ID
109
ARG USER_NAME
11-
ARG HOME_DIR
1210
ARG SOURCE_DIR
1311

14-
# Create the group (use a high ID to attempt to avoid conflits).
15-
RUN groupadd -g $USER_ID $USER_NAME
12+
# Create the user and group (use a high ID to attempt to avoid conflicts).
13+
RUN groupadd --non-unique -g $USER_ID $USER_NAME && \
14+
useradd --non-unique -d /$USER_NAME -m -u $USER_ID -g $USER_ID $USER_NAME
1615

17-
# Create the user (use a high ID to attempt to avoid conflits).
18-
RUN useradd -d $HOME_DIR -m -u $USER_ID -g $USER_ID $USER_NAME
16+
# Update the system and install dependencies.
17+
RUN apt-get update && \
18+
apt-get upgrade -y && \
19+
apt-get clean && \
20+
rm -rf /var/lib/apt/lists/*
1921

20-
# Update the system.
21-
RUN apt-get update && apt-get upgrade -y
22+
# Make sure source directory exists.
23+
RUN mkdir -p $SOURCE_DIR && \
24+
chown -R $USER_ID:$USER_ID $SOURCE_DIR
2225

2326
# Set deployment directory.
2427
WORKDIR $SOURCE_DIR
@@ -40,24 +43,20 @@ RUN mvn package -Pjar -DskipTests=true
4043
FROM openjdk:11-jre-slim
4144
ARG USER_ID
4245
ARG USER_NAME
43-
ARG HOME_DIR
4446
ARG SOURCE_DIR
4547

46-
# Create the group (use a high ID to attempt to avoid conflits).
47-
RUN groupadd -g $USER_ID $USER_NAME
48-
49-
# Create the user (use a high ID to attempt to avoid conflits).
50-
RUN useradd -d $HOME_DIR -m -u $USER_ID -g $USER_ID $USER_NAME
48+
# Create the user and group (use a high ID to attempt to avoid conflicts).
49+
RUN groupadd --non-unique -g $USER_ID $USER_NAME && \
50+
useradd --non-unique -d /$USER_NAME -m -u $USER_ID -g $USER_ID $USER_NAME
5151

5252
# Login as user.
5353
USER $USER_NAME
5454

5555
# Set deployment directory.
56-
WORKDIR $HOME_DIR
56+
WORKDIR /$USER_NAME
5757

5858
# Copy over the built artifact from the maven image.
5959
COPY --from=maven $SOURCE_DIR/target/ROOT.jar ./lsss.jar
6060

61-
6261
# Run java command.
6362
CMD ["java", "-jar", "./lsss.jar"]

LICENSE

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
Copyright (c) 2016 Texas A&M University Libraries
1+
The MIT License (MIT)
2+
Copyright © 2022 Texas A&M University Libraries
23

3-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
45

56
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
67

7-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8+
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)