Is there a way to auto import, one gateway to another similar to the sync from master and backup

we have two servers one for production and one for reporting. the reporting server is read only and it's a copy of the production server. currently anytime that a project or view is made it has to be exported from our production server and imported on the reporting server.

so, my question is can this import/export be automated. is there would be a native way to do this? I know there is probably a way with using PowerShell to write the files to the gateways folder, but I would prefer to do it in a way that stays in ignition.

if it does come down to overwriting folders, would I just need to overwrite ignition\data\projects or are there other files that would be necessary?

any advice is appreciated.

What Ignition version are you using?

That determines what native Ignition tools are at your disposal.

the production server is 8.1.42, the reporting server is 8.3.7

The native way to do this would be EAM to push projects but it only works with gateways on the same major revision unfortunately.

If you’re not using a deployment pipeline, it’s practically just copying the projects over and triggering a project scan on the reporting Gateway.

# Assuming you're on the production server.
scp -r /usr/local/bin/ignition/data/projects/. reporting-server:/usr/local/bin/ignition/data/projects/

curl -fsS -X POST \
    -H "X-Ignition-API-Token: ${IGNITION_API_TOKEN}" \
    "http://reporting-server:8088/data/api/v1/scan/projects"

Assuming the appropriate permissions and API token are configured.

If you want to automate it at the OS level, you could look into inotifywait on Linux.

If you’d prefer to keep everything within Ignition, you could use Java’s java.nio.file.WatchService API, obtained through FileSystems.getDefault().newWatchService(). I’ve used it before to monitor application config changes on a dedicated thread. You will need to use system.util.getGlobals() to manage the instance and lifecycle and somehow only allow the production gateway to run the the watch service since you are copying the projects themselves. (more work IMO than just using OS implementation or a pipeline)

EDIT:

After looking, the WatchService might not be the best fit as you have to specify each directory which is not static since you will be adding additional views and scripts.

For each directory that you want monitored, register it with the watcher. When registering a directory, you specify the type of events for which you want notification. You receive a WatchKey instance for each directory that you register.

EDIT:

Thought about this some more. This shouldn't affect functionality but see:

Just so you know, you will get a warning since the reporting server is 8.3 and has a different resource configuration.

It sounds like you just want to move a project over...

If you get your production server set up as an EAM (or a different server) you can send projects to your report server.

This is what I do to make a copy of our production server onto developement.

Agent Task - Send Project | Ignition User Manual