Skip to content

Commit 01387dc

Browse files
authored
readme: artifactory disk usage
1 parent 1e86502 commit 01387dc

File tree

1 file changed

+91
-23
lines changed

1 file changed

+91
-23
lines changed

README.md

Lines changed: 91 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,29 +24,29 @@ But we still need it because
2424
<details>
2525
<summary>Add the following to your <code>~/.ssh/config</code></summary>
2626

27-
```
28-
Host jenkins-master
29-
HostName 54.67.111.226
30-
User admin
31-
32-
Host jenkins-worker-behemoth-1
33-
HostName 54.153.2.9
34-
User admin
35-
36-
Host jenkins-worker-behemoth-2
37-
HostName 54.153.1.99
38-
User admin
39-
40-
Host jenkins-worker-behemoth-3
41-
HostName 54.183.156.89
42-
User admin
43-
44-
# no public ip, jumphost through master
45-
Host influxdb
46-
HostName 172.31.0.100
47-
User ubuntu
48-
ProxyCommand ssh -q -W %h:%p jenkins-master
49-
```
27+
```
28+
Host jenkins-master
29+
HostName 54.67.111.226
30+
User admin
31+
32+
Host jenkins-worker-behemoth-1
33+
HostName 54.153.2.9
34+
User admin
35+
36+
Host jenkins-worker-behemoth-2
37+
HostName 54.153.1.99
38+
User admin
39+
40+
Host jenkins-worker-behemoth-3
41+
HostName 54.183.156.89
42+
User admin
43+
44+
# no public ip, jumphost through master
45+
Host influxdb
46+
HostName 172.31.0.100
47+
User ubuntu
48+
ProxyCommand ssh -q -W %h:%p jenkins-master
49+
```
5050

5151
</details>
5252

@@ -86,12 +86,80 @@ The config file is `/opt/jfrog/artifactory/var/etc/system.yaml`.
8686

8787
The `access` service has its own db at `/opt/jfrog/artifactory/var/data/access/derby`.
8888

89+
#### Disk Usage
90+
91+
Artifactory disk usage report: https://scala-ci.typesafe.com/ui/admin/monitoring/storage-summary.
92+
93+
<details>
94+
<summary>Steps to delete old builds from <code>scala-pr-validation-snapshots</code>:</summary>
95+
96+
Create a file `search.json`, adjust the cutoff date on the last line:
97+
98+
```
99+
items.find({
100+
"repo": "scala-pr-validation-snapshots",
101+
"$or": [ { "name": { "$match": "scala-compiler*" } }, {"name": { "$match": "scala-reflect*" } }, { "name": { "$match": "scala-library*" } }, { "name": { "$match": "scala-dist*" } }, { "name": { "$match": "scala-partest*" } }, { "name": { "$match": "scalap*" } } ],
102+
"created": { "$lt": "2020-01-01" }
103+
})
104+
```
105+
106+
`curl -u 'lukas:SEEEKREET' -X POST "https://scala-ci.typesafe.com/artifactory/api/search/aql" -T search.json > artifacts.json`
107+
108+
In an up-to-date Scala 2.13.x checkout, the following tests which of the artifacts correspond to revisions that were actually merged into scala/scala. Builds for those revisions are kept, builds for revisions that never made it are added to `to-delete.txt`.
109+
110+
```bash
111+
n=$(cat artifacts.json | jq -r '.results[] | .path' | uniq | wc -l)
112+
for p in $(cat artifacts.json | jq -r '.results[] | .path' | uniq); do
113+
n=$((n-1))
114+
sha=$(echo $p | awk -F'-' '{print $(NF-1)}')
115+
if git branch --contains $sha | grep 2.13.x > /dev/null; then
116+
echo "$sha y - $n"
117+
else
118+
echo "$sha n - $n"
119+
echo $p >> to-delete.txt
120+
fi
121+
done
122+
```
123+
124+
Delete the artifacts; best run it on `ssh jenkins-master` for performance.
125+
126+
```bash
127+
n=$(cat to-delete.txt | wc -l)
128+
for p in $(cat to-delete.txt); do
129+
n=$((n-1))
130+
echo "$p - $n"
131+
curl -u 'lukas:PASSWORDSEKRET' -X DELETE "https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/$p"
132+
done
133+
```
134+
135+
After that
136+
- Empty "Trash Can"
137+
- `curl -I -u 'lukas:SEEEKREET' -X POST "https://scala-ci.typesafe.com/artifactory/api/trash/empty"`
138+
- Run artifactory's "Garbage Collection" [20 times (😆)](https://jfrog.com/knowledge-base/why-does-removing-deleting-old-artifacts-is-not-affecting-the-artifactory-disk-space-usage/)
139+
- `for i in {1..20}; do curl -I -u 'lukas:SEEEKREET' -X POST "https://scala-ci.typesafe.com/artifactory/api/system/storage/gc"; done`
140+
- wait for it to complete, it runs in the background. check Binaries Size / Artifacts Size in Storage
141+
- Run "Prune Unreferenced Data"
142+
- `api/system/storage/optimize`
143+
- https://jfrog.com/knowledge-base/what-is-the-difference-between-garbage-collector-and-prune-unreferenced-data-processes-in-artifactory/
144+
145+
Other measures
146+
- Artifacts - Trash Can - right click - Empty
147+
- Derby database (`/var/opt/jfrog/artifactory/data/derby/seg0`) may be big. Admin - Advanced - Maintenance, run "Compress the Internal Database".
148+
- Did not work for me. "lock could not be obtained due to a deadlock".
149+
- Doc says "We recommend running this when Artifactory activity is low, since compression may not be able to complete when storage is busy (in which case the storage will not be affected)."
150+
151+
</details>
152+
89153
### Scabot
90154

91155
[Scabot](https://github.com/scala/scabot) triggers Jenkins builds and updates their state on github commits / PRs.
92156

93157
## Details
94158

159+
### Disk usage
160+
161+
Use `ncdu -x /path` to analyze disk usage.
162+
95163
### Unattended Upgrades
96164

97165
Enabled on master and behemoths

0 commit comments

Comments
 (0)