How to Persist Device IDs and Node IDs Across Container Restarts in InternetIncome
InternetIncome automatically preserves device and node identifiers by writing them to backup files and folders in the script directory, then re-mounting these assets during container creation to maintain consistent identities across Docker restarts.
InternetIncome is an open-source bandwidth monetization framework that runs earning services in isolated Docker containers. Because containers are ephemeral and recreated on every restart, services like EarnApp, Mysterium, and ProxyRack would normally generate new device or node IDs, losing your reputation and earnings history. The script solves this by implementing a persistence layer that stores these critical identifiers in local storage and automatically restores them when you run internetIncome.sh --start.
Understanding the Persistence Mechanism in InternetIncome
The persistence system relies on two arrays defined early in internetIncome.sh that catalog which assets must survive container recreation. The back_up_folders array (line 62) tracks directories containing node databases and cryptographic state, while the back_up_files array (line 63) tracks simple text files storing UUIDs and referral URLs.
When you execute the script with the --start flag, it checks for the existence of these backup locations before launching Docker containers. If a backup is found, the script either bind-mounts the folder into the container or reads the identifier from the file and injects it via environment variables or command-line arguments. This ensures that even though Docker creates fresh containers from the image, the services inside retain their historical identities and configuration.
Where Device and Node Identifiers Are Stored
InternetIncome employs two distinct storage strategies depending on the complexity of the service's state requirements.
File-Based Persistence for EarnApp and ProxyRack
Services requiring only a simple UUID or referral URL store their identifiers in plain-text files:
-
EarnApp: The device URL is written to
earnapp.txtin the script directory. Each line contains a timestamp and the referral URL (https://earnapp.com/r/<UUID>). On subsequent runs, the script extracts the UUID usingsedandgrep(lines 1062-1077 ininternetIncome.sh) and passes it to the container via the--device-nameand--device-idflags. -
ProxyRack: The UUID is stored in
proxyrack.txtusing an identical format. The script reads this value (lines 675-698) and supplies it to the container as theUUIDenvironment variable.
Folder-Based Persistence for Node Services
Services maintaining internal databases or cryptographic keys require entire directories to be preserved:
-
Mysterium: Creates a per-instance directory at
mysterium-data/node<N>/(line 295). This folder contains the node's database and configuration files. The script bind-mounts this directory to/var/lib/mysterium-nodeinside the container, ensuring the node UUID and state survive recreation. -
Traffmonetizer: Uses the
traffmonetizerdata/folder to store device tokens, mounted to/app/datain the container. -
Titan Edge: Stores its device hash in
titan-data/, which preserves the binding hash required for account association. -
BitPing, URNetwork, and others: Each service has a dedicated folder listed in the
back_up_foldersarray (line 62), ensuring their respective node-specific identifiers remain intact across restarts.
How InternetIncome Reuses Persisted IDs on Restart
The restoration process occurs automatically during the container initialization phase. When internetIncome.sh --start detects existing backup assets, it orchestrates their reuse through specific injection methods.
For file-based services like EarnApp, the script parses the stored URL to extract the UUID:
uuid=$(sed "${i}q;d" $earnapp_file | grep -o 'https[^[:space:]]*' \
| sed 's|https://earnapp.com/r/||g')
This extracted identifier is then passed to the Docker run command as --device-name $DEVICE_NAME$i --device-id $DEVICE_NAME$i, ensuring the EarnApp service recognizes the container as the same device from previous sessions.
For folder-based services, the script constructs a bind mount that overlays the persisted data onto the container's expected data path. For example, Mysterium containers receive --mount type=bind,source=$mysterium_data_folder/node$i,target=/var/lib/mysterium-node, allowing the node to access its historical database and cryptographic identity immediately upon startup.
Resetting and Managing Your Device Identifiers
While persistence maintains your earning reputation, certain scenarios—such as account migration, troubleshooting, or intentional device rotation—require generating fresh identifiers.
Viewing Current Persisted IDs
To inspect your current identifiers without modifying them:
# View EarnApp device URL and UUID
cat earnapp.txt
# View ProxyRack UUID
cat proxyrack.txt
# List Mysterium node data folders
ls -la mysterium-data/
# Check Traffmonetizer tokens
ls -la traffmonetizerdata/
Removing Specific Service Backups
To reset a single service while preserving others, delete only its specific backup asset:
# Reset only EarnApp (removes device ID)
rm earnapp.txt
# Reset only Mysterium node 1
rm -rf mysterium-data/node1
# Restart to generate fresh IDs for these services only
sudo bash internetIncome.sh --start
Complete Reset of All IDs
To wipe all persisted identifiers and start with completely fresh containers:
# Stop and remove all running containers
sudo bash internetIncome.sh --delete
# Remove all backup files and folders (safety check at lines 1314-1356)
sudo bash internetIncome.sh --deleteBackup
The --deleteBackup command includes guard logic that verifies no containers are currently running before removing data, preventing accidental deletion of active node identities.
Summary
- InternetIncome automatically persists device IDs and node IDs by storing them in backup files and folders within the script directory.
- File-based persistence (
earnapp.txt,proxyrack.txt) captures UUIDs for services like EarnApp and ProxyRack, which are then injected into containers via command-line arguments. - Folder-based persistence (
mysterium-data/,traffmonetizerdata/,titan-data/) preserves entire database states for node services using Docker bind mounts. - The script checks these backup locations during
internetIncome.sh --startand reuses existing identifiers to maintain consistent service identity across container recreations. - Use
internetIncome.sh --deleteBackupto reset identifiers, with built-in safety checks to prevent data loss while containers are running.
Frequently Asked Questions
What happens if I delete the backup files?
If you delete the backup files or folders (such as earnapp.txt or mysterium-data/), the next execution of internetIncome.sh --start will not find existing identifiers and will generate new ones. This causes the services to register as new devices or nodes, potentially requiring re-authorization with your account and resetting any reputation or earnings history associated with the previous IDs.
Can I manually edit the device IDs?
Yes, you can manually edit the backup files to replace identifiers. For example, you can modify earnapp.txt to replace the referral URL with a different UUID, or restore contents to mysterium-data/node1/ from a previous backup. Ensure the format matches what the service expects, and always stop the relevant container before editing to avoid file corruption or lock conflicts.
Why does Mysterium use a folder instead of a text file?
Mysterium maintains its node identity in an internal SQLite database (node.db) along with cryptographic keys and configuration files required for the VPN service. Unlike simple UUIDs that can be stored in plain text, Mysterium's state requires preserving multiple interdependent files. The script therefore bind-mounts the entire mysterium-data/node<N>/ directory to /var/lib/mysterium-node in the container, ensuring the complete node state survives container recreation.
How do I migrate my IDs to a new server?
To migrate your identifiers to a new server, copy the entire set of backup files and folders from the original script directory to the new server before running internetIncome.sh --start. Specifically, copy earnapp.txt, proxyrack.txt, and all data directories (mysterium-data/, traffmonetizerdata/, titan-data/, etc.). Ensure the DEVICE_NAME variable in properties.conf matches the original configuration, as the script uses this value to index multiple instances and associate them with the correct backup assets.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →