Saltstack result of Orchestrate run via email - salt-stack

I was trying to find ways to get results of an Orchestrate run via email.
I have salt reactor setup right now which sends me alerts in case any job fails using SMTP. What setup should I have so that I receive an email when orchestration run starts and when it ends or in case of failure.
There is a highstate return module but that does not work with the salt orchestrate system.

Related

How to Rollback database in Microservice if RabbitMQ down permanently?

I am trying to communicate between four services in Microservice. Every service has serperate Database. I am using saga pattern.
My question is, if RabbitMQ goes down or crash or no way to come back, how would I rollback or revert database without help of message Queue?
I'm assuming that you're using SAGA pattern to maintain consistency in your microservice application. Main component for this pattern is the Orchestrator which coordinates your microservice and I'm assuming that in your application you are using rabitmq for message passing.
One way is to store your message in the local database of your microservice if you're not able to send a message to the queue you can add a scheduler that will try to send the message to the queue after some interval.
The second way can be to use rabitmq in cluster mode this will prevent a Single Point of failure for your application.

Scheduling the javascript script hosted on firebase to run in every 30 minutes

I have written a javascript code, which contains all the necessary firebase database conditioning,on the basis of which I am sending push notifications using fcm. I have hosted the script (index.html & firebase.js) on the firebase.
I want to schedule the script kept on server at every 30 minutes(it should run automatically), so that conditions written on script will be checked in every 30 minutes and push notifications will be sent automatically to the user.
Kinldy, help me to solve this issue.
Thanks.
I have heard of cron task. But I don't know how to implement this with the script.
I want that the push notification should be sent to the user based on the conditions that i have written in the script.
How to schedule this script on server side?
There is no way to schedule running code on Firebase Hosting. In fact: Firebase Hosting doesn't run any of your code. All code in your index.html and JavaScript are sent to any client that connects to your site, and are interpreted there. Which is actually a security risk in your current approach.
Sending FCM messages requires that you specify the FCM server key. As its name implies, this key should only be used in a trusted environment, such as a server you control, your development machine, or Cloud Functions. The latter is probably the best way for you to send these FCM messages, as you can schedule Cloud Functions to run on an interval.

SQL always encrypted and dump of migration scripts for validation

I have two issues I can't figure out how to accomplish in Flyway without forking the repo and we'd like to avoid that.
Issue #1. Sql Server Always Encrypted connection, how do we override or inject enough information so that Flyway can setup the database connect to an Always Encrypted database. The connection needs to connect to Azure Key Vault to get a token for use for encryption/decryption but this additional setup that is above the the standard User Name/Password the connection string needs. Also, you can't pass these values on the connections string.
More details here on how this would be done in JDBC as I'm not a Java person.
Issue #2. Is there a way to retrieve the full list of SQL statements that are about to run during the migration and after all the "placeholders" are resolved? We need a way to check all the SQL scripts to ensure the scripts don't run specific commands such as CREATE USER, DROP DATABASE, etc. as we running this in a controlled environment and though that those commands work great during development, they can't be run in PRODUCTION. In Production the database user will have elevated privileges so we need to check the scripts before running them. I see the Dry Runs Pro feature but that just writes to a file. We'd like to get this data back on a callback and then we can validate it prior to the migration running.

Undo Write operation if offline

I am attempting do the following
write a document to server.
wait for the success event and check for metadata to confirm if its written to server
if it is not written to server even after the time out (using a timer) undo the write operation.
this is for WEBRTC calls so if a user attempts a call but was offline and closes the app since it did not succeed. after a long time the receiver would receive a call and would be weird.
There are no undo operations in Firestore. The client SDK tries doesn't really give any way to discern if the app is online or offline - it simply tries its best to service the requests that you give it via the API.
If you want to perform some operation while only online, then use Cloud Functions to make an HTTP request to backend code that performs the actions you want. If the app is offline, the HTTP request will obviously fail, and you can decide what you want to do from there.

Long-running background tasks with progress notifications

I have an ASP.NET website with a a number of long-running (5 mins to 2 hours) user-initiated tasks. I want each user to be able to see the progress of there own jobs, and be able to close their browser and return at a later time.
Current plan is to store each job in the database when it's started and publish a message to a RabbitMQ queue, which a windows service will receive and start processing the job.
However, I'm not sure of the best way to pass the progress information back to the webserver from the service? I see two options:
Store the progress information in the database, and have the web-app poll for it
Have a RabbitMQ consumer in the webserver and have the windows service post progress messages to that queue
I'm leaning towards the second option, as I don't really want to add more overhead to the database by regular polling / writing progress info. However, there are lots of warnings about using RabbitMQ (as a consumer) - as I am not sending vital messages (it doesn't matter if progress messages aren't processed), I'm wondering if this matters? It's not that (famous last words) difficult to restart the RabbitMQ consumer whenever the web app is restarted.
Does that option sound reasonable? Any better choices out there?
Store the progress information in the database, and have the web-app poll for it
Have a RabbitMQ consumer in the webserver and have the windows service post progress messages to that queue
the correct answer is C) All Of The Above!
A database is not an integration layer for applications.
RabbitMQ is not meant for end-user consumption of messages.
But when you combine RabbitMQ with a database, you get beautiful things...
have your background service send progress updates through RabbitMQ. the web server will listen for these updates and write the new status to the database. use websockets (signalr) to push the progress update to the user immediately, but you still have the current status in the database in case the user does a full refresh of the page or comes back later.
i wrote about this basic setup in a blog post on using rabbitmq to do user notifications

Resources