Downloads mods from nexus, parses the plugins inside, and saves data to a postgres database.
- Install and run postgres (v15 or later).
- Create postgres user and database (and add uuid extension while you're there ):
createuser modmapper
createdb modmapper
sudo -u postgres -i psql
postgres=# ALTER DATABASE modmapper OWNER TO modmapper;
postgres=# ALTER USER modmapper CREATEDB;
\password modmapper
# Or, on Windows in PowerShell:
& 'C:\Program Files\PostgreSQL\13\bin\createuser.exe' -U postgres modmapper
& 'C:\Program Files\PostgreSQL\13\bin\createdb.exe' -U postgres modmapper
& 'C:\Program Files\PostgreSQL\13\bin\psql.exe' -U postgres
postgres=# ALTER DATABASE modmapper OWNER TO modmapper;
postgres=# ALTER USER modmapper CREATEDB;
\password modmapper
- Save password somewhere safe and then and add a
.envfile to the project directory with the contents:
DATABASE_URL=postgresql://modmapper:<password>@localhost/modmapper
RUST_LOG=mod_mapper=debug
- Install
sqlx_cliwithcargo install sqlx-cli --no-default-features --features postgres - Run
sqlx migrate runwhich will run all the database migrations. - Get your personal Nexus API token from your profile settings and add it to
the
.envfile:
NEXUS_API_KEY=...
- Build the release binary by running
cargo build --release. - Run
./target/release/mod-mapper --backfill-is-base-gameto pre-populate the database with worlds and cells from the base game's Skyrim.esm. (This is so that the base game cells can later be differentiated from cells in plugins that also happen to be named Skyrim.esm and have cells that reference a world with the same form ID as Tamriel.) - See
./target/release/mod-mapper -hfor further commands or run./scripts/update.shto start populating the database with scraped mods and dumping the data to JSON files.
scripts/sync.sh and scripts/backup.sh both utilize rclone to transfer files that are generated on the machine running modmapper to separate servers for file storage.
For these scripts to run successfully you will need to install rclone and setup a remote for sync.sh (the "static server") and a remote for backup.sh (the "backup server"). Remotes can be created with the rclone config command. Then, make sure these variables are defined in the .env file corresponding to the remote names and buckets (or folders) within that remote you created:
STATIC_SERVER_REMOTESTATIC_SERVER_CELLS_BUCKETSTATIC_SERVER_MODS_BUCKETSTATIC_SERVER_PLUGINS_BUCKETSTATIC_SERVER_FILES_BUCKETBACKUP_SERVER_REMOTEBACKUP_SERVER_BUCKET
The scripts are monitored via healthchecks.io. It is free to set up, create an account and add a new check for each script with these slugs:
modmapper-updatemodmapper-syncmodmapper-backup
Then add the project's ping key which you can generate in the settings to the .env file under HEALTHCHECKS_PING_KEY.
The scripts can be run on a schedule via cron. To edit the crontab for the current user run crontab -e and add these lines to run the scripts at the specified intervals:
0 2 * * * cd /path/to/modmapper && ./scripts/update.sh && ./scripts/sync.sh && ./scripts/backup.sh