Skip to content

How to add a notification

Cesar Celis Hernandez edited this page Feb 26, 2022 · 18 revisions

Add notification

The reason to add this wiki page is to document the steps on how to enable and disable the notifications, so that we can test manually, learn and then implement automation via GoLang on the API end points. Feel free to improve and share these steps.

  1. Start MinIO Server
minio server /Volumes/data{1...4} --address localhost:9000 --console-address localhost:9001

As a result you should see this:

Automatically configured API requests per node based on available memory on the system: 263
Status:         4 Online, 0 Offline. 
API: http://192.168.0.21:9000  http://127.0.0.1:9000                       
RootUser: minioadmin 
RootPass: minioadmin 

Console: http://localhost:6001 
RootUser: minioadmin 
RootPass: minioadmin 

Command-line: https://docs.min.io/docs/minio-client-quickstart-guide
   $ mc alias set myminio http://192.168.0.21:9000 minioadmin minioadmin

Documentation: https://docs.min.io
  1. Then launch docker container to have PostgreSQL, make sure your docker daemon is running:
docker run --name pgsqlcontainer -p 5432:5432 -e POSTGRES_PASSWORD=password -d postgres
  1. Then connect to the Data Base and create this table below:
psql --host localhost --port 5432 --user postgres

The password is: password as set above in docker command: POSTGRES_PASSWORD=password

CREATE TABLE events (
	key serial PRIMARY KEY,
	value varchar(30),
	event_time timestamp DEFAULT now(),
	event_data text
);
  1. Navigate to http://localhost:9001/login:

Where credentials are:

User: minioadmin

Password: minioadmin

Screen Shot 2022-02-26 at 1 13 25 PM
  1. Then go to notification page under http://localhost:9001/settings/notification-endpoints:
Screen Shot 2022-02-26 at 1 18 57 PM
  1. Then select PostgreSQL option:
Screen Shot 2022-02-26 at 1 44 03 PM
  1. Then fill out the form:
Connection String: user=postgres password=password host=localhost dbname=postgres port=5432 sslmode=disable
Table: events
Queue Dir: Blank
Queue Limit: 10000
Comment: some comment
Screen Shot 2022-02-26 at 1 45 28 PM
  1. Then restart the system:
Screen Shot 2022-02-26 at 1 46 51 PM
  1. Put the credentials after restart and go to notifications: http://localhost:9001/settings/notification-endpoints this time you will see the PostgreSQL notification added and online:
Screen Shot 2022-02-26 at 1 47 33 PM

Delete notification

mc alias set myminio http://localhost:9000 minioadmin minioadmin
mc admin config reset myminio/ notify_postgres
mc admin service restart myminio/

This is how it looks from example above:

$ mc alias set myminio http://localhost:9000 minioadmin minioadmin
Added `myminio` successfully.
$ mc admin config reset myminio/ notify_postgres
Key is successfully reset.
Please restart your server with `mc admin service restart myminio/`.

$ mc admin service restart myminio/
Restart command successfully sent to `myminio/`. Type Ctrl-C to quit or wait to follow the status of the restart process.
....
Restarted `myminio/` successfully in 2 seconds

And after deletion we are back to empty stage:

Screen Shot 2022-02-26 at 1 51 28 PM