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

Compress Database Location Files #954

Merged
merged 12 commits into from
Nov 28, 2024
Merged

Compress Database Location Files #954

merged 12 commits into from
Nov 28, 2024

Conversation

refringe
Copy link
Contributor

Due to LFS storage issues... This PR removes all current LFS files (the location loot files) and replaces them with a single 7-zip archive. The archive is stored in LFS, but has decreased in size by roughly 95%.

The location .json files are now git-ignored.

There are two new npm commands to aid in working with the archive:

  • npm run database:compress
    Compresses the JSON files into an archive which can be committed into the project.
  • npm run database:decompress
    Decompresses the archive into the original JSON files located in the working directory.

The gulp file that handles builds has been updated to ensure that the archive files are always used when a build is processed, regardless of if the JSON files are already present in the working directory.

Adds two NPM scripts to handle compressing and decompressing the locations data in a reproducible way.

Needs to be tested on Windows.
Does not remove them from history.
The location of the compressed file now resides in a folder structure that mimics the database. Just incase other files are added in the future.
This class is responsible for decompressing database archives. It's initialized on server start, but the decompression mechanism only fires when the target database directory is empty. Adds roughly 1.5 seconds to initial server start (in my limited testing).

The gulp build script has been updated to ignore the location database files.

Needs to be tested.
Prevents certain hidden meta data files from getting caught up in the archive.
This gulp task runs before any of the database assets are copied over. It ensures that all database archives are decompressed into their respective directories. This means that the archive has priority when building. All files within the target database directories will be removed and replaced with the contents of the database archives.

Uses the same two dev dependancies as the NPM 'database' scripts.
@refringe refringe added enhancement New feature or request question Further information is requested labels Nov 28, 2024
@refringe refringe self-assigned this Nov 28, 2024
@refringe refringe changed the base branch from master to 3.10.1-dev November 28, 2024 00:29
@refringe
Copy link
Contributor Author

I'm on the fence about reintroducing the DatabaseDecompressionUtil class (that was eventually reverted) here:
d1c25da#diff-89eb317382d103aa79fde5a372b3e0e8a0f84127c89e54fed57fc789024a0b37

It could be modified to only run in a non-compiled environment, so that developers would not have to run the npm command after initially cloning the project. However, they would still have to remember to run the command manually after location data has been updated. Due to the 7-zip executable, it can not be ran after compilation.

I'm open to suggestions. Maybe this is good enough?

Copy link
Contributor

@DrakiaXYZ DrakiaXYZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good.

I could see it being useful having the 7z auto extract on run in the IDE to avoid potentially forgetting to extract updated DB files, but I wouldn't consider it a blocker to implementing this

Reintroduces the the `DatabaseDecompressionUtil` class. This baby will automatically decompress database archives if their target directory is empty or does not exist. It will only run in a non-compiled environment, so only developers (and 31337 linux h4x0rs) will be able to utilize it.
@refringe
Copy link
Contributor Author

I've reintroduced the the DatabaseDecompressionUtil class. It will automatically decompress database archives if their target directory is empty or does not exist. It will only run in a non-compiled environment, so only developers will be able to utilize it.

Compiled develop environment:
image

Win development environment /w empty locations directory:
image

Windows development environment /w existing locations data:
image

Ubuntu Linux run debug environment:
image

I'm happy with it. Should be ready for review.

@refringe refringe marked this pull request as ready for review November 28, 2024 15:22
@refringe refringe removed the question Further information is requested label Nov 28, 2024
@refringe refringe added this to the v3.10.1 milestone Nov 28, 2024
@chompDev chompDev merged commit f558615 into 3.10.1-dev Nov 28, 2024
0 of 4 checks passed
@chompDev chompDev deleted the compress-db-location branch December 1, 2024 10:35
@refringe refringe mentioned this pull request Dec 5, 2024
chompDev pushed a commit that referenced this pull request Dec 6, 2024
We've created our own Git Large File Storage (LFS) server due to the
excessive cost of GitHub's bandwidth. Did you know all of their Ethernet
cables are actually gold coated diamonds?

This PR reverses the work done in #954 to compress large location JSON
files into a 7zip archive and handle the (de)compression of the archive.

Only JSON files within the `project/assets/database/` directory that are
larger than 5MB have been included in LFS. This translates to all of the
`looseLoot.json` files. The rest are small enough to be included in the
base repo.

A `.lfsconfig` file has been added to the root of the project to alert
git to the presence of the custom LFS server. This public server is
read-only. Write access is only available to developers within the
Single Player Tarkov GitHub organization.

<img
src="https://github.com/user-attachments/assets/7ddfec9b-5a9a-42e6-806d-fd419e4eaa4f"
width="250">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants