Re Tsebisa InterSystems API Manager (+ webinar)

Haufinyane tjena re lokolotse InterSystems API Manager (IAM), e leng karolo e ncha ea InterSystems IRIS Data Platform e fanang ka ponahalo, taolo le taolo ea sephethephethe sa API ho pholletsa le lisebelisoa tsa IT.

Sehloohong sena, ke tla u bontša mokhoa oa ho theha IAM le ho bonts'a tse ling tsa bokhoni bo bongata boo u nang le bona ka IAM. InterSystems API Manager o u lumella ho:

  • Lekola API, utloisisa hore na ke mang ea sebelisang API, ke li-API life tse tsebahalang haholo, le hore na ke life tse hlokang ntlafatso.
  • Laola hore na ke mang ea sebelisang API le ho fokotsa tšebeliso ea API ho tloha ho lithibelo tse bonolo tsa phihlello ho ea ho lithibelo tse thehiloeng ho kopo - o na le taolo ea tloaelo 'me o ka arabela kapele phetohong ea tšebeliso ea API.
  • Sireletsa li-API tse sebelisang mekhoa ea ts'ireletso e bohareng joalo ka OAuth2.0, LDAP kapa Netefatso ea Letshwao la Key.
  • Etsa hore ho be bonolo ho baetsi ba mekhatlo ea boraro 'me u ba fe boiphihlelo bo holimo ba API ka ho bula portal ea nts'etsopele e inehetseng.
  • Eketsa API 'me u netefatse latency e fokolang ea karabelo.

Tsamaiso ea API ke ea bohlokoa bakeng sa ho fetela ho SOA kapa meralo ea microservice, ho nolofatsa ho kopanya pakeng tsa litšebeletso tsa motho ka mong (micro), ho etsa hore li fumanehe ho bareki bohle ba ka ntle le ba ka hare. Ka lebaka leo, li-API tse ncha li ba bonolo ho li etsa, ho li hlokomela le ho li sebelisa.

Haeba u se u ntse u sebelisa InterSystems IRIS, u ka eketsa khetho ea IAM laesenseng ea hau. Khetho ea IAM ke mahala bakeng sa bareki ba InterSystems IRIS, empa o tlameha ho kopa senotlolo se secha sa laesense ho InterSystems ho qala ho sebelisa IAM.

Haeba ha o so sebelise InterSystems IRIS mme o rera ho leka InterSystems API Manager, ka kopo ikopanye le InterSystems.

Ho qala le ho kenya

Bareki ba InterSystems ba ka khoasolla kabo ea IAM webosaeteng WRC Karolo ea "Software Distribution" 'me u tsamaee joalo ka setshelo sa Docker. Bonyane litlhoko tsa sistimi:

Qalong, o hloka ho khoasolla setšoantšo sa Docker (Bohlokoa! Sebaka sa polokelo se nang le WRC ha se setšoantšo sa Docker, u hloka ho se manolla, ho na le setšoantšo sa Docker ka hare):

docker load -i iam_image.tar

Taelo ena e tla etsa hore setšoantšo sa IAM se fumanehe hore se sebelisoe hamorao ho seva sa hau. IAM e sebetsa joalo ka sets'oants'o se arohaneng, kahoo o ka se phahamisa ka boikemelo ho InterSystems IRIS. Ho matha IAM ho hloka phihlello ea InterSystems IRIS ho jarolla laesense.

Theha InterSystems IRIS:

  • Lumella ts'ebeliso ea tepo /api/IAM
  • Lumella mosebelisi IAM
  • Fetola password ea mosebelisi IAM

Joale ha re qaleng setshelo sa IAM. Ka har'a polokelo u tla fumana mangolo iam-setup bakeng sa Windows le Unix (le Mac). Lingoliloeng tsena li tla u thusa ho beha maemo a tikoloho ka nepo, ho lumella setshelo sa IAM ho theha khokahano le InterSystems IRIS. Mona ke mohlala oa mongolo o sebetsang ho Mac:

source ./iam-setup.sh 
Welcome to the InterSystems IRIS and InterSystems API Manager (IAM) setup script.
This script sets the ISC_IRIS_URL environment variable that is used by the IAM container to get the IAM license key from InterSystems IRIS.
Enter the full image repository, name and tag for your IAM docker image: intersystems/iam:0.34-1-1
Enter the IP address for your InterSystems IRIS instance. The IP address has to be accessible from within the IAM container, therefore, do not use "localhost" or "127.0.0.1" if IRIS is running on your local machine. Instead use the public IP address of your local machine. If IRIS is running in a container, use the public IP address of the host environment, not the IP address of the IRIS container. xxx.xxx.xxx.xxx               
Enter the web server port for your InterSystems IRIS instance: 52773
Enter the password for the IAM user for your InterSystems IRIS instance: 
Re-enter your password: 
Your inputs are:
Full image repository, name and tag for your IAM docker image: intersystems/iam:0.34-1-1
IP address for your InterSystems IRIS instance: xxx.xxx.xxx.xxx
Web server port for your InterSystems IRIS instance: 52773
Would you like to continue with these inputs (y/n)? y
Getting IAM license using your inputs...
Successfully got IAM license!
The ISC_IRIS_URL environment variable was set to: http://IAM:****************@xxx.xxx.xxx.xxx:52773/api/iam/license
WARNING: The environment variable is set for this shell only!
To start the services, run the following command in the top level directory: docker-compose up -d
To stop the services, run the following command in the top level directory: docker-compose down
URL for the IAM Manager portal: http://localhost:8002

Joalokaha u bona, lebitso le felletseng la setšoantšo, aterese ea IP, boema-kepe ba InterSystems IRIS le password bakeng sa mosebelisi oa IAM ke tsona feela tseo u li hlokang hore u qale.

Sebakeng sa ho tsamaisa script, o ka beha mefuta e fapaneng ea tikoloho ka letsoho:

ISC_IAM_IMAGE=intersystems/iam:0.34-1-1
ISC_IRIS_URL=http://IAM:<PASS>@<IP>:<PORT>/api/iam/license

Qalisa

Joale ha re qaleng IAM ka ho tsamaisa taelo:

docker-compose up -d

Taelo ena e hlophisa lijana tsa IAM mme e netefatsa hore tsohle li sebetsa ka nepo. Boemo ba lijana bo hlahlojoa ho sebelisoa taelo:

docker ps

Bula sebopeho sa admin ho sebatli sa hau localhost:8002.

Re Tsebisa InterSystems API Manager (+ webinar)

Ha e na letho hajoale hobane ke node e ncha ka ho felletseng. Ha re fetoleng seo. IAM e ts'ehetsa mohopolo oa libaka tsa mosebetsi bakeng sa ho arola li-API ka li-module le/kapa litaelo. Eya sebakeng sa "default" seo re tla se sebelisa bakeng sa liteko tsa rona.

Re Tsebisa InterSystems API Manager (+ webinar)

Palo ea likopo tsa sebaka sena sa mosebetsi e ntse e le zero, empa u tla fumana mohopolo oa mehopolo ea mantlha ea IAM ho menu e ka letsohong le letšehali. Lintlha tse peli tsa pele: Litšebeletso le Litsela ke tsona tsa bohlokoa ka ho fetisisa:

  • Tšebeletso ke API eo re batlang ho fana ka phihlello ho bareki ho eona. Kahoo, REST API ho InterSystems IRIS ke Tšebeletso, joalo ka mohlala, Google API haeba u batla ho e sebelisa.
  • Tsela e etsa qeto ea hore na likopo tse kenang tsa Tšebeletso li lokela ho romelloa hofe. Tsela e 'ngoe le e' ngoe e na le maemo a itseng, 'me haeba a finyelloa, kopo e romelloa Tšebeletsong e nepahetseng. Ka mohlala, Tsela e ka tsamaisanang le IP, sebaka sa motho ea romelang, mekhoa ea HTTP, likarolo tsa URI, kapa motsoako oa mehlala ena.

tšebeletso ea

Ha re theheng InterSystems IRIS Service, e nang le litekanyetso tse latelang:

tšimo
boleng
tlhaloso

lebitso
iris e
Lebitso la Tshebeletso

moamoheli
IP
InterSystems IRIS moamoheli oa seva kapa ip

kepe boo
52773
InterSystems IRIS server web port

tsela
/api/atelier
Tsela ea metso

protocol
-http
Protocol

Tlohela litekanyetso tse setseng e le tsa kamehla. Tobetsa konopo Create ebe u ngola ID ea Tšebeletso e entsoeng.

Tsela

Joale ha re theheng tsela:

tšimo
boleng
tlhaloso

tsela
/api/atelier
Tsela ea metso

protocol
-http
Protocol

service.id
tataiso ho tloha ho 3
Tšebeletso (ID ho tloha mohatong o fetileng)

Tlohela litekanyetso tse setseng e le tsa kamehla. Tobetsa konopo Create ebe u ngola ID ea Tsela e entsoeng. Ka kamehla, IAM e mamela likopo tse kenang ho port 8000. Hona joale likopo li rometsoe ho http://localhost:8000 le ho qala ka /api/atelier li fetisetsoa ho InterSystems IRIS.

Teko

Ha re leke ho etsa kopo ho moreki oa REST (ke sebelisa Motho oa poso).

Re Tsebisa InterSystems API Manager (+ webinar)

Ha re romelle kopo ea GET ho http://localhost:8000/api/atelier/ (u seke oa lebala / qetellong) 'me u fumane karabo ho tsoa ho InterSystems IRIS. Kopo e 'ngoe le e' ngoe e feta ka IAM e bokellang metrics:

  • Khoutu ea boemo ba HTTP.
  • tieho.
  • Tlhokomelo (haeba e lokisitsoe).

Ke ile ka etsa likopo tse ling tse 'maloa (ho kenyeletsoa le likopo tse peli ho li-endpoints tse seng teng joalo ka /api/atelier/est/), liphetho li bonahala hang-hang ho dashboard:

Re Tsebisa InterSystems API Manager (+ webinar)

Ho sebetsa le li-plugins

Kaha joale re na le Route e hlophisitsoeng, re khona ho laola API ea rona. Re ka eketsa likarolo tse tla tlatsetsa tšebeletsong ea rōna.

Mokhoa o tloaelehileng oa ho fetola boitšoaro ba API ke ho kenya plugin. Li-plugins li arola tšebetso ea motho ka mong 'me li ka hokeloa ho IAM lefatšeng ka bophara kapa ho mekhatlo e ikemetseng feela, joalo ka Mosebelisi (sehlopha sa basebelisi), Tšebeletso kapa Tsela. Re tla qala ka ho kenya plugin ea Rate Limiting ho Route. Ho theha khokahano lipakeng tsa plugin le tsela, re hloka sekhetho se ikhethileng (ID) sa tsela.

Ho fokotsa palo ea likopo

Tobetsa Li-plugins ka har'a menyu ea lehlakore le letšehali. U ka bona li-plugins tsohle tse sebetsang skrineng sena, empa kaha seva ena ea IAM e ncha, ha ho na li-plugins tse sebetsang hajoale. Kahoo tsoela pele mohatong o latelang ka ho tobetsa "New Plugin".

Plugin eo re e hlokang e sehlopheng sa "Traffic Control" mme e bitsoa "Rate Limiting". Khetha eona. Ho na le litlhophiso tse 'maloa tseo u ka li behang mona, empa re tsotella feela likarolo tse peli:

tšimo
boleng
tlhaloso

route_id
ID
ID ea tsela

config.metsotso
5
Palo ea likopo ka motsotso

Ke phetho. Plugin e hlophisitsoe ebile e sebetsa. Hlokomela hore re ka khetha linako tse fapaneng tsa nako, joalo ka motsotso, hora kapa letsatsi. Litlhophiso li ka kopanngoa (mohlala, likopo tse 1000 ka hora le ka nako e ts'oanang likopo tse 100 ka motsotso). Ke khethile metsotso hobane e etsa hore ho be bonolo ho hlahloba ts'ebetso ea plugin.

Haeba u romela kopo e tšoanang hape ho Postman, u tla bona hore karabo e khutliselitsoe ka lihlooho tse ling tse 2:

  • XRateLimit-Metsotso-Moeli: 5
  • XRateLimit-metsotso e setseng: 4

Sena se bolella moreki hore e ka etsa likopo tse 5 ka motsotso mme e ka etsa likopo tse ling tse 4 nakong ea hajoale.

Re Tsebisa InterSystems API Manager (+ webinar)

Haeba u etsa kopo e ts'oanang khafetsa, qetellong u tla felloa ke palo e fumanehang 'me u fumane khoutu ea boemo ba HTTP ea 429 ka sehlopha se latelang sa karabo:

Re Tsebisa InterSystems API Manager (+ webinar)

Ema hanyane 'me u tla khona ho kenya likopo hape.

Ena ke sesebelisoa se bonolo se u lumellang hore u:

  • Sireletsa backend ho tloha meroalo surges.
  • Bolella bareki hore na ba ka etsa likopo tse kae.
  • Etsa chelete ka API.

O ka beha boleng bakeng sa linako tse fapaneng tsa nako mme ka hona o thethefatsa sephethephethe sa API ka nako e itseng. Ha re re u lumella likopo tse 600 ka hora tseleng e itseng. Ka karolelano ho na le likopo tse 10 ka motsotso. Empa ha ho letho le thibelang moreki ho tlatsa likopo tsohle tsa 600 motsotsong oa pele oa hora. Mohlomong sena ke seo u se hlokang. U ka 'na ua batla ho fumana mojaro o eketsehileng nakong ea hora. Ka ho beha boleng ba tšimo config.minute Boleng ba 20 bo netefatsa hore basebelisi ba hau ba etsa likopo tse fetang 20 ka motsotso le likopo tse 600 ka hora. Sena se lumella li-spikes tse nyane ka nako ea motsotso o le mong ha ho bapisoa le palo e felletseng ea likopo tse 10 ka motsotso, empa basebelisi ba ke ke ba sebelisa palo ea hora motsotso o le mong. Hona joale ba tla hloka bonyane metsotso e 30 ho sebelisa likōpo tsohle tsa bona. Bareki ba tla fumana lihlooho tse eketsehileng bakeng sa nako e 'ngoe le e' ngoe e boletsoeng, mohlala:

Sehlooho sa HTTP
boleng

X-RateLimit-Limit-hora
600

X-RateLimit-Hora e setseng
595

X-RateLimit-Moeli-motsotso
20

X-RateLimit-Metsotso-e setseng
16

Ehlile, ho na le mekhoa e mengata e fapaneng ea ho beha meeli ea lipotso ho latela seo u batlang ho se fihlela.

fumanoeng ke

Ke tla qeta mona, ke nahana hore ho na le lisebelisoa tse lekaneng bakeng sa sengoloa sa pele mabapi le InterSystems API Manager. Re sebelisitse e 'ngoe feela ea li-plugins tse fetang 40. Ho na le lintho tse ling tse ngata tse khahlisang tseo u ka li etsang ka IAM:

  • Kenya mokhoa o bohareng oa netefatso bakeng sa li-API tsa hau kaofela.
  • Lekanya mojaro o sebelisa selekanyi sa mojaro ho pholletsa le Litšebeletso tse ngata.
  • Kenya tšebetso e ncha le litokiso tsa liphoso ho bamameli ba liteko pele ho ntlafatso e felletseng.
  • Fana ka baetsi ba ka hare le ba kantle ka sebaka sa marang-rang se inehetseng se ngolang li-API tsohle.
  • Likopo tsa cache tsa ho fokotsa nako ea karabo le ho fokotsa mojaro ho backend ea sistimi.

litšupiso

Webinar

Re u memela ho webinar "API Management with InterSystems API Management", e tla etsahala ka November 21 ka 10:00 nako ea Moscow (GMT + 3).
InterSystems API Manager (IAM) ke karolo e ncha ea InterSystems IRIS Data Platform e fanang ka tlhokomelo, taolo le tsamaiso ea sephethephethe ho ea / ho tloha ho web APIs ka har'a lisebelisoa tsa IT. Ho webinar re tla bonts'a bokhoni ba bohlokoa ba InterSystems API Management:

  • Lisebelisoa tsa ho lekola sephethephethe sa API.
  • Litaolo tsa sephethephethe sa API, ho kenyelletsa taolo ea bandwidth, ho fokotsa palo ea mehala ea API, ho boloka lethathamo la manane a lumelletsoeng le a hanetsoeng a liaterese tsa IP, jj.
  • Lisebelisoa tsa tlhophiso ea ts'ireletso ea API.
  • Portal ea Moqapi bakeng sa ho phatlalatsa litokomane tse sebetsanang le API.
  • Sebaka se le seng sa ho fihlella API.

Webinar e etselitsoe baetsi ba meralo, bahlahisi le batsamaisi ba sistimi.

Ngoliso ea hlokahala!

Source: www.habr.com

Eketsa ka tlhaloso