 Thank you for coming to the session And let's start with this so the session this goal is improving your Drupal 8 Development workflow. I was talking about a few concepts about how to start a new project with Composer How to manage dependencies using Composer and from there how you can move on I mean move ahead for Getting your project deployed to a production server. I mean I won't be touching any like Product or platform. I will talk in more about concepts and showing you some snippets of code that you can Use and take advantage for doing something like this in your own workflow in your own workflow Well first start starting this My name is Jesus Manuel Olivas, which I totally miss putting my name here so it's was Manuel Olivas I'm Just partnership I'm just starting with other two good friends With this new company school, we know so you can find us if you need Like consulting or training or development. We have developers in like nine countries Let us know and you can find me on either Probably most of the social networks using jm or alabias same as rupa.org or tweeting with it We know account as well So the topics that we were touching during the session is First we'll talk about a code base I mean what a code means what a code base means and how can we have something like this and implemented in our project that? second we'll talking about I mean dependencies and how to manage or dependencies either project code like a package dependencies or Even in also infrastructure dependencies for your project We're also talking about config, which isn't like this is not like configuration management of triple Mostly how to like manage the configuration of your server like, you know, like how you handle or your Variables per environment if you are building like your site and you're building like a development Site and then testing environment in a staging or a place where you are building your Your site and then pushing this to your production server And finally we'll talking about the deployment some deployment in the scripts About some deployment scripts is something like we call something like be or release and run this is fire This could be in part of your like zi or continuous integration or actually on your continuous delivery It means like you can keep pushing changes often So first thing first let's go with code base Did you have the rule said you should have only one code base? Per application in this case per website. You saw only one repository for managing all of your code And obviously this project may have some dependencies, but then for that we will using Dependency manager for for handling all those all those dependencies, right? So ideally Only code that that you are granting for this application should be should be storing the on your on your repo and You should use a version control system like it You can use other but probably the most Famous one at this point is git And ideally you should have the same one the same code base to do many deploys It means if you are deploying to a staging or you're deploying a poor request or you're deploying to production You should use the same code code base So we have something like this right one code base and multiple deploys, right? So we only have one repo and you can deploy to multiple servers or multiple stages Then we have something like this ideally when we're working with Drupal There's some people, you know, there's some like best practices been there for a while people said I mean it's up to you You follow this or not people used to sell like I mean, it's a good idea to have any make your site in installation profile And the good thing about having an installation profile is that you can provide your site with some Specific functionality out of the box. You don't have to build your site from scratch every single time So ideally you should have some of your of those pieces of code Handled by by something you can some as someone you'll call features, right? So you package certain group of configuration into something called features you put it in your site You make it part of your installation profile. So next time you install your site You have all those I mean those little pieces means to start working with so you don't start from a scratch every single time I mean, there's some people who used to sell, you know, now that we have the configuration management will I mean there is a need for features. I mean seems like features now I mean will be used for what was I mean what was I mean created for right the Originally feature was created for manage and or package configuration when people on Drupal 7 Abuse features a little and use it for I mean managing the whole configuration of the site I mean, but at that point worst probably there was like Either I mean abusing features or you're moving your database all over in different stages with at some point Let's you know, let's use feature instead, but in this case, right? You can use you can keep using features for for what features were created for Then ideally you should keep rebuilding or installing your site From the come from from those configuration files. It means you are building making changes, right? The ideally you should Like create a new site in a site install something you create a new database and import all of those Configuration just to confirm and make sure all of your changes are on the on the repo are it means on the file system It means all those all that configuration isn't isn't isn't code. It's not only on the database It means you are ready export it as code Again in order to having something like this to be able to keep Rebuilding your site. There is some there's you have options. There is the config installer profile and you can also Have you can also have mean features for doing this. It just means up to you and if you want to know how to How to working with profiles there is a this issue which is really cool So now in Drupal. Well, it's still a patch, but you can start using playing with it It's stuck to 8.4. You can start working from from now You can start extending profile Let's say you can use an a base profile and extend and extend that one in with your own profile I mean installation which is really cool because you don't have to keep doing things all over again So I mean you can have you can take advantage of a base profile Like lining or thunder or any of those or those profiles and you extend and you add the specific pieces of Configuration that you want to have in your site. It means you don't have to like override things and basically mark You extend it and then you make changes in your own profile if you are interested about Rebuilding your site every single time the problem not the problem on an issue with configuration is like every time you install your site It gives you an I news may you ID number and then if you try to Import a the Mean the configuration that you export before and you just run something let's say you have a site you export configuration Then you run site install I mean you destroy database and create a new one you try to import that configuration that you previously export hang on a work But if you want to do that, that's this is that this is the place So you need to take a look keep I mean follow this project so it's called config installer and You will need to apply this patch as well. So there's there's an issue There's a patch for it. So you can follow instructions here You can start Rebuilding your sites from configuration or again, if you don't want to do this You can keep exploring just configure your configuration as fitters and then mean make them Make that feature import part of your building process and we'll see how this looks like and You know, I mean I hit And now now let's talk about dependencies. Maybe what I mentioned We have two type of dependencies each every dependency that your project has should be declaring code either Application dependencies and the infrastructure dependencies when I'm talking about infrastructure I mean I mean what the always that your project requires I mean which I mean like Extensions PHP extensions your prior require as well. So talking about application dependencies in this case Since we are using Drupal droplets using PHP. We will be using composer while using a Dependency manager for a specific language you should declare your Dependencies in something that is called a manifest file in the case of a composer. It is a composer that Jason file Okay, so if you are using composer will have this composer Jason file who contains any of the dependencies that or project requires While using when using composer, you can even declare, you know, I want PHP 7 or or mean or Five point something. I want to have this extension enable on the system But that doesn't mean for you to have the dependency that only like break your Mean composer install execution if you don't have that in the system So that's why you should also have your infrastructure on code or ask code And please make sure you use the the proper the appropriate dependency manager for the language I mean if you are using if you are requiring a PHP package Use composer if you are requiring something like JavaScript from the JavaScript world You can probably use something like MPM or bower or John or something like that, right? There is a way there as ways you can use composer to require JavaScript libraries, but you should I mean actually even there are some issues on the composer side even them Then the maintainer of composer tells you like she should not be doing this There are tools for that if you are again if you're requiring PHP Packages use I mean the dependency manager for that package, which is in this case is composed Well, we mean we just have a good old frame, right drosh make and this is the one we're using for years now I mean composers here Composer is well maintained. It's mature enough. It's my time in minutes It was I mean it's an a stand there is a lot of most of the modern PHP frameworks I use in it So so that's why Drupal. It's it's also a taken advantage of this one. How composer works again So what is composer what I'm as I mentioned is a package manager for PHP? Composer should be used for manage dependencies per project, right? Even when there is this composer global required who allows you to get dependencies globally on the system It's not a good idea. The idea you should isolate all the dependencies per project, right? The problem we'd require in global dependencies is Sometimes you have conflicts between them. It's let's talk about a project that I mean I do I do maintain triple console and At some point when we start working with this We decided to go like global installation because make it easier just one install per Per a computer and then you I mean you don't have to like keep maintaining different versions Well, the problem with this when you are having like a global definition You start with in several issues first is like since we are using some other projects like Like Drupal commerce and those mean Drupal commerce provide you with a CLI and that also I mean recommend you to like install globally What it happens what we see what I see happening is we were Drupal console were required in a specific version of symphony component like symphony console or a thing, right? Like let's say two point One point something and then in the CLI from commerce guys We're requiring a different version and then we start seeing a lot of issues with them like you know fighting I mean every I mean every composer update of Drupal console or from the old from Drupal commerce I mean CLI we're fighting for Resolving all those issues and dependencies and at some point, you know, it's like I can no longer keep updating Drupal console I can no longer keep updating I mean Drupal commerce Eli, so we decide when in this case when I when I'm talking to Drupal commerce, I mean like like platform, you're right and We decide to go the other route So and go to the original route when we start Drupal console We were doing composer required Drupal console per Drupal site and people were complaining about your hacking core Because you're changing the composer file and I was like no This is the way how it works. I mean This is how the way how we just you shouldn't manage dependencies But at that point Drupal was not ignoring like third-party libraries It means the vendor directory where those libraries are it was part of their repo It's I mean must I mean was not ignored from the repository So that's why people I mean also kind of complain about what's hacking core Then we're changing a file that people think was part of core. It's not Drupal core has its own Composer file is within the core Directory right it's not on the root of the project and there, you know It also Drupal take advantage of an external library for merging those I mean those both composer files and you know Get the dependencies for you, but again First thing remember, please Keep dependencies per project So how composer works? There is a war for a composer is really really simple and it's I mean it's not that hard to understand So again, you define your dependencies into a manifest file, right? This is where this is the composer Jason file is here This file contain any dependency of your project Let's say your project is depending in admin toolbar. You have a section where you define this There's dependency in this composer Jason But then then you run composer install the first time. Let's think about this is the first time I'm just running this project I don't have a composer look what it happens with composer When the whole process finish he creates a composer log for you composer log file for you I'll talk about in a few the first time you run it. You don't have this composer log file. So what it happens composer You execute composer from the CLI something like composer install or update in this case It doesn't matter because you don't have the log file it read all of the dependencies in this file then and Go to a place called packages Let's say Pegasus.org is the place where all of the packages all the PHP packages are registered Well, not all Drupal packages are registered within Drupal.org But most of the libraries PHP libraries take use packages, right? So basically can those are go to a place where all those definitions are set So I mean if you're a choir admin toolbar or the veil or you know Drupal console or any other dependencies in your project There is a place where this is it where this definition. It's it's created in this case We call this like packages are kiter from here What composes it gets from here is the place where the source code from this repo is living, right? It means if I am requiring admin toolbar It means this code is leaving somewhere else like could be like github or beat bucket or your github or anything In the case of Drupal, it's leaving in Drupal.org. So it matches, you know, this package is living here So I just get it from the system once finished getting from the system It's end up like adding a vendor director creating a vendor director in your local system And finally finally creates creates this composer log file This composer log file contain the exact version you download it or composer download it here, right? So what composers do in the process of going from here to here to the final step of creating the composer like Composer log file get the dependencies do his best for best for matching I mean the if there's any conflicts to fixing conflicts between them sometimes one library has conflicts with conflicts with other libraries So composing takes care of I mean fixing all that for you And if your package or if your dependency has all the dependencies Composer also takes care of that, you know Take care of getting your dependencies and the depends of your dependencies and you know like so on the dependencies or the dependencies of your And again in the end he creates this composer log file for you with the exact version that was downloaded in your in your application And good thing about this is next time someone in your team and it's to download the dependencies of your project it only to ring on he only he or she only to run composer install he will read this composer log file and avoid doing all the process of Resolving conflicts and trying to find out which if your dependencies are you know where all dependencies are, you know It will solve all that for you and just download exactly what was defined in this log file Which is really cool. It also I mean takes advantage of some of catching mechanism So you have you have all those dependencies catch in your local system So it won't be like going to you know again to somewhere else like gate I mean get GitHub or Drupal or because I mean it's already catch in your in your local system and Something you should need to remember is to always commit your composer log file Okay, because this one what it contains, you know an exact version that you you have Defining your project so it means any dependency that is required is here, but it's also selling you It's using this specific version It means the rest of your team can just get an exact copy of the site or the dependencies Just by running the comp a composer install command, right? And you should always run composer install You should never run basically composer update without passing a package You want to update because if you run composer out the update Without defining a package name Let's say what it will happen is composer will try to upload every single dependent I mean update every single dependency in your project and that could cause some problem because you might be get a latest version of Something that you haven't tested so ideally if you want to update a package You should run composer update and just provide the package name that you want to update Okay, in order to work with Drupal and composer. There's a really awesome project called Drupal composer I highly recommend you to start using this. This is a composer template. This template contains Drupal Drafts console and some all in all the packages for for you So you can get Drupal in yours in your local I mean local computer. It's I mean, it's great project I really like how this works. This project Could be used like this right composer provides several commands the same way he provides this composer install for getting dependencies or Composer update for updating them. It also provide this create project command this command While running composer create project command what it happens is it clones the project that you are required And it also run the compose composer install as well So it clones the project for you and it runs composer install It means it gets every single dependency in this project So by running this command you will have a full Drupal site. I mean download it in your system This is like drush DL that we used to do right or compose What was the Drupal console command for site new? I think so we just I mean for that in the road for the stable release I mean, we're getting rid of all those commands from Drupal console. There's no more site new There's no more module download or we are trying to people to keep using to using only a composer We're gonna try to push people to use the right tool for them for the work Well, as you can see when running create project You can pass some options like the module name where all your project will be downloaded in this case as Drupal that or And then I'm using some flags here like prefer this for instead of getting the cloning every single dependency Just getting the release from the seat from the tar fight, which is better And there's I mean there's because it's a little faster and also uses catch because doesn't have to go to Go to the the viewpoint get cloned it for you. So it's faster Because composers not the fastest tool in the world We all know that right there are there are some there are two I mean again as I really nice I mean tip about one running composer, please disable XT bug from the CLI I will make it a little more faster or less lower And it also there is a project call What's the name of this for running like parallel downloads? I'll get the link in a few but I don't remember what what the name of the party Yeah, that one press them up. Yeah, that's that's a really cool project I love you to look run like multiple downloads to make little faster minutes better experience. I Was reading some issues and on composer project They were trying to implement something like that like out of the box without this composer blogging We should look pretty pretty cool to have Again, so again in order to get a new Drupal site in your system You can run create project and this takes care of what get cloning and composer install at the same time So it means you get the project and all the dependencies. So you are great to work this Drupal Composer project it provides you a getting your file with the base some basic configuration So actually as you can see here is in there is ignoring the vendor director is ignoring webcore and all them all the country modules it means You we are ignoring every single package. That is dependency By ignoring vendor core and modules teams and profiles Contribute and it's also ignoring. I mean the old any files any files for I mean from the project So you don't I mean you are not committing all the files files on the on your reap What you will what you will find out why you seen by using Drupal Composer project It sells slightly modified version of the directories You will find out there is a web direct directory here and this directory contains all of the Drupal files, right? So any Drupal file is here and the rest of the files are here It means vendors as you can see vendor directory. It's out of the web public directory Which is great because that can save you a lot of headaches because any Dependency which is not Drupal dependency right any third-party dependency will be Download downloaded here within the vendor directory and this is outside of web. So you should point your Your I mean your this is your public web directory you should point your virtual host I mean, I mean to web instead of the root of your project, which is I mean again It's pretty cool because it means no vendor Downloaded I mean PSP file could be executed from from here. It's it's pretty cool Another another nice feature about this one is you can just get any of the your configurations files outside of the web public directory By default I mean Drupal creates this, you know the sites Default files config and provide this create this huge hatch So people cannot guess where your configuration files live at well by using a director structure like this having this web out I mean this extra level here You can what you can do something like this go your settings files Make these little change and just get any configuration that you export it outside of the web public directory Well, how do you commit your changes, right? Let's say we're using a repo. This is get you make changes again This is something we're all doing right get add get commit pooch. Let's say I just get my site and mean download anything. I mean just Run this one, you know create project And just add projects and then how the rest of them can obtain our copy just again just get cloning compulsive install Okay, they don't have the rest of the thing doesn't have to worry about creating the project again They just need to run Composer install and they will get every single dependency because because we committed the Composer log file Right again because the Composer file contain all the exact version of the dependencies. We download it. How do you download modules? Again, there's no more drush the L please. There's no more module download from Drupal console If you want to get a new module from Drupal, please use Composer require So Composer require and then the package name in this case the module we want to get When we are getting I mean Drupal modular modules themes or profiles you will find out that it's always called Drupal slash something Once you download the module did you mind you might need you mean you want to install in your system So you will be running something like Drupal module install and then give it the module name as you can see here We're only using the module name Composer is the one who uses Drupal as latch as part of the name, right? and then finally you can go Drupal config export to export the other module was install and The rest of the of your team can just go feed mean get get fetch merge changes or pool and then run Composer install again So what it happens when you run Composer require and give it a I mean a new package in this case a module It modifies your Composer lock file and your Composer JSON file, right? So it let's say you say it's Composer require changes both files change your manifest or telling you You know it now I'm using also this extra module, which is I mean toolbar, but it also changed the Composer lock file So then the rest of your team can just run Composer install and this will get this new module That was downloaded before so again We are only using Composer to managing all dependencies and finally again Just run come Drupal config import in order to get all of the configuration that was exported on the previous task And finally, you know clear cache reveal. This is a remember the cc all command now It's called CR or cache reveal. We need to in order to get your site I mean you will be a you will see in there will be running CR more often in Drupal 8 and 7 How to update the module if I and I know there's a new version of a security issue with a module I will be running Composer update and provide the module name, right? and Finally something sometimes when you update a module, there is a pending database update or hook update So you can run update execute command and just provide the module name in order to apply those changes in your in your database And finally again, you know get add commit pooch create a pull request someone else I mean do a code review and just merge that one And how the rest of thing get the get all those changes same thing they all need to run Composer install You know, this is getting more because it's easy, you know, someone else do this change for you How do you think use by Composer install and in this case? Since I mean you are maybe there are some like module updates you will end up running an update execute You can even you can pass their name here I mean the module name or you can just say all for I mean executing any hook I mean database hook updates and if you want to update core you can use just Composer as well, you know Drupal I mean Composer update Drupal core with dependencies and you're all set, right? And you you probably have to wait a few minutes probably grab a coffee or a beer or something But yeah, that will do the work for you You know the good thing about this is like there's less like human You know involve I mean work involved here. It's not humans tend to sometimes do mistakes you know, that's computer do the computer work and I mean it's a good practice to manage your Infrastructure as code as well the same way we manage or code using a repo It's a good practice to you manage the yard your infrastructure as a code So a good thing it's in the ideally we should have all of the configurations I mean and I mean on the reap as well And if you aren't using if you are not using doc something like Docker You can probably use like, you know BM or other tools to build your your come your infrastructure like, you know Like like an symbol or a puppet. I mean anything that you like to there is a Nice project called Drupal VM that you can take advantage of and ideally you should require Drupal VM as a dependency in your project Something like a composer require garling guy, you know, Drupal VM and that get that project in your system and your vendor directory And from there you can make some little changes on the on the config files You know which image you are requiring to and how much memory you want to assign and then doing something like this You can share the same environment with everyone in your team and everyone is running the project using the same thing You know, it's like there's no more it works on my machine And if you're just in Docker, then you might be handling all this configuration using Docker files and again What I was mentioning this is Drupal VM is a really nice project. The bad thing about this is like I mean Sometimes some people doesn't like a lot like being I mean because you mean using Drupal VM Well, I mean using Mac and Docker. You are also probably need to get, you know, virtual box and you know Baker and all that Fortunately, that's changing But yeah, you can use this one if you are using Docker, you can do something like this create use Docker and Docker compose And this is how a Configuration looks like in order to get like fully working environment using Docker We have a file here with you were telling, you know, which version we are using it and we're just defining some services Services is like, you know, you know, you were here about like micro services, you know We are basically creating like like little boxes here Think about like we're creating a Maria DB like little box from our installation and then another PHP box I mean containing only PHP. So we are doing something like this was in order to use I mean this Docker compose file It's only defining which image we want to use. It means which version we are trying to work with In this case, we're using Maria DB. You can use my SQL, Poster, anything you want to You need to find or create the right image that you want to use and change this line As you can see here, we're using an environment an environment file. We'll see how this looks like So we are if you're not telling Maria DB, you know read from this file Some specific values that you will see how it looks looks like then we have the same thing for PHP We have PHP here, but in this case, we're sharing a volume, you know, we're sharing to we want to when This is a directory within this box where where we can access or we can install or Drupal site Then again same thing. We're telling to this little box that we are using, you know, an environment file Next thing let's let's say I want to use and you next so I call this I Name it is in your next give it a name in this case. I'm using an image It's just same Drupal in your next image. I mean again, you can create your own images if you want to We are I mean we're taking advantage of those that works really well for us And from here you can I mean provide an extra configuration like restarting I mean, you know, la-la-la and it also tells you it depends on PHP. It means the PHP should be done first And from here, we just gave some like like like environment variables as well and sharing some volume So we can share with the other box with the PHP box, right? And as you can see it finally, we just give them a little like using this reverse proxy Configure any project called traffic. I don't know how to pronounce these things tri-effic It's hard It's okay. That's fine. Well, you just give it, you know, use create something like this I mean this will create automatically a host for you So you will once you run it you will able to type me know Something like, you know, like they have that my depth that Drupal that something or test that Drupal that something or pull request I mean you might be building an environment a full environment for a specific pull request I mean what we are doing in this process is we have an application in While the plot where I mean as part of or like see ICD process or workflow And we are like having it this we as a place when you have this file and we just create this file on the fly Well, take this as a template and just replace based on what we want to create here at the test There or something like in order to build it The machine right but again as you can see the whole infrastructure is committed on the repo Everyone within the team can go get on that one docker can post up and just again We'll grab a coffee or beer and the computer will be like done same thing. We're using Drupal VM You know bacon up Let's talk about configuration remember what I mentioned about this EMB file that we were sharing with the machine we have Okay, and first thing what what we call configuration just to do not get confused with configuration management Configuration is anything that changes between environments, right code is it's what is what is doesn't change right code is Every single environment again remember what I told you one code base and multiple deploy me deploys We have a staging like depth test proud I mean my view are used to seeing always depth test and proud right? I mean in going back and forward I mean this point. I mean that's a good thing to do But it doesn't matter anymore You can just create as many stages as you want to if you want you probably want to create one for Specific pull requests or a specific commit right? It's not like you need to have all those three stages in order to have a full like I mean process in place You might be have like local and test in QA Maybe you are in a new feature and then you create a new pull request someone and then you can automatically Deploy this you see something like this have I mean since remember what it's mentioned about this traffic thing You can make this available for your client. So you so your client can see you know that feature running and In order to to manage configuration We are not going to commit those values to the repo right? We don't want to put like or their own credentials there so what where it's highly recommended to always recommended to use the environment and using like non control non version control EMB files and It also is good practice to have different configurations files for environment. Let's say I want to have this Specific configuration for production and for testing Let's say I want to like enable tweak debug or disable tweak and disable to catch on my local environment So I will have one file calling something like services that local that YML and With different configuration than my file that we're running on production And this is good practice because you will you can load those files based on the environment you are working with In order to do this in Drupal There is a project called php.amb you only need to do composer require This this project name and you will get it in your system and I will show you how you use it How will you be using it? First you need to create this this file for you This file again remember never commit this file into your repo. It should be created on your server again You just could be this process It's it's done in our case, but we have all this automated through a Application so we create this we create basically what do we just do it? Just we just create a note on the origin or line out or AWS then we just generate this file based on the project and Has all these data so this file should contain can contain and many values as you want to we have this in Environment so in this file we define which environment is belong to in this case log could be like local test probe Anything you want to and from there you can add as many mean key values that you require like database name user password Like ha spore anything that it's changing per station or for a per environment again values here or be all this configuration is what it changes between different stages and Finally, sometimes you would require to have like Twitter API key or any other services in a key zone I mean API keys for those we define we also define it here using the settings underscore prefix and You will see how how we use it how we what the process what what we just do in order to load all those values and We make changes in our settings php file and this how or Settings file looks like it's it has a validation for you know is the if this file exists Then get an instance of this class. So this dot EMB mean class that you can see here It's part of the PHP dot in EMB project that we just require before and Just give it the directory where the project is at and just call the law admitted This one takes care of reading those values and make them available for use and how and how I'll use it So what we we also have in the settings file. We have this EMB equals to environment So EMB will contain which environment that I'm working where which environment is actually working in this case Could be like local again test production. We can give it a like PR idea or something, you know And then finally remember those those key values with the prefix of settings underscore so we have something like this we have this little iteration and we are just Find anyone containing this value and we just set on the settings array I mean if you set something here, then you can use it within Drupal So we are setting the key value, which is basically bar gas and Lauren Ibsen So we get rid of the settings part where we just manage like this in order to make this like easily to iterate and read and actually set before on this part of the process and Remember what I told you you can have is a good practice to maintain different configuration files based on the environment So what we have here we obtain the pad where the Drupal is running and then we create this services file and settings file Based on the current environment, let's say if we are in local This will take something like services that local that YML if we are on On an in a specific a station like testing or QA or whatever you want to call this We should be a file the name here with something like services that QA that YML and this is each one of those files Could contain different configurations based on the environment upper environment And as I mentioned before most most of the time on the law on your local environment You want to this you want to disable like like to a catch right or enable to a debug and Instead of running, I mean like what was the current Drupal console commands site mode EMB or side mode production that keeps changing the same file all over again And then it's kind of hard because you need to keep maintaining this file on your main committed in your repo So in this case we maintain different files per environment So we don't there's no risk for us to I mean make some change and forgot to doing something like that So I mean some I mean I remember running the site environment. I mean Side mode and then putting like a development and then pushing that code to production and my I mean in my JavaScript and CSS file were not minified So I was like loading a hundred of files and was like why my site is it's this kind of slow for loading because I don't have all those file like minify and just an Aggregated and finally we have a validation if the file exists then just load it and then Drupal will get All those values and and use those per environment, right? And then finally or settings PHP file mean for the database collection looks like this And it's as you can see we are reading the same values that we just set on the EMB file right and this EMB file is shared between my My containers which is the one on the database and the one that is running the site So everything is pretty straightforward I don't have to manage those on the configuration and we don't even have to go to the server and and create those because we Have a process that copy this go create this EMB file on the project prior to running In the orchestration. Well, finally the last piece of the workflow is you know building the artifact You're not building the process and pushing to a specific server What do you have here build let's say build release and run we can define bill as as the Process or the stage that converts your code repo into an executable bundle It means the one who go and get the dependencies by using, you know Composer in this case and also like by running Jarn or you know NPM or anything else Then release is that is this is a stage that takes this Configuration and and you make and mix it and mix it with the code Well, I mean sorry with that with a configuration per a specific environment And finally run is the process to having your your site like running right or I mean I'm an application executable, and I mean It's a good practice to run bills. I mean or any in I mean execute a bill I mean whenever new code is poached. I mean any pull requests should do something. Let me start the bill for you and ideally Ideally right. I mean, it's not like you are going to do that But the benefit of doing this like this implementing this continues like their delivery method or workflow is like you are used Like reviewing minimum changes of your project or per feature projects instead of like, you know Let's wait until Friday 5 p.m. For do the deployment, right? so this is better and In order to create a release every issue have use his I mean a unique ID this should be like it could be like a timestamp or incremental ID and Something I mean something that you need to remember is really once you do a tag or do I release in this This I mean this should not be changed or mutated So it means once it's created you cannot change the configuration or something So if you want to make changes you send all the pull requests and then a new instance of your server I mean of your server art is created and okay. How you run the build? It's again since we are using Composer. You'll be running Composer in I mean Composer install Just make sure you run with that using this flag like no depth to avoid getting like the development dependencies I remember I recall a few months ago. There was an issue with with coder with Coder is a tool we use for like like reviewing. I mean or coding like the code is needed for Drupal with the Drupal rules I mean you should never have those development tools on your production server, right? So ideally you should run this with using no depth Then in order to like we have this kind of scripts for for building like like our sites So this is how your or build local command looks like this is a something with Drupal code So we have something called chain commands those commands read a jamal file and can execute different commands I mean like in a queue So we have this new command called build local if you add something like this so your chain definition It automatically register as a command. So it means this is a new command that appear on my listing So I can run Drupal build local and We use queue I mean several commands here like Installing inside install for installing Drupal from a scratch, right? Remember where I told you it's a good practice to rebuild your site every single time and then use much I mean if I want to install something like features Like this module that I will be only using in in my local environment we kind of lose things like this and We just I mean in this case we're managing let's say we're managing configurations using like features So we have features import commands to import any feature We have the mean override any features and finally you can also create like notes Let's populate your side with dummy data calling this create terms and create notes commands And at the very end just click catch make sure everything was working But as you can see here, I'm just running composer install and passing the flag force So it means I am not telling to the command where I mean where those settings are because it means reading the settings file Which is reading the EMB variable So I mean I don't have to worry about giving credentials or nothing like that. You just run one command Everything is there for you. How about our station server? It's a little different So instead we give it a name again, but instead of running You know site install every single time in a station what we just do is run the database restore command We also have another like environment variable We tell where the where the backup is so in this case run this one reads one file and just import that database So or station server it has It's reading and importing previously database dump that we have Again, we compose it then in this case we run update execute run any pending You know maybe what what us what this full request is containing is a module update So we want to run make sure we run any pending hook database update, right? update execute all and Finally, we also run, you know features import again to override features and at the very very end We run config export ideally when using features You use features for development But once you all get to the point that you are in a station server ready to push all that code to your production server On your production server, you are supposedly not to use the features Ideally you should manage features on till the stage server point and then from here run configuration export any in your server While building your production server you should run compose I mean config import instead of features import That's like daddy and that's something that the feature maintainers is now managing You know just features for development, but at the very end prior to the deploying Just make sure you export the whole thing and then instead of running, you know features command on production server rules just run config import to import the whole configuration that was exported on the build process and Finally for the build we have something like this and you know in the case of build. We are not going to I mean Restore from any specific I mean database. We are doing the inverse thing We're doing database dump to create a database dump if something goes wrong We can just really easily roll back just by restoring that database. Okay, so we Exploit database we give it again. We give it we take the database name again I've been executed for any pending hook updates Config import remember what I told you about features features when while building the artifact Explore that configuration it means your production server instead of running features Just run configuration import to read all files and just getting in your in your active configuration and cash reveal at the very end Okay, just the final final is like while you are One way to avoid like like downtime of your server while deploying. Let's say again Let's go back here. Remember this one builds your artifacts this build your site then between this one in the in this build process While deploying to your server in this case, we are seeing the case like deploying to To a VPS server. Let's say while deploying is a good practice to have all those releases in a different directory As you remember what I told you those should have like unique ID in this case We're using timestamp. So we're creating any specific directory for every single release here Then it also good practice to have this share directory this chair contains files in any in any Any file that should be chair across I mean across different like deployment. So we end we also have this current Directory so this is a sim link to the very last release It means when you are building when you are doing your deployment Let's say you use this to this specific directory you create this directory. Just start running the build here your final build here and Once the whole process gets completed and there's no errors Then just you change the sim link to current to the better that release and then it means you don't have any downtime I mean while you are deploying. So, I mean in this case, we are deploying Right on the on this directory every process run here, you know every Part of this build escape run in that in that directory once it's done and it's completed There's no errors then this This I mean this sim link change it just it just happens and then your web server points to here And then there is no there's no downtime for your project in order to take it to do something like this You can use any of those tools like, you know, there's plenty of tools Those are the tools we've been playing and more happy with like Capistrano. It's a Ruby is a Ruby project That allows you to do something like this like automatically So you don't have to worry about creating the sim link and you're making sure if something fails You have to roll back those tools also provide you with a rollback command It means you can easily roll back just by typing, you know rollback and then everything goes back Actually, I mean you have to do little things, you know, like adding your scripts for for like this one for Restoring your database but other than that those projects takes care of managing this current releases and chair directory structure for you There's again, it's Capistrano, which is Ruby from PHP. You can find the employer and rocket here And there's another project called Ansysrano, which is a set of and I mean Ansible playbook recipes following the the same idea of Capistrano It's pretty cool project. Those are pretty cool I mean it works pretty fine and allow you to you know have this this Director structure in your production server in you save you a lot of headaches and a lot of times I mean, you don't want to write all this yourself Some people have already done that for you and works fine. I think that's all that I have so I want to say thank you again You can find me JMLABS You can find me in JMLABS We know a triple console and if you have any questions, just feel free to ask or just get to the front