PHPackages                             seanmorris/ids - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Security](/categories/security)
4. /
5. seanmorris/ids

ActiveLibrary[Security](/categories/security)

seanmorris/ids
==============

0.0.0(6y ago)43.1k[2 PRs](https://github.com/seanmorris/ids/pulls)1PHPCI failing

Since Dec 21Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/seanmorris/ids)[ Packagist](https://packagist.org/packages/seanmorris/ids)[ RSS](/packages/seanmorris-ids/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (12)Used By (1)

[![avatar](https://avatars3.githubusercontent.com/u/640101?s=80&v=4)](https://avatars3.githubusercontent.com/u/640101?s=80&v=4)

SeanMorris/Ids v00.0.0
======================

[](#seanmorrisids-v0000)

*/ eye dee ess /* • The PHP + Docker Framework

[![seanmorris/ids](https://camo.githubusercontent.com/15654fba7985d61e957da658e2a6822949bd7439ae4b0c3a6ea23605e06d4d4f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7365616e6d6f727269732f6964733f636f6c6f723d393030266c6162656c3d7365616e6d6f72726973253246696473266c6f676f3d64617461253341696d616765253246706e672533426261736536342532436956424f5277304b47676f414141414e53556845556741414143414141414166434159414141434756732532424d4141414862306c4551565234327056576131435531786b326453597a4853733461457345485a30564159454642424751416352626135437874554a70626569494e3242644c674c4c72697a4b516b7830756268444d42437579335542755175494774416f67535131704b303236625364746a4f3130546252483036624a71505a7025324263357a4c6f79444a58395a70375a383333662532427a37506539374c253242586252504e644c746f56436f5842657457725659774534694d66306e635870794f586d357059734d4c5a3639656f72253246763725324254774943416942253242467754614b70584b4a3875584c3725324279644f6e534d59486b42556a61493352316459337a3850433436253242586c4257397662345347686949734c4d77716741574139746277384844733362735825324225324666765230784d7a46314247376567624c6934755069755762506d455865795a6373574b3855336239363859495345684341774d4a432532426147686f774f6a6f7144556e4a346362655554752532425852744f31657966687333626f5264324845454251584a414b7171717444653367364c78514b6a305168525469785a736b5135582532427233253242506e353354397a356778323774784a456f654675664e44687736686f7149435a57566c6147787352484e7a4d31706157766a4c5a253242533976336a78346a327a744a32636e424b6a6f364f6e73374b79304e4852676432376435504d6f62537a385477395061465771394866333839645339476d7069613074726169707159476d5a6d5a306e6274327258546f7345546e36566732624a6c45776b4a4352675a476247617a575a7333373664684173575a37723337647548754c6734354f666e55357a434e6e42547a49714e303872474667464d5041764132646c356d4e33613364304e4268416247347667344743534c796a744f33627334473470784854504572646c6f4c533039466c6663627057726c7735504373415a7143767234384f736e735445785068362532427637776d616a6a5369667248646257397363635162467248417336634d67374148597533253242595a4b78665a32636e4267594755467462693553556c4f656230585965324d526c7778555746734a674d44427a7a4d4963386348425157693157766a342532424e43502532466e4d44634864334878614e67636a49534f68304f6f6e69346d49634f33614d4a7872544c4d58396c5035593737574261376e7a676f4943436c426f6c6a41445955623065723145556c4953413534253246414e3759546a794b325935644f6e416b642532423361685a444e6f51674f3945666f526847514f4363696f364a51564654456a4d3052352532427a583139636a49694b434f37654a25324625324638412532424e4357586f4a427341395956784c364267626a33504544754e7457676c666333464657586b35786539505a4125324241557349393442504e5149352532466a4154414479636e4a6142646b41534668714e4772384f25324278526d444b6776647269784554485156336853642532423863736b30545039464a6643476f3247357768486b6e787a4a6f6b6a71253246425944326558466659415876366555253246396178547125324274445762253242413142314e5a745350685a496b346653634444305272676433334152353341644465714e4964526644516536556e3738664f6b67314a38614767494b70574b4f325170353467543371496b75794d3234664372556631532532464b59784d2532426841374e624a364c4151253242506a357a7a5362324c32586a7925324255766a34347543644743754933766341486c686c4d74674f253246375150253242636755543161657862557349387655466550507357635448783750756337346c764365635637696949476b762532467442676d4f7a495052693071464f586a436658785177585a384a56314a5a5265363733674d754b4830435647416438306f756e4532313463717556344a6f423243446650786975687463364256786657536e2532466a49685025324262796e4a6a5661697a4c773958674471433044253242474c6f626544585852673572354d4555375646655071654756504e7064446d356941764f307369497a3064565725324265416a362532424b444e685a51444d7946513776687970526c35364b754950253246417137587430446c25324225324237496e6a544a765942495366487a64306456797630774564642532424e656c432532465941507539253246432532466a304575344e3125324242487358476f5033634b5133586c614243253246353356716a446555346d5a544f535a62544c685757346f3634326c6d51675464795a365167585325324666513554625a5734302532464d4f4a70764c5954366c676d4c644f6d7a7756534a416c4a534e39304d523250334c64645369706a324166773565414f344d574c25324238316f6733644e6b346b704b476f3065506f7249674333253242326c4d77496664494e334737485a304d5855506d3658676230395873742532424561555a627925324242486e71564e456d4a7045646925324244716c316e534830704155494153436b39766249765a4b726850344f47375a716c46545673413925324637656666366262796461386568794e6359725469496e4d783058436a4c784a3474526946366371665748585a6a71506f666535704e6933596e737a417a6361437a4472575954556c4e534d5762536f6134794137663753326b727878576658554c75617a39476545516b436b2532466d53653648516f4e61314b5432496e475766326677644d72314876305233437a506766583964756731326268615a78547037624133323351764c45593174476c7834743443677934587161726a53424d6f46477332614a353452787661306b63474d646d473465717a304f644a62716c424c5770535734356955303653663630364d584b304f4656317935534864465761384b7577346b3766544b4d524825324665677935514251253242342532426d5a5838764677595471524a364c55614f6170466d7025324653687262306b594c34644544736f394b7146707a6b7067613171436e46386477253246314b3734384f38325a37395757713556663273754f59586639315a5a4d5832525053414565764435355170637179253246415345304a6a467052676d6f447754576638523174614374393645734f63704754334e5367316e5061633239756d44535731334e5558356b4d4f76786a704135253246753153447677362532426779253242756d6e486255696b796c49724c355670384e645a41634d316e6645636232744a48253242704b44584f53637066576936317035626c5744345152536a367568566b75496d71755266304b4e3054494e2532466e766444487a595158444e5a337848473575393943554875525935656e566f447a62644d476e78634c7a46797030513977516569446e2532426a39693172636b4972766d4d3732686a733663764f636a6c6341443178784d335854646d646632783551334f4e443945566e3450434e61596a636a546b25324243617a327a7661557366253242704b4458413549323274302532467642504e6f69526d626a5859337236594f4174635870564c4169307051393979664563702532424e42744b6f504f496b4434374541484d526a25324272354925324648384e7257767a6e745749326741414141424a52553545726b4a676767253344253344267374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/15654fba7985d61e957da658e2a6822949bd7439ae4b0c3a6ea23605e06d4d4f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7365616e6d6f727269732f6964733f636f6c6f723d393030266c6162656c3d7365616e6d6f72726973253246696473266c6f676f3d64617461253341696d616765253246706e672533426261736536342532436956424f5277304b47676f414141414e53556845556741414143414141414166434159414141434756732532424d4141414862306c4551565234327056576131435531786b326453597a4853733461457345485a30564159454642424751416352626135437874554a70626569494e3242644c674c4c72697a4b516b7830756268444d42437579335542755175494774416f67535131704b303236625364746a4f3130546252483036624a71505a7025324263357a4c6f79444a58395a70375a383333662532427a37506539374c253242586252504e644c746f56436f5842657457725659774534694d66306e635870794f586d357059734d4c5a3639656f72253246763725324254774943416942253242467754614b70584b4a3875584c3725324279644f6e534d59486b42556a61493352316459337a3850433436253242586c4257397662345347686949734c4d77716741574139746277384844733362735825324225324666765230784d7a46314247376567624c6934755069755762506d455865795a6373574b3855336239363859495345684341774d4a432532426147686f774f6a6f7144556e4a346362655554752532425852744f31657966687333626f5264324845454251584a414b7171717444653367364c78514b6a305168525469785a736b5135582532427233253242506e353354397a356778323774784a456f654675664e44687736686f7149435a57566c6147787352484e7a4d31706157766a4c5a253242533976336a78346a327a744a32636e424b6a6f364f6e73374b79304e4852676432376435504d6f62537a385477395061465771394866333839645339476d7069613074726169707159476d5a6d5a306e6274327258546f7345546e36566732624a6c45776b4a4352675a476247617a575a7333373664684173575a37723337647548754c6734354f666e55357a434e6e42547a49714e303872474667464d5041764132646c356d4e33613364304e4268416247347667344743534c796a744f33627334473470784854504572646c6f4c533039466c6663627057726c7735504373415a7143767234384f736e735445785068362532427637776d616a6a5369667248646257397363635162467248417336634d67374148597533253242595a4b78665a32636e4267594755467462693553556c4f656230585965324d526c7778555746734a674d44427a7a4d4963386348425157693157766a342532424e43502532466e4d44634864334878614e67636a49534f68304f6f6e69346d49634f33614d4a7872544c4d58396c5035593737574261376e7a676f4943436c426f6c6a41445955623065723145556c4953413534253246414e3759546a794b325935644f6e416b642532423361685a444e6f51674f3945666f526847514f4363696f364a51564654456a4d3052352532427a583139636a49694b434f37654a25324625324638412532424e4357586f4a427341395956784c364267626a33504544754e7457676c666333464657586b35786539505a4125324241557349393442504e5149352532466a4154414479636e4a6142646b41534668714e4772384f25324278526d444b6776647269784554485156336853642532423863736b30545039464a6643476f3247357768486b6e787a4a6f6b6a71253246425944326558466659415876366555253246396178547125324274445762253242413142314e5a745350685a496b346653634444305272676433334152353341644465714e4964526644516536556e3738664f6b67314a38614767494b70574b4f325170353467543371496b75794d3234664372556631532532464b59784d2532426841374e624a364c4151253242506a357a7a5362324c32586a7925324255766a34347543644743754933766341486c686c4d74674f253246375150253242636755543161657862557349387655466550507357635448783750756337346c764365635637696949476b762532467442676d4f7a495052693071464f586a436658785177585a384a56314a5a5265363733674d754b4830435647416438306f756e4532313463717556344a6f423243446650786975687463364256786657536e2532466a49685025324262796e4a6a5661697a4c773958674471433044253242474c6f626544585852673572354d4555375646655071654756504e7064446d356941764f307369497a3064565725324265416a362532424b444e685a51444d7946513776687970526c35364b754950253246417137587430446c25324225324237496e6a544a765942495366487a64306456797630774564642532424e656c432532465941507539253246432532466a304575344e3125324242487358476f5033634b5133586c614243253246353356716a446555346d5a544f535a62544c685757346f3634326c6d51675464795a365167585325324666513554625a5734302532464d4f4a70764c5954366c676d4c644f6d7a7756534a416c4a534e39304d523250334c64645369706a324166773565414f344d574c25324238316f6733644e6b346b704b476f3065506f7249674333253242326c4d77496664494e334737485a304d5855506d3658676230395873742532424561555a627925324242486e71564e456d4a7045646925324244716c316e534830704155494153436b39766249765a4b726850344f47375a716c46545673413925324637656666366262796461386568794e6359725469496e4d783058436a4c784a3474526946366371665748585a6a71506f666535704e6933596e737a417a6361437a4472575954556c4e534d5762536f6134794137663753326b727878576658554c75617a39476545516b436b2532466d53653648516f4e61314b5432496e475766326677644d72314876305233437a506766583964756731326268615a78547037624133323351764c45593174476c7834743443677934587161726a53424d6f46477332614a353452787661306b63474d646d473465717a304f644a62716c424c5770535734356955303653663630364d584b304f4656317935534864465761384b7577346b3766544b4d524825324665677935514251253242342532426d5a5838764677595471524a364c55614f6170466d7025324653687262306b594c34644544736f394b7146707a6b7067613171436e46386477253246314b3734384f38325a37395757713556663273754f59586639315a5a4d5832525053414565764435355170637179253246415345304a6a467052676d6f447754576638523174614374393645734f63704754334e5367316e5061633239756d44535731334e5558356b4d4f76786a704135253246753153447677362532426779253242756d6e486255696b796c49724c355670384e645a41634d316e6645636232744a48253242704b44584f53637066576936317035626c5744345152536a367568566b75496d71755266304b4e3054494e2532466e766444487a595158444e5a337848473575393943554875525935656e566f447a62644d476e78634c7a46797030513977516569446e2532426a39693172636b4972766d4d3732686a733663764f636a6c6341443178784d335854646d646632783551334f4e443945566e3450434e61596a636a546b25324243617a327a7661557366253242704b4458413549323274302532467642504e6f69526d626a5859337236594f4174635870564c4169307051393979664563702532424e42744b6f504f496b4434374541484d526a25324272354925324648384e7257767a6e745749326741414141424a52553545726b4a676767253344253344267374796c653d666f722d7468652d6261646765)[![Apache-2.0 Licence Badge](https://camo.githubusercontent.com/97896b2b946c2a21f854e13ad2bf2b1910c7b83d2bed59957cdf1739cbc93cc9/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f6c2f6376332d696e6a6563743f6c6f676f3d61706163686526636f6c6f723d333338383030267374796c653d666f722d7468652d6261646765)](https://github.com/seanmorris/cv3-inject/blob/master/LICENSE)[![CircleCI](https://camo.githubusercontent.com/02eaf0fd0f2eb331b9f99ddb1ac536d9e0f965f9529341ccae127398f1def1bd/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f6275696c642f6769746875622f7365616e6d6f727269732f6964733f6c6f676f3d636972636c656369266c6f676f436f6c6f723d7768697465267374796c653d666f722d7468652d626164676526746f6b656e3d62353261633438396433633264313730393633303231633831656364343232623735333666343163)](https://circleci.com/gh/seanmorris/ids/) [![Codecov](https://camo.githubusercontent.com/922fb0adc3debeff7bd5c8e19d78412d80aacd7bbe6b40e644058ddf96569fbf/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f7365616e6d6f727269732f6964733f636f6c6f723d423830266c6f676f3d636f6465636f76266c6f676f436f6c6f723d7768697465267374796c653d666f722d7468652d6261646765)](https://codecov.io/gh/seanmorris/ids)[![Size badge](https://camo.githubusercontent.com/cf571b91d20220594af23528d2917568329cf40fdba2c5761ee3425734dde623/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f7365616e6d6f727269732f6964733f6c6f676f3d64617461253341696d616765253246706e672533426261736536342532436956424f5277304b47676f414141414e5355684555674141414251414141414f43415141414143467a6652374141414246306c455156516f465158425157764f415144413465662f376f3239595774714b553745785745354f49766d344c4b636e587744376151304e2f6b41637a4f3169314b4f4f30784a76516f6a61546d344b624a61626e4a79734c53663577464161363033435542333232794f414169745654383642545451312b6f4a4459445163762b71465272337643316f6f595071446b486f596766564b6d6e536668473632742f71426b486e327138656b6a527072794230762f725a3265683472367470593570703347783752544f4e6f4a66564c6e705166656b59744e473038333272526a33744561543331624f78513577632f6f4154726e6e6e69454d665866615a444672416f456b373158616a4e4e394f5656573748595665565a3941462f70643359506d323637716259733074463539377779677061717551374e7439514c6f566c575843454b3371316f434346327036695942704b474e366b4e7a41547264723271564141436139726752514b506574416e4166316a582f71536b4e3861494141414141456c46546b5375516d4343267374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/cf571b91d20220594af23528d2917568329cf40fdba2c5761ee3425734dde623/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f7365616e6d6f727269732f6964733f6c6f676f3d64617461253341696d616765253246706e672533426261736536342532436956424f5277304b47676f414141414e5355684555674141414251414141414f43415141414143467a6652374141414246306c455156516f465158425157764f415144413465662f376f3239595774714b553745785745354f49766d344c4b636e587744376151304e2f6b41637a4f3169314b4f4f30784a76516f6a61546d344b624a61626e4a79734c53663577464161363033435542333232794f414169745654383642545451312b6f4a4459445163762b71465272337643316f6f595071446b486f596766564b6d6e536668473632742f71426b486e327138656b6a527072794230762f725a3265683472367470593570703347783752544f4e6f4a66564c6e705166656b59744e473038333272526a33744561543331624f78513577632f6f4154726e6e6e69454d665866615a444672416f456b373158616a4e4e394f5656573748595665565a3941462f70643359506d323637716259733074463539377779677061717551374e7439514c6f566c575843454b3371316f434346327036695942704b474e366b4e7a41547264723271564141436139726752514b506574416e4166316a582f71536b4e3861494141414141456c46546b5375516d4343267374796c653d666f722d7468652d6261646765)[![Docker Pulls - Idilic](https://camo.githubusercontent.com/447b861d2280725c282afaec7db35bcd85e4861dc6cbd03aa9d9d8b60556f7b3/68747470733a2f2f696d672e736869656c64732e696f2f646f636b65722f70756c6c732f7365616e6d6f727269732f6964732e6964696c69633f6c6f676f3d646f636b6572266c6f676f436f6c6f723d776869746526636f6c6f723d363030266c6162656c3d6964732e6964696c696325323070756c6c73267374796c653d666f722d7468652d6261646765)](https://hub.docker.com/repository/docker/seanmorris/ids.idilic)[![Docker Pulls - Server](https://camo.githubusercontent.com/811f8ad29cb53da9116d903dea30ab6147924207f69cb2f283fcb45de0fd9286/68747470733a2f2f696d672e736869656c64732e696f2f646f636b65722f70756c6c732f7365616e6d6f727269732f6964732e7365727665723f6c6f676f3d646f636b6572266c6f676f436f6c6f723d776869746526636f6c6f723d393630266c6162656c3d6964732e73657276657225323070756c6c73267374796c653d666f722d7468652d6261646765)](https://hub.docker.com/repository/docker/seanmorris/ids.server)

[![php 8.0 tests](https://camo.githubusercontent.com/133ddb98f9ecaae351f60384e0809051a105534364c377bcfbc3150bff9d501c/68747470733a2f2f7365616e6d6f727269732d6261646765722e6865726f6b756170702e636f6d2f6964732f6275696c642d616e642d707573685f382d303f6c6162656c3d706870253230382e30)](https://camo.githubusercontent.com/133ddb98f9ecaae351f60384e0809051a105534364c377bcfbc3150bff9d501c/68747470733a2f2f7365616e6d6f727269732d6261646765722e6865726f6b756170702e636f6d2f6964732f6275696c642d616e642d707573685f382d303f6c6162656c3d706870253230382e30)[![php 8.1 tests](https://camo.githubusercontent.com/812b7d5e086fb5f6f4548c2960001bb5c13df9606519716f5a1aad880bab4c00/68747470733a2f2f7365616e6d6f727269732d6261646765722e6865726f6b756170702e636f6d2f6964732f6275696c642d616e642d707573685f382d313f6c6162656c3d706870253230382e31)](https://camo.githubusercontent.com/812b7d5e086fb5f6f4548c2960001bb5c13df9606519716f5a1aad880bab4c00/68747470733a2f2f7365616e6d6f727269732d6261646765722e6865726f6b756170702e636f6d2f6964732f6275696c642d616e642d707573685f382d313f6c6162656c3d706870253230382e31)[![php 8.1 tests](https://camo.githubusercontent.com/10ad7f27cdb3fe8b5c08edfe5d3fff6918a16edbaa1f21d10ff992c4c9ab3ebb/68747470733a2f2f7365616e6d6f727269732d6261646765722e6865726f6b756170702e636f6d2f6964732f6275696c642d616e642d707573685f382d323f6c6162656c3d706870253230382e32)](https://camo.githubusercontent.com/10ad7f27cdb3fe8b5c08edfe5d3fff6918a16edbaa1f21d10ff992c4c9ab3ebb/68747470733a2f2f7365616e6d6f727269732d6261646765722e6865726f6b756170702e636f6d2f6964732f6275696c642d616e642d707573685f382d323f6c6162656c3d706870253230382e32)

The Ids library provides general domain-primitives for developing web based applications. Routing, requests, modeling configuration, logging, sessions, and database access are all abstracted behind simple, expressive interfaces to efficient and powerful code.

To prevent unexpected behavior, the system is set to die on all errors down to `E_NOTICE`, excluding `E_DEPRECATED` errors generated from the vendor directory.

The project is made to run in docker but doesn't require it. It can be included in any composer project, and used in part or in whole easily.

The philosophy of the Ids project is headlined by security, speed and easy of use, in that order.

View the docs at [docs.ids.seanmorr.is](http://docs.ids.seanmorr.is)

Dependencies
------------

[](#dependencies)

expand- Composer
- Docker
- Docker Compose
- GNU Make
- Git
- Linux or Compatible OS
- PHP
- SimpleTest
- Minikube (required for kubernetes targets only)

Installing
----------

[](#installing)

expandInclude Ids in your project with: ```
$ composer require seanmorris/ids
```

Install Ids globally for access to the `idilic` cli tool:

```
$ composer global require seanmorris/ids:dev-master
```

Add composer's global `vendor/bin` to your PATH by adding this to your `~/.bashrc`.

```
export PATH="$HOME/.composer/vendor/bin:$PATH"
```

Creating a New Ids Project
--------------------------

[](#creating-a-new-ids-project)

expandCreate a new project with composer, enter the directory and start php, apache &amp; mysql:

```
$ composer create-project seanmorris/ids-project -s dev --remove-vcs
$ cd ids-project
$ make @dev build start-bg
```

Thats it!

The companion package that provides a template for new projects can be found here:

Dev Tools
---------

[](#dev-tools)

expandThe `dev` build target provides facilities for connecting to xdebug and graylog.

### XDebug

[](#xdebug)

XDebug is built into the `dev` images by default. You can configure it by setting `XDEBUG_CONFIG_` environment variables in `.env.dev`. By default it will attempt to connect to port 9000 on `${DHOST_IP}`, which is the machine runing the project.

### Apt Cache

[](#apt-cache)

*Rebuild your images offline*

Build the project with `+aptcache` with an internet connection to populate your cache.

```
$ make @dev+aptcache build
```

... to be continued

### GrayLog

[](#graylog)

`\SeanMorris\Ids\Logger\Gelf` provides a simple interface to graylog. Just add it to the `IDS_LOGGERS_` environment variable to enable it. So long as there is a graylog server available , it will send all logs that meet the verbosity threshold.

The default graylog config for the `dev` target looks like:

```
IDS_LOGGERS_=\SeanMorris\Ids\Logger\Gelf
IDS_GRAYLOG_HOST=graylog
IDS_GRAYLOG_PORT=12201

```

This package comes with a default GELF TCP input in its graylog config backup. You can run `make graylog-restore` after starting graylog for the first time to create the input.

The graylog config can be backed up and restored with the following commands:

```
$ make graylog-backup     # alias glbak
$ make graylog-restore    # alias glres
```

Graylog can be started and stopped with the following commands:

```
$ make graylog-start      # alias gls
$ make graylog-start-fg   # alias glsf
$ make graylog-start-bg   # alias glsb

$ make graylog-stop       # alias gld

$ make graylog-restart    # alias glr
$ make graylog-restart-fg # alias glrf
$ make graylog-restart-bg # alias glrb
```

Some users

```
sysctl -w vm.max_map_count=262144
```

Idilic CLI
----------

[](#idilic-cli)

expandIds comes with the `idilic` command when installed globally with composer. When executed, it will ascend through the current path looking for another project including Ids. When it finds it, it will attach to that project and utilize its facilities.

If it encounters a local `idilic` pass-thru in the project directory, it will hand control to the docker environment where execution will continue.

Run `idilic help` to see actions exposed by any installed packages.

Multistaging / Environment Targets
----------------------------------

[](#multistaging--environment-targets)

expand### base, prod, dev, and test

[](#base-prod-dev-and-test)

By default Ids provides 4 build targets: base, prod, dev, and test. Each exposes different ports, so they may run without conflict in parallel.

- **base** exposes no ports and builds **without** require-dev.
- **prod** exposes port 80 (configurable by `IDS_EXPOSE_HTTP`) and port 443\* ( configurable by `IDS_EXPOSE_HTTPS` ) and builds **without** require-dev.
- **test** exposes port 2021 (configurable by `IDS_EXPOSE_HTTP`) and port 3031 ( `IDS_EXPOSE_SQL` ) and builds **with** require-dev.
- **dev** exposes port 2020 ( configurable by `IDS_EXPOSE_HTTP` ) and port 3030 ( `IDS_EXPOSE_SQL` ) and builds **with** require-dev.

\*Not yet implemented.

### Switching Targets

[](#switching-targets)

The system will use the TARGET environment variable to decide which build target to use.

If youre on the BASH shell simply run one of the following commands to set the target for the context of a single command:

- `make @base start`
- `make @dev build`
- `make @test test`
- `make @prod push-images`

If you don't feek like typing `@target` for every command, you can ask the system to remember a target with:

- `make stay@base`
- `make stay@dev`
- `make stay@test`
- `make stay@prod`

### Extending Environments

[](#extending-environments)

Additional targets may be specified by creating a new `infra/compose/[TARGET].yml` in your project. Build this file as you'd build any other docker-compose file.

Then create a new `.env.[TARGET]` file in `config/`. Add your defaults here.

If you need some target specific build steps. then add a `FROM base as TARGET` section to any docker files in `infra/docker` that are relevant to that build target. You can expand on any existing build target, you're not limited to extending `base`.

Build
-----

[](#build)

expandThe project may be built with `make`. Debian users can get this tool by running `apt-get install build-essential`. The build process also requires `docker` and `docker-compose`. `minikube` is required only for kubernetes testing.

The default build target is `base`. run `make stay@dev` or `make stay@test` to switch to the development/testing target. You can use @TARGET at the beginning of any make command to use the target for just that command.

```
$ make @dev build # build the project

$ make @dev start # start the services
```

Docker &amp; docker-compose are available here:

-
-

Start / Stop / Restart
----------------------

[](#start--stop--restart)

expandMake sure to set a target with `make stay@target` before issuing any commands. Alternatively you can run commands in the form `make @target command`.

```
$ make start      # Start the project in the background,
                  # with no output

$ make start-fg   # Start the project in the foreground.

$ make start-bg   # Start the project in the background,
                  # stream output to foreground.

$ make stop       # Stop all services defined for the target.

$ make stop-all   # Stop all services spawned for the target
                  # even ones no longer in target compose file.

$ make restart    # Stop, then restart the project in the background,
                  # with no output.

$ make restart-fg # Stop, then restart the project in the foreground.

$ make restart-bg # Stop, then restart the project in the background,
                  # stream output to foreground.
```

Images &amp; Tags
-----------------

[](#images--tags)

expand```
$ make list-images # List all images for the current project, target & branch.

$ make list-tags   # List all tags for the current project, target & branch.

$ make push-images # push all images for the current project, target & branch.

$ make pull-images # push all images for the current project, target & branch.
```

Autotagging / Autopublishing / Git Hooks
----------------------------------------

[](#autotagging--autopublishing--git-hooks)

expandRegister git hooks with `make hooks`.

Image tags are generated automatically on build based on the date, current git tag (falls back to commit hash).

The master branch will generate:

- repository/project:gitTag-target
- repository/project:date-target
- repository/project:latest-target

Branches other than master will generate:

- repository/project:gitTag-target-branch
- repository/project:date-target-branch
- repository/project:latest-target-branch

Images will be built on `git commit` and pushed on `git push` if the current branch appears in the project root `.publishing` file in the form: `BRANCH:TARGET`. For example this file would push images for prod &amp; test when `git push` is run for the master branch:

```
master:test
master:prod

```

Available Images
----------------

[](#available-images)

expandDocker images for seanmorris/ids.idilic &amp; seanmorris/ids.server for targets `base`, `dev`, and `test` are available for use &amp; extension on DockerHub:

- idilic
- server

Pull from the cli with:

```
$ docker pull seanmorris/ids.idilic:latest
$ docker pull seanmorris/ids.server:latest
```

or extend in a dockerfile with one of the following:

(it is not recommended to use `latest` in `FROM`)

```
FROM seanmorris/ids.idilic:TAGNAME
FROM seanmorris/ids.server:TAGNAME
```

Service Switches
----------------

[](#service-switches)

expandAdditional services can be included when running Ids. Simply add +toolname to your @target when issing a make command, and the necessary composer files will be included in the comtext of your command. For example, to start the system with graylog in dev mode: ```
make @dev+graylog start
```

Or inotify

```
make @dev+inotify start
```

Or both

```
make @dev+graylog+inotify start
```

Templating
----------

[](#templating)

expand*This ain't your granpappy's makefile.*

GNU Make has a distinct and powerful syntax. It borrows, or in some instances outright uses the underlying bash engine to allow a user to define complex build steps and track the relationships between them to ensure everything is up to date.

Make allows for recursive variable expansion, conditionals, loops, and even calls out to the shell. This syntax is no longer limted to the Makefile.

Simply put the extension `*.idstmp.*` *before* your existing file extension. Ids will look for these files in all subdirectories of the prohect and rebuild them on startup. The resulting file will have the extension `*.___gen.*` where the `*.idstmp.*` is in the source file.

The resulting files should be excluded from version control, as they may contain artifacts from one target that should not exist in another.

For example: *infra/docker/aptcache.idstmp.dockerfile* starts off with the following line:

```
FROM ${BASELINUX}
```

Varibles are not normally allowed in the `FROM` section of dockerfile, preprocessed by make before it is used. So long as the file extenstion begins with `.idstmp.`, we can count on a `.___gen.` file being produced. This allows us to keep all the images and containers synced to one base image.

The follwing lines from the end of the file show how one can use the shell to track who generated the file and when:

```
# generated @ $(shell date)
# by ${shell whoami} @ ${shell hostname}
```

See [Functions for Transforming Text](https://www.gnu.org/software/make/manual/html_node/Functions.html#Functions) for more information.

Configuration / Environment Variables / Secrets
-----------------------------------------------

[](#configuration--environment-variables--secrets)

expand### Loading Settings

[](#loading-settings)

Settings may be provided in environment variables, .env files, or yml files.

#### Environment Variable &amp; Target Files

[](#environment-variable--target-files)

The following files may be created/modified to configure the system. When the project is built, restarted, etc, they will be checked for modification, and re-built to the root of the projct if need be. The files generated to the root of the project should not be committed to version control.

- `config/.env` - Should not be committed to version control. Contains configuration that applies to the system regardles of the system's target.
- `config/.env.default` - Should be committed to version control. Contains non-secret configurations file and blank/dfault values for variables to be set in `config/.env`.
- `config/.env_TARGET` - Should not be committed to version control. Contains configuration based the system's target.
- `config/.env_TARGET.default` - Should be committed to version control. Contains non-secret configurations file and blank/dfault values for variables to be set in `config/.env_TARGET`.

The values set will be read according to the following precedence (higher takes precedence over lower):

- `.env_TARGET`
- `.env_TARGET.default`
- `.env`
- `.env.default`

Environment variables to be used in configuration should have the the prefix `IDS_`. An environment variable with the name IDS\_SOME\_VAR and IDS\_SOME\_OTHERVAR would be accessible within the system with:

```
IDS_SOME_VAR=value
IDS_SOME_OTHERVAR=other value
```

```
