|
|
Line 98: |
Line 98: |
|
| |
|
| <li><p>Reload the systemd service files.</p> | | <li><p>Reload the systemd service files.</p> |
| {{terminal|skin=noborder|text=<span class="noselect">'''$''' </span>sudo systemctl daemon-reexec}} | | {{terminal|skin=noborder|text=<span class="noselect">'''$''' </span>sudo systemctl daemon-reload}} |
| </li> | | </li> |
|
| |
|
Revision as of 22:47, 2 February 2022
Follow the instructions below to upgrade your cMix service file to use a custom hash file.
First, create a file that will contain custom hashes with nano or your favorite text editor.
$ /opt/xxnetwork/config/custom_hashes.json
Next, populate the file with a template that matches below.
GNU nano 4.8
opt/xxnetwork/config/custom_hashes.json
Modified
{
"BLOCKCHAIN_FILE_HASH": "CUSTOM_PATH",
}
^G Get Help
^X Exit
^O Write Out
^R Read File
^W Where Is
^\ Replace
^K Cut Text
^U Uncut Text
^J Justify
^T To Spell
^C Cur Pos
^_ Go To Line
Overwrite the template values with correct hashes and paths. Whenever the blockchain indicates your provided hash to be the current hash, the wrapper script will instead use the file at your specified path rather than the file provided from the blockchain. For example,
GNU nano 4.8
opt/xxnetwork/config/custom_hashes.json
Modified
{
"0xbff325726f814f76ee6a56a04690841bfe803c18716ed7240320dfd465fd59b8": "/tmp/gateway-custom.binary",
"0xefbc1be7b6922fbc70da224bcf00bdc3599326c35fcdb0747b549f05ad8b7ccd": "/tmp/wrapper-custom.binary"
}
^G Get Help
^X Exit
^O Write Out
^R Read File
^W Where Is
^\ Replace
^K Cut Text
^U Uncut Text
^J Justify
^T To Spell
^C Cur Pos
^_ Go To Line
When the blockchain reports 0xbff325726f814f76ee6a56a04690841bfe803c18716ed7240320dfd465fd59b8
to be the current gateway binary hash, the wrapper script will now use your custom gateway binary at /tmp/gateway-custom.binary
, and does the same for the wrapper script.
Next, the wrapper script config needs to be modified. To do so, open the cMix service file with nano or your favorite text editor.
$ nano /opt/xxnetwork/xxnetwork-cmix.service
Add the argument --hash-path /opt/xxnetwork/config/custom_hashes.json
to the config with the path pointing to the file from step 1.
GNU nano 4.8
xxnetwork-cmix.service
Modified
[Service]
User=ubuntu
Type=simple
ExecStart=/opt/xxnetwork/cmix-wrapper.py \
--err-path /opt/xxnetwork/log/cmix-err.log \
--cmd-dir /opt/xxnetwork/log/cmix-cmd \
--wrapper-log /opt/xxnetwork/log/cmix-wrapper.log \
--binary-path /opt/xxnetwork/bin/xxnetwork-cmix \
--gpu-lib /opt/xxnetwork/lib/libpowmosm75.so \
--gpu-bin /opt/xxnetwork/lib/libpow.fatbin \
--config-path /opt/xxnetwork/config/cmix.yaml \
--id-path /opt/xxnetwork/cred/cmix-IDF.json \
--log-path /opt/xxnetwork/log/cmix.log \
--management-cert /opt/xxnetwork/cred/network-management.crt \
--s3-access-key AKIAT3MRRAOJFPGK73FQ \
--s3-secret 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 \
--s3-region us-west-1 \
--s3-management-bucket elixxir-management-mainnet \
--s3-bin-bucket elixxir-bins \
--cloudwatch-log-group xxnetwork-logs-mainnet \
--tmp-dir /tmp/xxnetwork/cmix/ \
--hash-path /opt/xxnetwork/config/custom_hashes.jsonAdd this line and make it
point to the file from step 1.
^G Get Help
^X Exit
^O Write Out
^R Read File
^W Where Is
^\ Replace
^K Cut Text
^U Uncut Text
^J Justify
^T To Spell
^C Cur Pos
^_ Go To Line
Once the change is made, save the file by pressing Ctrl+X and when prompted to save the buffer, press Y. Finally, when prompted with the file name, press ↵ Enter.
Reload the systemd service files.
$ sudo systemctl daemon-reload
Finally, restart the wrapper script for your changes to take effect.
$ sudo systemctl restart xxnetwork-cmix.service
From now on, any changes made to the custom hash json file will be dynamically loaded without requiring a restart.
Incorrect operation may result in problems with your wrapper script. After making changes to the json file, ensure your wrapper script is operating correctly.