๐ŸŒด
Guardian-dev
  • Guardian
    • ๐ŸŒGetting Started
      • ๐Ÿœ๏ธDiscovering Environmental assets on Hedera
      • ๐ŸŽ“Guardian Glossary
      • ๐Ÿ“–Installation Guide
        • ๐Ÿ—’๏ธPrerequisites
        • ๐Ÿ› ๏ธInstallation
          • ๐Ÿ”จBuilding from source and run using Docker
            • Deploying Guardian using default Environment
            • Deploying Guardian using a specific Environment ( DEVELOP )
            • Deploying Guardian using a specific Environment (QA)
          • ๐Ÿ”จBuilding from Pre-build containers
          • ๐Ÿ”จBuild executables and run manually
          • โ˜๏ธCloud Deployment
          • โฌ†๏ธUpgrading
          • ๐Ÿ”™Backup tools
          • ๐ŸกSetting up environment parameters
          • ๐Ÿ“Summary of URLs and Ports
          • ๐Ÿ’ปLaunching Guardian
          • ๐ŸงชHow to perform Unit Tests?
        • ๐Ÿ”จHow to Configure Hedera Local Node
        • ๐Ÿ”จHow to Configure HashiCorp Vault
        • ๐Ÿ”จHow to create Operator ID and Operator Key
        • ๐Ÿ”จHow to generate Web3.Storage API values
        • ๐Ÿ”จHow to Change Explorer URL
        • ๐Ÿ”จHow to Restore Account from Database/Hashicorp Vault during Setup
      • ๐Ÿ™Contributing
        • ๐Ÿš‡Contribute a New Policy
      • ๐Ÿ“–Frameworks/Libraries
        • ๐Ÿ’ปGuardian CLI
      • โš™๏ธAPI Guideline
      • ๐Ÿ”Guardian Vault
      • ๐ŸŒŽEnvironments
        • ๐ŸŒŽMulti session consistency according to Environment
        • ๐Ÿ”‘Dynamic Vault/KMS path configuration according to the environment
        • ๐ŸกEcosystem Environments
      • ๐Ÿ“ƒChange Log
      • ๐Ÿ›ฃ๏ธRoadmap
      • ๐ŸšจLicense
      • ๐Ÿ“žContact
      • ๐Ÿ”Security
      • ๐Ÿ”‘Meeco authentication
        • ๐Ÿ”กHow it works
    • ๐Ÿ‘ทArchitecture
      • โฌ‡๏ธDeep Dive Architecture
      • ๐Ÿ”บHigh Level Architecture
      • ๐Ÿ‘Policies,Projects and Topics Mapping Architecture
      • โž—MRV Splitting Logic
      • ๐Ÿ”‘Internal (with Vault)Signing Sequence Diagram
      • ๐Ÿ”ฅFireBlocks Signing Sequence Diagram
    • ๐Ÿ“‡Global Indexer
      • ๐Ÿ’ปIndexer User Guide
      • โš™๏ธIndexer APIs
        • Full Text Indexer Search
        • Returns Standard Registries
        • Returns Registry as per MessageID
        • Returns Registry Users
        • Returns Registry User as per MessageID
        • Returns Policies
        • Returns policy as per MessageID
        • Returns Tools
        • Returns Tool as per MessageID
        • Returns Modules
        • Returns Module as per MessageID
        • Returns Schemas
        • Returns Schema as per MessageID
        • Returns Schema Tree
        • Returns Tokens
        • Returns Token as per TokenID
        • Returns Roles
        • Returns Role as per MessageID
        • Returns DIDs
        • Returns DID as per MessageID
        • Returns DID Relationships
        • Returns VP Documents
        • Returns VP Document as per MessageID
        • Returns VP Relationships
        • Returns VC Documents
        • Returns VC Document as per MessageID
        • Returns VC Relationships
        • Returns NFTs
        • Returns NFT as per Serial No.
        • Returns Topics
        • Returns Topic as per TopicID
        • Returns Contracts
        • Returns Contract as per MessageID
        • Returns Landing Page Analytics
        • Returns Project Coordinates
        • Returns Search Policy Results
        • Attempts to refresh linked files for the selected documents
        • Returns Hedera Network
        • Returns Hedera Network Explorer Settings
        • Returns Data Loading Progress Result
        • Returns Registry Relationships
        • Returns Policy Relationships
        • Retrieve the list of formulas
        • Retrieve the formula by message ID
        • Retrieve linked documents which are related to formula
        • Returning Topic Data Priority Loading Progress
        • Adding Topic Data Priority Loading
        • Adding Policy Data for Priority Loading
        • Adding Token Data for Priority Loading
        • Adding Document to Data Priority Loading
    • ๐Ÿ—บ๏ธMap Related APIs
      • Returning map API Key
      • Returning Sentinel API Key
    • ๐Ÿ—„๏ธStandard Registry
      • ๐Ÿ› ๏ธSchemas
        • ๐Ÿ“‚Available Schema Types
        • ๐Ÿ“‚Property Glossary
        • โ„น๏ธTypes of Schemas
        • โ„น๏ธSchema Versioning & Deprecation Policy
        • ๐Ÿ“นHow to design a Schema of a Methodology
        • ๐Ÿ’ปCreating Schema using UI
        • โš™๏ธSchema APIs
          • Listing of Schema
          • Publishing Schema based on Schema ID
          • Updating Schema
          • Deleting a Schema
          • Schema Preview from IPFS
          • Schema Preview from Zip
          • Export message IDs of Schema
          • Export Files from Schema
          • Creation of Schema related to the topic
          • Returns all Schemas related to the topic
          • Importing Zip file containing Schema
          • Importing Schema from IPFS
          • Returning Schema by SchemaID
        • โš™๏ธSystem Schema APIs
          • Returns Schema by Type
          • Creates New System Schema
          • Returns Schema by Username
          • Updates the Schema
          • Delete System Schema
          • Publishes the Schema
          • Schema Type
          • Returns Map API Key
        • โš™๏ธSchema APIs for Asynchronous Execution
          • Creation of Schema
          • Publishing Schema
          • Previews the Schema from IPFS
          • Importing Schema from IPFS
          • Importing Schema from .zip
        • ๐Ÿ“Schema Differentiation
          • ๐Ÿ’ปSchema Differentiation using UI
          • โš™๏ธSchema Differentiation APIs
            • Compare Schemas
            • Exports Schema Differentiation Results
        • ๐Ÿ“Example Data
          • ๐Ÿ’ปAdding Example data using UI
        • ๐Ÿ“‚Schema Tree
          • ๐Ÿ’ปSchema Tree UI
          • โš™๏ธAPI for Returning Schema Tree
        • ๐Ÿ“Tag Schema
          • ๐Ÿ’ปCreating Tag Schemas using UI
          • โš™๏ธSchema Tags APIs
            • Returning all Schema Tags
            • Creating new Schema Tag
            • Deleting Schema Tag
            • Updating Schema Tag
            • Publishing Schema
            • Returning list of published schemas
        • Schema Predefined Values using UI
        • Schema Rules
          • Defining Schema Rules using UI
          • APIs related to Schema Rules
            • Creation of the new schema rule
            • Retrieve the schema rules
            • Retrieve the configuration of the rule by its ID
            • Update the configuration of the rule with the corresponding ID
            • Delete the rule by its ID
            • Activate the rule with the specified ID
            • Deactivate the rule with the specified ID
            • List all the schemas and policy relevant to the rule with the specified ID
            • Retrieve all the data needed for evaluating the rules
            • Create a new rule from the file
            • Load the file and return its preview
            • Export the selected rule (by ID) into the file
      • ๐Ÿ› ๏ธPolicies
        • ๐ŸŽ“Policy Glossary
        • ๐Ÿ“Versioning and Deprecation Policy
          • โ„น๏ธPolicy Versioning & Deprecation Policy
          • โ„น๏ธAPI Versioning & Deprecation Policy
          • โ„น๏ธInternal APIs Versioning & Deprecation Policy
        • ๐Ÿ”ฉPolicy Creation
          • ๐Ÿ”„Available Policy Workflow Blocks
            • InterfaceContainerBlock
            • PolicyRolesBlock
            • InterfaceStepBlock
            • requestVCDocumentBlock
            • sendToGuardianBlock
            • reassigningBlock
            • InformationBlock
            • InterfaceDocumentsSourceBlock
            • paginationAddon
            • DocumentsSourceAddOn
            • filtersAddOnBlock
            • InterfaceActionBlock
            • externalDataBlock
            • retirementDocumentBlock
            • calculateContainerBlock & calculateMathAddOnBlock
            • reportBlock & reportItemBlock
            • switchBlock
            • aggregateDocumentBlock
            • TimerBlock
            • revokeBlock
            • setRelationshipsBlock
            • buttonBlock
            • documentValidatorBlock
            • tokenActionBlock
            • tokenConfirmationBlock
            • mintDocumentBlock
            • Events
            • groupManagerBlock
            • multiSignBlock
            • customLogicBlock
            • splitBlock
            • wipeDocumentBlock
            • Create Token Block
            • impactAddon
            • Http Request Block
            • historyAddon
            • selectiveAttributes Block
            • tagsManagerBlock
            • extractDataBlock
            • externalTopicBlock
            • messagesReportBlock
            • notificationBlock
            • Button Block Addon (buttonBlockAddon)
            • Dropdown Block Addon (dropdownBlockAddon)
            • Request Vc Document Block Addon (requestVcDocumentBlockAddon)
            • Data Transformation Addon
          • ๐Ÿ’ปCreating Policy using UI
          • ๐Ÿ’ปCreating a Policy through Policy Configurator
            • Getting Started with the Policy Workflows
            • Policy Workflow Step 1
            • Policy Workflow Step 2
            • Policy Workflow Step 3
            • Policy Workflow Step 4
            • Policy Workflow Step 5
            • Policy Workflow Step 6
            • Policy Workflow Step 7
            • Policy Workflow Step 8
            • Policy Workflow Step 9
            • Policy Workflow Step 10
            • Policy Workflow Step 11
            • Policy Workflow Step 12
            • Policy Workflow Step 13
            • Policy Workflow Step 14
            • Policy Workflow Step 15
            • Policy Workflow Step 16
            • Policy Workflow Step 17
            • Policy Workflow Step 18
            • Policy Workflow Step 19
            • Policy Workflow Step 20
            • Policy Workflow Step 21
            • Policy Workflow Step 22
            • Policy Workflow Step 23
            • Policy Workflow Step 24
            • Policy Workflow Step 25
            • Policy Workflow Wrap Up
          • โš™๏ธCreating a Policy using APIs
            • Prerequesite Steps
            • Creation of a Policy
            • Policy Listing
            • Import a Policy from IPFS
            • Policy Preview from IPFS
            • Retrieves Policy Configuration
            • Updates Policy Configuration
            • Publish a Policy
            • Policy Validation
            • Retrieval of Data for Root Policy Block
            • Request Block Data
            • Sends Data to Specified Block
            • Returns Block ID by tag
            • Exporting Message ID
            • Export to zip file
            • Import from zip file
            • Retrieves Block Data by Tag
            • Sends Data to specified Block by Tag
            • Returns list of Groups of a particular user
            • Make the selected Group active
            • Creating link between policies
            • Requesting Multi Policy Config
            • Importing Policy from a Zip file with Metadata
          • โš™๏ธAPIs for Asynchronous Execution
            • Creates new Policy
            • Publishing a Policy
            • Importing a Policy from IPFS
            • Importing a Policy from file
            • Policy Review
            • Importing Policy from a Zip file with Metadata
        • ๐Ÿ“Dry Run
          • ๐Ÿ’ปDry Run Mode using UI
          • โš™๏ธDry Run Mode using APIs
            • Running Policy without making any changes
            • Returning all Virtual Users
            • Creating Virtual Account
            • Logging Virtual User
            • Restarting the execution of Policy
            • Returns List of Transactions
            • Returns List of Artifacts
            • Returns List of IPFS Files
            • Returning Policy to Editing
            • Create Savepoint
            • Returns Savepoint State
            • Restoring SavePoint
            • Deletes SavePoint
        • ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘Roles and Groups
          • ๐Ÿ’ปCreating Roles and Groups using Policy Configurator UI
        • ๐Ÿ“Record/Replay
          • ๐Ÿ’ปPolicy execution record and replay using UI
          • โš™๏ธRecord/Replay APIs
            • Get Recording
            • Start Recording
            • Stop Recording
            • Get Recorded Actions
            • Run record from zip file
            • Stop Running
            • Get Running Results
            • Get Running Details
            • Fast Forward
            • Retry Step
            • Skip Step
        • ๐Ÿ“Global Policy Search & Compare
          • ๐Ÿ’ปGlobal search and comparison UI
          • ๐Ÿ’ปPolicy Differentiation using UI
          • โš™๏ธPolicy Compare and Search APIs
            • Comparing Policies
            • Searching Policies
            • Exports Comparison results
        • ๐Ÿ”Block/Policy Discoverability
          • ๐Ÿ’ปSearch Policy using UI
          • โš™๏ธSearch Policy APIs
            • Search Policy
          • ๐Ÿ’ปSearch Block using UI
          • โš™๏ธSearch Block APIs
            • Searching Same Blocks
        • ๐Ÿ“‚Document Comparison
          • ๐Ÿ’ปDocument Comparison using UI
          • โš™๏ธDocument Comparison APIs
            • Compare Documents
            • Export Comparison Results
        • ๐Ÿ“‚Tools
          • ๐Ÿ’ปTools using UI
          • โš™๏ธTools APIs
            • Creating new Tool
            • Returns list of tools
            • Creating new tool asynchronously
            • Deletes the Tool
            • Retrieves Tool Configuration
            • Updates Tool Configuration
            • Publishes Tool onto IPFS
            • Publishes Tool into IPFS asynchronously
            • Validates Selected Tool
            • Returns Tools and its artifacts in zip format
            • Retrieves Hedera Message ID
            • Previews Imported Tool from IPFS
            • Imported Tool from IPFS
            • Previews Imported Tool from Zip
            • Importing Tool from Zip
            • Imports new tool from Zip Asynchronously
            • Imports new tool from IPFS Asynchronously
            • Returns List of Tools
            • Importing Tool from a Zip file
            • Importing Tool from a Zip file asynchronously
        • ๐Ÿ“Modules
          • ๐Ÿ’ปModules using UI
          • โš™๏ธModules APIs
            • Returns all Modules
            • Creating new Module
            • Returns Module Menu
            • Retrieves Module Configuration
            • Updates Module Configuration
            • Delete the Module
            • Publishing Module onto IPFS
            • Returns Hedera ID for specific Module
            • Exporting Module in zip format
            • Import Module from IPFS
            • Import module from zip file
            • Preview Module from IPFS
            • Preview Module from zip file
            • Validates Module
          • ๐Ÿ“Modules Differentiation
            • ๐Ÿ’ปModule Differentiation using UI
            • โš™๏ธModule Differentiation APIs
              • Returns result of Module Comparison
              • Exports Comparison Result
        • ๐Ÿ“Tagging
          • ๐Ÿ’ปTagging using UI
          • โš™๏ธTagging APIs
            • Creating Tag
            • Searching Tag
            • Deleting Tag
            • Synchronization of tags
        • ๐Ÿ“Themes
          • ๐Ÿ’ปThemes using UI
          • โš™๏ธThemes APIs
            • Returning all themes
            • Creating theme
            • Updating theme Configuration
            • Deleting theme
            • Returning zip file containing themes
            • Importing theme
        • ๐Ÿ“Policy Wizard
          • ๐Ÿ’ปDemo on Policy Wizard using UI
          • โš™๏ธPolicy Wizard APIs
            • Creating new Policy
            • Getting Policy Configuration
        • ๐Ÿ“‚Auto Suggestion
          • ๐Ÿ’ปDemo using UI
          • โš™๏ธAuto Suggestion APIs
            • Get next and nested suggested block types
            • Get suggestions configuration
            • Set suggestions configuration
        • ๐Ÿ“Auto Testing of the Policies
          • ๐Ÿ’ปAuto Testing using UI
          • โš™๏ธAuto Testing Policies APIs
            • Adding new Test to the policy
            • Returning Policy Test by ID
            • Running the Policy Test
            • Stopping the Specified Test
            • Deleting the Specified Test
            • Returning details of the most recent test run
        • ๐Ÿ“”Library of Policy Examples
          • ๐Ÿ’ปCreating and using Roles
          • ๐Ÿ”ขData input via Forms, using Roles to partition user activities.
          • ๐Ÿช™Token Operations
          • ๐Ÿ”ŽMRV Document Operations
          • โ›“๏ธTrustChain reports
          • โž—MRV aggregation and splitting for minting tokens
        • ๐Ÿ’ปDemo on Integrating external policies using UI
        • Policy Labels
          • Policy Labels UI
          • โš™๏ธAPIs related to Policy Labels
            • Creating new Label definition
            • Retrieve the list of Label definitions
            • Retrieve a label definition configuration by ID
            • Update Label configuration by ID
            • Delete Label definition by ID
            • Publish Label definition by ID
            • Publish Label definition by ID asynchronously
            • Retrieve the list of components for Label configuration (schemas, policies, etc)
            • Import Label configuration from a file
            • Export Label configuration to a file
            • Preview of the imported file
            • Search for Labels and Statistics for importing into Label configuration
            • Retrieve the list of created tokens (VPs) for which a Label document can be created
            • Retrieve token (VP) and all its dependencies by document ID
            • Create a new Label document for token (VP)
            • Retrieve a list of created Label documents
            • Retrieve Label document by ID
            • Retrieve linked Label documents by ID
        • Formula Linked Definitions
          • Formula Linked Definitions using UI
          • โš™๏ธAPIs related to Formula Linked
            • Creating a new formula
            • Returns a list of formulas
            • Returns a formula by its ID
            • Update the formula by its ID
            • Delete the formula by its ID
            • Retrieve the list of all schemas and policies linked to a Formula
            • Create a new formula (import) from a file
            • Export selected formulas into a file
            • Loads (import) a file and return its preview
            • Publish a formula
            • Retrieve all data from documents that needed for displaying the formula
      • ๐Ÿ”‘Bring your own DIDs
        • ๐Ÿ’ปBring your own (BYO) DIDs UI
        • โš™๏ธAPIs
          • Validate DID Format
          • Validate DID Keys
      • ๐Ÿ“Import/Export in Excel
        • ๐Ÿ’ปImport and Export Excel file User Guide
        • โš™๏ธImport/Export Schemas/Policies APIs
          • Import Schemas in Excel file format into a policy
          • Asynchronously Imports Schemas in Excel file format into a policy
          • Previews Schema from Excel file
          • Returns Schema in Excel file format
          • Returns list of Schemas
          • Exporting Policy to Excel
          • Import Schemas in Excel file format into a Policy
          • Asynchronously Imports Schemas in Excel file format into a policy
          • Policy Preview from Excel file
      • ๐Ÿ“Project Comparison
        • ๐Ÿ’ปProject Comparison using UI
        • โš™๏ธProject Comparison APIs
          • Comparing Project Data Documents
          • Comparing VP Documents - V1
          • Retrieves all Properties
          • Search Projects by filters
      • ๐Ÿ”‘Selective Disclosure
        • ๐Ÿ“”User Guide
        • ๐Ÿ”Selective Disclosure Demo
      • ๐Ÿ“ˆUsage Statistics
        • ๐Ÿ’ปStatistics
        • โš™๏ธAPIs related to Statistics
          • Returns the status of the current report
          • Update current report
          • Returns all reports
          • Returns report data by report uuid
          • Export report data in a csv file format
          • Export report data in a xlsx file format
          • Returns all dashboards
          • Returns dashboard by uuid
          • Returns Metrics
      • ๐Ÿ“’Artifacts
        • ๐Ÿ’ปImporting/Deleting Artifacts using UI
        • โš™๏ธArtifacts APIs
          • Returns all Artifacts
          • (deprecated) Returns all Artifacts
          • Upload Artifacts
          • (deprecated) Upload Artifacts
          • Delete Artifact
          • (deprecated) Delete Artifact
      • ๐Ÿ’ปAsynchronous Tasks Status
      • Show list of Hedera Transactions
        • Showing List of Hedera Transactions using
        • APIs
          • Returning all transactions for Policy
          • Returning all transactions for Schema
          • Returning all transactions for Token
          • Returning all transactions for Contract
      • ๐Ÿ””Notifications
        • ๐Ÿ’ปUser Guide
        • โš™๏ธAPIs related to Notification
          • Get All Notifications
          • Get new Notifications
          • Get Progresses
          • Read All Notifications
          • Delete Notifications
      • ๐Ÿ“Discontinuing Policy Workflow
        • ๐Ÿ’ปUser Guide
        • โš™๏ธAPIs related to Discontinuing Policy workflow
          • Discontinue Policy
          • MigratePolicy Data
          • Migrate Policy Data Asynchronous
          • Get Policy Documents
      • ๐Ÿ“Live Project Data Migration
        • โ†”๏ธLive Project Data Migration UI
        • โš™๏ธAPIs related to Live Project Data Migration
          • Getting Policy Data
          • Uploading Policy Data
          • Getting Policy Tag Block Map
          • Getting Policy Virtual Keys
          • Uploading Policy Virtual Keys
      • ๐Ÿ”ฅFireBlocks Raw Signing
        • Fireblocks signing in Guardian UI
        • Getting Keys from FireBlocks UI
      • ๐Ÿ™Roles & Permissions
        • ๐Ÿ’ปRoles and Permissions User Guide
        • โš™๏ธAPIs related to Roles & Permissions
          • Returns list of all permissions
          • Returns list of all roles
          • Creates a New Role
          • Updates Role Configuration
          • Deletes Role
          • Setting Default Role
          • Returns list of all users for whom the current user can change the role
          • Retrieves information about the user (roles, permissions assigned policies)
          • Updates User Roles (only SR)
          • Returns list of all Policies
          • Assigns Policies to a User - Only SR
          • Updates user roles (for ordinary uses)
          • Assigns policies to a user (for ordinary users)
      • Decentralized Guardian
        • Remote Policy UI
        • APIs
          • Returns the list of requests for adding remote policies
          • Previews the policy from IPFS without loading it into the local DB.
          • Policy Import from IPFS
          • Approves policy Asynchronously
          • Rejects policy Asynchronously
          • Approves Policy
          • Rejects policy
          • Return a list of all policies
          • Approves a request for an action from a remote Guardian
          • Rejects a request for an action from a remote Guardian
          • Return a count of policy requests
          • Returns the list of existing keys
          • Creates a new key
          • Deletes the key with the specified ID
      • Change Password
        • Password Security Hardening and Change Password using UI
        • โš™๏ธAPI related to Change Password
          • Change Password
      • ๐Ÿ“TrustChain
        • โš™๏ธTrustChain APIs
          • Requesting
          • Building and returning
      • ๐Ÿœ๏ธExternal Events
        • ๐Ÿ› ๏ธMonitoring Tools
          • โ›๏ธApplication-events module
        • โš™๏ธSend Data using the External Data APIs
          • Sends Data from an External Source
      • ๐Ÿ“ฑMobile Support for Data Interface
        • ๐Ÿ“ฑMobile operation for the Standard Registry
      • ๐Ÿ› ๏ธStandard Registry Operations
        • โš™๏ธSettings APIs
          • Displaying Current Settings
          • Adding Settings
        • โš™๏ธLogs APIs
          • Returning Logs
          • Returning Log Attributes
        • โš™๏ธTask Statuses APIs
          • Returning Task Statuses
      • ๐Ÿ“นDemo Experience
    • ๐ŸคตUsers
      • ๐Ÿ› ๏ธUser Operations
        • โš™๏ธAccount APIs
          • Authentication Process
          • User listing except Standard Registry and Auditor
          • User Balance
          • User Session
          • User Login
          • Registering new account
          • Returns all Standard Registries
          • Returns Access Token
        • Profile APIs
          • User Account Balance
          • User Account Information
          • Setting User Credentials
          • Setting User Credentials Asynchronously
      • ๐Ÿ“ฑMobile Support for Data Interface
        • ๐Ÿ“ฑMobile Operation for the user
      • ๐Ÿ› ๏ธUser Profile Setup
      • ๐Ÿค–AI Search
        • ๐Ÿ’ปAI Search using UI
        • โš™๏ธAI Search APIs
          • Returns response
          • Rebuilds vector based on policy data
      • ๐Ÿ”ŽGuided Search of Methodologies
        • ๐Ÿ’ปSearch using UI
        • โš™๏ธSearch APIs
          • Retrieves list of all categories
          • List of policies that are best suited for given parameters
      • โœ–๏ธMulti Policy
        • ๐Ÿ’ปConfiguring Multi Policy using UI
      • Bottom Up Data Traceability
        • Bottom Up Data Traceability using UI
        • โš™๏ธRelated APIs
          • Create new Statistics Definition
          • Get the list of Statistics Definitions
          • Retrieve details of the Statistics Definition by ID
          • Update configuration of the Statistics Definition by ID
          • Delete the Statistics Definition by ID
          • Publish Statistics Definition by ID
          • Retrieve the list of linked schemas and policy
          • Retrieve the list of all documents conforming the rules of the Statistics Definition.
          • Create a new Statistics Assessment based on the Statistics Definition
          • Retrieve the list of existing Statistics Assessment
          • Retrieve the Statistics Assessment by ID
          • Retrieve all VC documents related to the Statistics Assessment
    • ๐Ÿช™Tokens
      • ๐Ÿ’ปCreating Token using UI
      • ๐Ÿ“’Token Template
        • Creating Token Template using UI
        • Creating Token through UI using Token Template
      • ๐Ÿ“–Token Authenticity
        • โ„น๏ธEstablishing Token Authenticity
      • Dynamic Token Creation in Policies
        • Dynamic Token Creation in Guardian Policies using UI
      • ๐Ÿ› ๏ธToken Operations
        • โš™๏ธToken APIs
          • Token Listing
          • Creation of Token
          • User Info for selected token
          • Associates the user with token
          • Disassociates the user with token
          • Grants KYC for the user
          • Revoke KYC of the user
          • Freeze Tokens of a user
          • UnFreeze Tokens of a user
          • Returns Token Serials
        • โš™๏ธAPIs for Asynchronous Execution
          • Token Creation
          • Associating User with the Hedera Token
          • Disassociating User with the Hedera Token
          • Setting KYC for the User
          • Unsetting KYC for the User
      • ๐Ÿ“”Token Retirement Contract
        • ๐Ÿ’ปCreating Contract using UI
        • โ›“๏ธTrustChain representation of token retirement
        • โš™๏ธRetirement APIs
          • Returning all contracts
          • Creating new Contract
          • Importing new Contract
          • Get Contract Permissions
          • Removing Contract
          • Returns a list of all Wipe requests
          • Enabling Wipe Requests
          • Disabling Wipe Requests
          • Approving Wipe Requests
          • Rejecting Wipe Requests
          • Clearing Wipe Requests
          • Adding Wipe Admin
          • Removing Wipe Admin
          • Adding Wipe Manager
          • Removing Wipe Manager
          • Adding Wipe Wiper
          • Removing Wipe Wiper
          • Syncing Retire Pools
          • Returning list of all Retire Requests
          • Returning list of all Retire Pools
          • Deleting Retire Requests
          • Deleting Retire Pools
          • Setting Retire Pools
          • Unsetting Retire Pool
          • Unsetting Retire Request
          • Retiring Tokens
          • Approving Retire Request
          • Cancelling Retire Request
          • Adding Retire Admin
          • Removing Retire Admin
          • Returning all Retired VCs
          • Adding Wipe for specific token
          • Remove Wipe request for specific token
          • Deleting Wipe request for Hedera Account
          • Get Retirement VCs from Indexer
    • ๐Ÿ‘พAutomation Testing
      • ๐Ÿ’ปPerforming API Automation Testing
      • ๐Ÿ’ปPerforming UI Automation Testing
    • ๐Ÿ“•Logging Configuration using Pino Library
    • ๐Ÿ“”Guidance for Open Source Policy Submissions
    • ๐Ÿ“Demo Guide
      • ๐Ÿ”‹Renewable Energy Credits
        • ๐Ÿ“–Introduction to International Renewable Energy Credit Standard (iREC)
        • โš™๏ธiREC API Demo Guide
        • โš™๏ธDemo Using APIs and UI
        • ๐Ÿ’ปiREC 5 Demo UI Guide
        • โš™๏ธiREC 5 json
        • ๐Ÿ’ปiREC 7 User Journey UI Demo Guide
        • ๐Ÿ’ปiREC 7 Demo UI Guide
      • โ˜˜๏ธCarbon Offsets
        • ๐Ÿ“–Introduction to Verra Redd+
        • ๐Ÿ’ปVerra Redd VM0007 Demo UI Guide
        • ๐Ÿ’ปVerra Redd_3 User Journey Demo UI Guide
        • ๐ŸŽVM0017 Adoption of Sustainable Agricultural Land Management, v1.0
        • ๐ŸŽVM0042 Methodology for Improved Agricultural Land Management
        • ๐ŸŒฒVerra VM0047 - Afforestation, Reforestation, and Revegetation (ARR) v0.1
        • ๐ŸŒฒGold Standard Afforestation and Reforestation (AR) v2.0
        • ๐ŸƒDovu Methodologies
        • ๐Ÿ€Dovu MMCM
        • โ™จ๏ธImproved Cookstove
        • โ™จ๏ธGoldStandard - Metered Energy Cooking
        • ๐Ÿ€Carbon Reduction Measurement - GHG Corporate Standard Policy Guid
        • ๐ŸขVM0044 Methodology for Biochar Utilization in Soil and Non-Soil Applications
        • ๐ŸญCDM AMS-III.AR : Substituting fossil fuel based lighting with LED/CFL lighting systems
        • ๐ŸจCDM AMS II.G: Energy Efficiency Measures in Thermal Applications of Non-Renewable Biomass
        • ๐ŸญCDM AMS III.D: Methane Recovery in Animal Manure Management Systems
        • ๐ŸญCDM AMS III.BB: Electrification of communities through grid extension
        • ๐ŸญCDM AR-ACM0003: Methodology for Afforestation and Reforestation of Lands Except Wetlands
        • ๐ŸญCDM ACM0001: Flaring or Use of Landfill Gas
        • ๐ŸญCDM ACM0002: Grid-Connected Electricity Generation from Renewable Sources
        • ๐ŸญCDM ACM0006: Electricity and Heat Generation from Biomass
        • ๐ŸขCDM ACM0007: Conversion from Single Cycle to Combined Cycle Power Generation
        • ๐ŸญCDM AMS-I.A.: Electricity Generation by the User
        • ๐ŸญCDM AMS-I.C.: Thermal Energy Production with or Without Electricity
        • ๐ŸจCDM AMS-I.F.: Renewable Electricity Generation for Captive Use and Mini-Grid
        • ๐ŸญCDM AMS-II.J.: Demand-Side Activities for Efficient Lighting Technologies
        • ๐ŸจCDM AMS-III.AV.: Low Greenhouse Gas Emitting Safe Drinking Water Production Systems
        • ๐ŸญCDM AMS-III.F.: Avoidance of Methane Emissions Through Composting
        • ๐ŸขCDM AMS-III.H.: Methane Recovery in Wastewater Treatment
        • ๐ŸญCDM ACM0018: Electricity Generation from Biomass in Power-Only Plants
        • โฌ‡๏ธVerra PWRM0001 :Plastic Waste Collection Methodology
        • ๐ŸญVM0041 Methodology for the Reduction of Enteric Methane Emissions from Ruminants through the Use of
        • ๐Ÿฅ‡Carbon Sequestration through Accelerated Carbonation of Concrete Aggregate
        • ๐ŸญAMS-I.D: Grid Connected Renewable Electricity Generation โ€“ v.18.0
        • ๐ŸญPWRM0002 : Plastic Waste Recycling Methodology
        • ๐ŸšMethane Emission Reduction by Adjusted Water Management Practice in Rice Cultivation
        • โ›ฝVerra VMR0006: Energy Efficiency and Fuel Switch Measures in Thermal Applications
        • ๐ŸŒฉ๏ธAMS-I.E Switch from Non-Renewable Biomass for Thermal Applications by the User
        • GCCM001 v.4 Methodology for Renewable Energy Generation Projects Supplying Electricity to Grid
        • Landfill Gas Destruction and Beneficial Use Projects, Version 2.0
        • Climate Action Reserveโ€™s U.S. Landfill Protocol Version 6.0
        • VM0042 Improved Agricultural Land Management, v2.1
      • ๐ŸญCarbon Emissions
        • ๐ŸกRemote Work GHG Policy
          • ๐Ÿ“–Introduction to Remote Work GHG
          • ๐Ÿ’ปGHG Policy User Journey UI Demo Guide
          • ๐Ÿ’ปRemote GHG Policy Demo Guide
        • ๐ŸขCarbon Emissions Measurement - GHG Corporate Standard Policy Guide
        • ๐Ÿญatma GHG Scope II Carbon Emission Policy
        • ๐ŸญAtma Scope 3 GHG Policy
        • ๐ŸญGHGP Corporate Standard
        • ๐ŸญGHGP Corporate Standard V2
        • Climate Action Reserveโ€™s U.S. Landfill Protocol Version 6.0
        • Landfill Gas Destruction and Beneficial Use Projects, Version 2.0
    • โ“FAQs
    • ๐Ÿ‘ฌCommunity Standards
      • Guardian Policy Standards (GPS)
      • Guardian System Standards (GSS)
      • Proposal for Defining Standards
  • Feedback
    • Feedback in Pipelines
  • ๐Ÿ“ˆGuardian in Production
    • ๐Ÿ“„API Architecture Customization
    • ๐Ÿ“‰Monitoring tools
    • Performance Improvement
    • Cloud Infrastructure
    • Independent Packaged Deployment
Powered by GitBook
On this page
  • Guidelines
  • Guidelines in Detail
  • Installation data:
  • Transaction data:
  • Implementation: MongoDB and .env Files Backup
  1. Guardian
  2. Getting Started
  3. Installation Guide
  4. Installation

Backup tools

To implement a backup and recovery strategy for installation data and transaction data in Hedera Guardian application here are the detailed guidelines/ steps to be followed:

Guidelines

A. Determine what data needs to be backed up: Identify installation data and transaction data that needs to be backed up, determine the frequency at which it needs to be backed up.

B. Choose a backup storage location: Select a secure and reliable location to store your backups. Cloud storage services like Amazon S3, Google Cloud Storage, and Microsoft Azure are popular options.

C. Decide on a backup schedule: Define a backup schedule that ensures all critical data is backed up regularly and create a backup policy based on it.

D. Develop backup scripts: Write backup scripts in Node.js that automate the backup process. Use libraries like Node.js's built-in fs module or third-party libraries like node-schedule or node-cron to create and schedule backup jobs. Alternatively, we can use open source tools like "node-backup-manager" or "duplicity".

E. Test backups and recovery procedures: Test your backups regularly to ensure that the data is being backed up correctly and can be restored in the event of data loss. Develop recovery procedures that detail how to restore data from backups.

F. Monitor backups and automate notifications: Monitor the backup process to ensure that backups are being created and stored correctly. Automate notifications to alert you of any backup failures or issues.

G.Automate the backup process: Automating the backup process can save time and reduce the risk of human error.

H.Secure backups: Backups should be encrypted to prevent unauthorized access to sensitive data. This includes using strong passwords and encryption algorithms to protect data both in transit and at rest.

I.Test backups regularly: It is important to test backups regularly to ensure that the backup process is working correctly. This includes testing the restore process to ensure that data can be recovered in the event of a disaster.

J. Update backup strategy as necessary: Revisit your backup strategy periodically to ensure that it remains relevant and effective. Make changes as necessary based on changes to your data or infrastructure.

By following these steps, the implementer company can implement a backup and recovery strategy for the installation and transaction data in their Guardian application to protect them in the event of data loss or other issues.

Guidelines in Detail

A. Determine what data needs to be backed up: Identify installation data and transaction data that needs to be backed up, determine the frequency at which it needs to be backed up.

Installation data:

Installation data refers to the configuration settings and other data that are necessary to install and set up a software application. Some examples of installation data in a Guardian application might include:

1. Server configurations: This includes information about the hardware and software requirements for the application to run, such as the operating system, CPU, memory, and storage.

2. Environment variables: These are variables that specify settings for the environment in which the application runs. For example, they might include the database connection string, API keys, or other environment-specific settings.

3. Application settings: These are settings that are specific to the application, such as the default language, time zone, or other user preferences.

4. Dependencies: These binary files are the external libraries or modules that the application relies on to function correctly. They might include Node.js modules, third-party libraries, or other software packages. These executable files, required for the application to run, are part of the installation data.

5. Scripts: These are scripts that are run during the installation process to perform certain tasks, such as setting up the database schema or initializing the application.

Note: The Guardian application does use a MongoDB database hence the database schema is part of the installation data that needs to be backed up.

6. License agreements: These are the legal agreements that govern the use of the application and must be agreed upon before installation.

7. Customizations: If you have made any customizations to your application or system during installation or setup, these customizations are part of the installation data and need to be backed up.

Transaction data:

Transaction data in the Guardian application refers to the data related to user transactions or activities within the application. Examples of transaction data can include:

  1. User registration and login information

  2. User profile data such as name, email, and contact information

  3. User-generated content such as posts, comments, and messages

  4. Server logs and error logs that record server activities and errors

  5. Session data that tracks user activity and preferences during a single session.

  6. MongoDB data as entered by a standard registry user or by a field user.

In general, transaction data in the Guardian application includes any data that is generated or modified by different usersโ€™ actions within the application. This data is critical to the proper functioning of the application and must be backed up and protected in case of data loss or corruption.

B. Choose a backup storage location: Select a secure and reliable location to store your backups. Cloud storage services like Amazon S3, Google Cloud Storage, and Microsoft Azure are popular options.

When it comes to choosing a backup storage location, there are several factors to keep in mind to ensure that your data is secure and easily accessible. Here are some key considerations:

  1. Security: Your backup storage location should be secure and protected against unauthorized access. This means using encryption and access controls to prevent data breaches.

  2. Reliability: Your backup storage location should be reliable and have a high level of uptime. This means choosing a provider with a proven track record of reliability and ensuring that your data is backed up regularly.

  3. Scalability: Your backup storage location should be scalable and able to accommodate your growing data needs. This means choosing a provider that can easily scale up or down as your business needs change.

  4. Accessibility: Your backup storage location should be easily accessible, both in terms of physical location and connectivity. This means choosing a provider with multiple data centers in different geographic locations and ensuring that you have reliable internet connectivity.

  5. Cost: Your backup storage location should be cost-effective, without sacrificing security or reliability. This means comparing prices from different providers and choosing one that offers the best balance of cost, security, and reliability.

  6. Compliance: Your backup storage location should comply with any relevant data protection regulations, such as GDPR or HIPAA. This means choosing a provider that has the necessary certifications and can provide proof of compliance.

By keeping these factors in mind, you can choose a backup storage location that meets your business needs and ensures the security and accessibility of your data.

C. Decide on a backup schedule: Define a backup schedule that ensures all critical data is backed up regularly and create a backup policy based on it.\

When deciding on a backup schedule, there are several important factors to consider to ensure that your data is protected and easily recoverable in the event of a disaster or data loss. Here are some key considerations:

  1. Recovery Point Objective (RPO): The RPO is the maximum amount of data that can be lost before it starts to impact your business. When deciding on a backup schedule, you should consider your RPO and ensure that your backups are frequent enough to meet this requirement.

  2. Recovery Time Objective (RTO): The RTO is the amount of time it takes to restore your data after a disaster or data loss. When deciding on a backup schedule, you should consider your RTO and ensure that your backups are frequent enough to meet this requirement.

  3. Data Volume: The size of your data volume will affect the backup schedule. Large volumes of data will require more time to back up, so you may need to schedule backups more frequently.

  4. Data Criticality: The criticality of your data will also affect the backup schedule. Critical data should be backed up more frequently than non-critical data to minimize the risk of data loss.

  5. Backup Window: The backup window is the time during which backups can be performed without impacting the performance of your systems. When deciding on a backup schedule, you should consider your backup window and ensure that backups are scheduled during a time when they will not impact system performance.

  6. Backup Type: The type of backup you use will also affect the backup schedule. Full backups may take longer to perform, but they provide complete data protection. Incremental and differential backups may be faster, but they provide less complete data protection.

By considering these factors, you can develop a backup schedule that meets your business needs and ensures the protection and recoverability of your data.

D. Develop backup scripts: Write backup scripts in Node.js that automate the backup process. Use libraries like Node.js's built-in fs module or third-party libraries like node-schedule or node-cron to create and schedule backup jobs. Alternatively, we can use open source tools like "node-backup-manager" or "duplicity".

Example 1: Example backup script in Node.js that uses the built-in fs module to automate the backup process.

const fs = require('fs');
const { exec } = require('child_process');
const backupDir = '/path/to/backup/directory'; // The directory where backups will be stored
const sourceDir = '/path/to/source/directory'; // The directory to be backed up
const fileName = `backup_${new Date().toISOString()}.tar.gz`; // The filename for the backup file
// Create a backup of the source directory
const createBackup = () => {
  return new Promise((resolve, reject) => {
    exec(`tar -czf ${backupDir}/${fileName} ${sourceDir}`, (err, stdout, stderr) => {
      if (err) {
        console.error(`Error creating backup: ${err.message}`);
        reject(err);
      }
      console.log(`Backup created successfully: ${fileName}`);
      resolve(fileName);
    });
  });
};
// Copy the backup file to a remote server
const copyBackup = (backupFile) => {
  return new Promise((resolve, reject) => {
    const remoteHost = 'user@remote.host'; // The remote server to copy the backup to
    exec(`scp ${backupDir}/${backupFile} ${remoteHost}:${backupDir}`, (err, stdout, stderr) => {
      if (err) {
        console.error(`Error copying backup to remote server: ${err.message}`);
        reject(err);
      }
      console.log(`Backup copied to remote server successfully: ${backupFile}`);
      resolve();
    });
  });
};
// Delete old backup files to free up space
const deleteOldBackups = () => {
  const backupRetentionPeriod = 30; // The number of days to keep backup files
  const currentTime = Date.now();
  fs.readdirSync(backupDir).forEach((file) => {
    const filePath = `${backupDir}/${file}`;
    const fileStat = fs.statSync(filePath);
    const fileAge = (currentTime - fileStat.mtimeMs) / (1000 * 60 * 60 * 24); // Convert age to days
    if (fileAge > backupRetentionPeriod) {
      fs.unlinkSync(filePath);
      console.log(`Deleted old backup file: ${file}`);
    }
  });
};
// Run the backup process
const runBackup = async () => {
  try {
    const backupFile = await createBackup();
    await copyBackup(backupFile);
    deleteOldBackups();
  } catch (err) {
    console.error(`Error running backup process: ${err.message}`);
  }
};
runBackup();

Example 2:.Example backup script in Node.js that uses the "node-schedule" library to automate the backup process.

const fs = require('fs');
const path = require('path');
const { exec } = require('child_process');
const schedule = require('node-schedule');
// Define backup directory path
const backupDir = path.join(__dirname, 'backups');
// Ensure that backup directory exists
if (!fs.existsSync(backupDir)) {
  fs.mkdirSync(backupDir);
}

// Define source directory to backup
const sourceDir = path.join(__dirname, 'myApp');

// Define backup function
const backup = () => {
  // Define backup file name and path
  const backupFileName = `backup_${Date.now()}.tar.gz`;
  const backupFilePath = path.join(backupDir, backupFileName);
  // Execute backup command using child_process module
  const backupCommand = `tar -czvf ${backupFilePath} ${sourceDir}`;
  exec(backupCommand, (error, stdout, stderr) => {
    if (error) {
      console.error(`Backup error: ${error.message}`);
      return;
    }
    if (stderr) {
      console.error(`Backup stderr: ${stderr}`);
      return;
    }
    console.log(`Backup complete. Output: ${stdout}`);
  });
};
// Schedule backup to run every day at midnight
const backupSchedule = schedule.scheduleJob('0 0 * * *', backup);
// Log backup schedule information
console.log(`Backup scheduled to run every day at midnight: ${backupSchedule.nextInvocation()}`);

This script uses the "node-schedule" library to schedule a backup function to run every day at midnight. The backup function creates a backup file name and path, and executes a backup command using the child_process module to compress and archive the source directory into a backup file in the backup directory. The script also includes error handling and logging capabilities to ensure that the backup process is reliable and can be monitored for issues.

Example 3: Backup script in Node.js that uses the "node-crone" library to automate the backup process.

const fs = require('fs');
const path = require('path');
const { exec } = require('child_process');
const cron = require('node-cron');
// Define backup directory path
const backupDir = path.join(__dirname, 'backups');
// Ensure that backup directory exists
if (!fs.existsSync(backupDir)) {
  fs.mkdirSync(backupDir);
}
// Define source directory to backup
const sourceDir = path.join(__dirname, 'myApp');
// Define backup function
const backup = () => {
  // Define backup file name and path
  const backupFileName = `backup_${Date.now()}.tar.gz`;
  const backupFilePath = path.join(backupDir, backupFileName);
  // Execute backup command using child_process module
  const backupCommand = `tar -czvf ${backupFilePath} ${sourceDir}`;
  exec(backupCommand, (error, stdout, stderr) => {
    if (error) {
      console.error(`Backup error: ${error.message}`);
      return;
    }
    if (stderr) {
      console.error(`Backup stderr: ${stderr}`);
      return;
    }
    console.log(`Backup complete. Output: ${stdout}`);
  });
};
// Schedule backup to run every day at midnight
cron.schedule('0 0 * * *', backup, {
  scheduled: true,
  timezone: 'America/New_York'
});
// Log backup schedule information
console.log('Backup scheduled to run every day at midnight in America/New_York timezone.');

This script uses the "node-cron" library to schedule a backup function to run every day at midnight in the America/New_York timezone. The backup function creates a backup file name and path, and executes a backup command using the child_process module to compress and archive the source directory into a backup file in the backup directory. The script also includes error handling and logging capabilities to ensure that the backup process is reliable and can be monitored for issues.

Example 4:.Example backup script in Node.js that uses the "node-backup-manager" library to automate the backup process.

const BackupManager = require('node-backup-manager');
// Initialize backup manager
const backupManager = new BackupManager();
// Configure backup options
const options = {
  backupDir: '/path/to/backup/directory',
  targets: [
    {
      name: 'mongodb',
      type: 'mongodb',
      host: 'localhost',
      port: 27017,
      database: 'mydatabase',
      username: 'myuser',
      password: 'mypassword',
    },
    {
      name: 'files',
      type: 'file',
      sourceDir: '/path/to/source/directory',
    },
  ],
};
// Schedule backups
backupManager.schedule(options, {
  interval: 'daily',
  at: '02:00',
});
// Start backup manager
backupManager.start();

In this example, we first import the node-backup-manager library and create an instance of the BackupManager class. We then configure the backup options by specifying the backup directory and the targets to be backed up. In this case, we have two targets: a MongoDB database and a file system directory.

Next, we schedule backups to be performed daily at 2:00 am using the schedule method. Finally, we start the backup manager using the start method.

Note that this is just a basic example, and you can customize the backup options and schedule according to your specific backup requirements.

Example 5:.Example backup script in Node.js that uses the "duplicity" library to automate the backup process.

const { spawn } = require('child_process');
// Set backup directory
const backupDir = '/path/to/backup/directory';
// Set source directories to be backed up
const sourceDirs = ['/path/to/source/directory', '/path/to/another/source/directory'];
// Set target URL for backup storage
const targetUrl = 's3://my-bucket/my-backup-folder';
// Set passphrase for encryption (optional)
const passphrase = 'my-passphrase';
// Set duplicity command options
const duplicityOptions = [
  '--no-print-statistics',
  '--s3-use-new-style',
  '--s3-use-ia',
  '--s3-use-multiprocessing',
  '--encrypt-key=MY_ENCRYPTION_KEY',
];
// Create backup command
const backupCommand = [
  'duplicity',
  '--full-if-older-than', '1M',
  ...duplicityOptions,
  ...sourceDirs,
  targetUrl,
];
// If passphrase is provided, add encryption option to command
if (passphrase) {
  backupCommand.splice(1, 0, '--encrypt-key');
  backupCommand.splice(2, 0, passphrase);
}
// Run backup command
const backupProcess = spawn(backupCommand[0], backupCommand.slice(1), {
  cwd: backupDir,
});
// Listen for backup process events
backupProcess.stdout.on('data', (data) => {
  console.log(`stdout: ${data}`);
});
backupProcess.stderr.on('data', (data) => {
  console.error(`stderr: ${data}`);
});
backupProcess.on('close', (code) => {
  console.log(`Backup process exited with code ${code}`);
});

In this example, we first set the backup directory, source directories to be backed up, target URL for backup storage, and passphrase for encryption (optional).

We then set the duplicity command options, including disabling statistics output, using S3 in new-style mode, using S3 Intelligent-Tiering, and using multiprocessing. We also specify the encryption key if a passphrase is provided.

Next, we create the duplicity backup command by combining the duplicity executable, the --full-if-older-than option to perform full backups after 1 month, the duplicityOptions, the sourceDirs, and the targetUrl. If a passphrase is provided, we add the encryption option to the command.

Finally, we use the child_process.spawn method to run the duplicity command as a child process. We listen for events from the backup process, including stdout, stderr, and close events.

E. Test backups and recovery procedures: Test your backups regularly to ensure that the data is being backed up correctly and can be restored in the event of data loss. Develop recovery procedures that detail how to restore data from backups.

F. Monitor backups and automate notifications: Monitor the backup process to ensure that backups are being created and stored correctly. Automate notifications to alert you of any backup failures or issues.

G. Update backup strategy as necessary: Revisit your backup strategy periodically to ensure that it remains relevant and effective. Make changes as necessary based on changes to your data or infrastructure.

Implementation: MongoDB and .env Files Backup

  1. Create a new folder called backup in the root folder of the Guardian Application.

  2. Change the current docker-compose.yml addin this service:

backup:
 build: ./backup
 environment:
   - AWS_ACCESS_KEY_ID=AKIAXC*******D6QV7
   - AWS_SECRET_ACCESS_KEY=Ipk6*****************sfMV
   - S3_BUCKET=application-backups
   - AWS_DEFAULT_REGION=eu-central-1
   - S3_MONGODB_PREFIX=mongodb
   - S3_CONFIGS_PREFIX=configs
   - BACKUP_NAME_FORMAT=mongodb-%Y-%m-%d-%H-%M-%S.archive
 volumes:
   - ./backup:/data
   - /var/run/docker.sock:/var/run/docker.sock
 depends_on:
   - mongodb
  1. Create this folder structure:

  1. The dockerfile will look like this: FROM mongo:latest\

    # Set the working directory

    WORKDIR /usr/local/bin

    COPY . .

    # Install required tools

    RUN apt-get update && apt-get install -y \

    curl unzip cron zip\

    # Install AWS CLI dependencies

RUN apt-get update && apt-get install -y \
   python3 \
   python3-pip \
   groff \
   less \
   --no-install-recommends// Some code

# Install AWS CLI

RUN pip3 install awscli

# Add AWS CLI to the system path

ENV PATH="/usr/local/aws-cli/bin:${PATH}"

# Copy your backup script to the container

COPY mongodb-backup.sh /usr/local/bin/mongodb-backup.sh
COPY configs-backup.sh /usr/local/bin/configs-backup.sh

# Set execute permissions for the backup script

RUN chmod +x /usr/local/bin/mongodb-backup.sh
RUN chmod +x /usr/local/bin/configs-backup.sh

# Copy the entrypoint script to the container

COPY entrypoint.sh /usr/local/bin/entrypoint.sh

# Set execute permissions for the entrypoint script

RUN chmod +x /usr/local/bin/entrypoint.sh
CMD ["/usr/local/bin/entrypoint.sh"]
  1. Mongodb-backup.sh script:

#!/bin/bash

# Add a log entry indicating cron execution

echo "$(date): Cron job executed" >> /var/log/mongodb-backup.log

# Dump the MongoDB data

mongodump --uri="mongodb://host.docker.internal:27017" --gzip --archive=/tmp/mongo.gz

# Upload the backup to S3 using AWS CLI Docker image

aws s3 cp /tmp/mongo.gz s3://$S3_BUCKET/$S3_MONGODB_PREFIX/$(date +%Y%m%d-%H%M%S).gz

  1. Configs-backup.sh script:

#!/bin/bash

# Add a log entry indicating cron execution

echo "$(date): Cron job executed" >> /var/log/configs-backup.log

zip -r -D /tmp/configs.zip /usr/local/bin/configs

# Upload the backup to S3 using AWS CLI Docker image

aws s3 cp /tmp/configs.zip s3://$S3_BUCKET/$S3_CONFIGS_PREFIX/$(date +%Y%m%d-%H%M%S).zip

  1. entrypoint.sh script:

The script below will execute hourly to backup the database and the configuration files.

#!/bin/bash

# Start cron

service cron start

# Run the backup script in an infinite loop

while true; do
 /usr/local/bin/configs-backup.sh
 /usr/local/bin/mongodb-backup.sh
 sleep 1h  # Adjust the sleep duration as needed
done

Remember that inside the config files we have .env files which are invisible unless you run ls -lha command.

The final result will look like the image above. After that you can easily download the last file of the configuration or of the database to be reintroduced in the application.

Last updated 1 year ago

Backups are an important part of application development. In order to ensure this feature in the Guardian application the following steps could be taken if you want to save the backups in the Amazon S3. This contains an example of how to simulate in detail the process to backup the mongodb collections and .env files. The same could be applied to the Guardian application.

๐ŸŒ
๐Ÿ“–
๐Ÿ› ๏ธ
๐Ÿ”™
repository