 Good afternoon. I hope you had a nice lunch and while you are happily digesting, let me tell you a few tips and tricks for working with Capsimus SAS. My name is Margie. I'm the co-founder and DevOps engineer at Morpd and we have been working on quite a few Capsimus SAS sites. That's why I thought I would put the talk together, share a few tips and tricks. I could see as I said. It's a quick little basics. Capsimus is a website management system built on Drupal hosted by on AWS. With Lagoon, it's built by government for government and they offer two different versions. One is PAS, platform as a service, when you can do whatever you like with your website or SAS. Software as a service. This is the version I'm talking about. That's its limitations. For example, you have only defined set of available modules you can use. You cannot add any modules. You can add and edit your theme and you can change configuration, but that's about it. But the big advantage is that the Capsimus support keeps taking care of patching the site for your core modules for you. Quickly, the technology stack. Docker, of course, Kubernetes in the background. Pygmy, it's a local development tool. You can think of it a little bit of a Lando. It takes the care of the reverse proxy and other stuff you need for local development and Ahoy. We know Ahoy command. If we work with Capsimus, I just want to stress out here, it's a generic tool to organize your workflows. It has nothing to do with Capsimus or Lagoon. It just happened that Capsimus and Lagoon, I think, use it, but it doesn't mean that Ahoy is Capsimus. And there is GitLab. It's CI pipelines. Then you have Dashboard. When you can see in Lagoon what environments you have and what deployments are running and how there is a log facilities, open search, you can go and search, and there is the kidding system. But I just wanted to do this as a, let's get my hand dirty presentation. So let's do that. So I just want to thank you to Alistair from Capsimus. I reached out last week asking for a test environment in Capsimus, and he was very helpful and gave me access to one of them. So this is my test environment. So let's have a look at what I got. So I can see this is the dashboard I was talking about. I can see I have one environment master Let's see what the site looks like. So here under roots, you can see the URLs and oh my dear. Okay, so there is a basic authentication and we don't have the credentials. So let's get them. KidoKey. So I will need the database of course. So let's just create a task, database. This will run and in the meantime, I will get the code. So you see now I'm in the GitLab. So let me clone the repository. KidoKey. Jump into it and build it. And now I can see I'm running an Ahoy command. Before I talk about a little bit more, I actually get the database. It should be already here because I kicked off the task a minute ago. You see it's complete. So I can download the database from here. Okay, so I have a site built and now I need database. So for that, I will use the MySQL import command. I need to unzip it, of course. Download it here. Call it. Call it dump. And I can do Ahoy. MySQL import. The dump import. Qo. Now I'm loading the database. Importing the database. You can see it's taking a little bit of time. Now let me move in my slides. Okay, and I can do Ahoy, crush, export config. Why am I doing this? Because I want to find the shields for the production. So let's see when I have the Crapid4C, because I'm a sysadmin. Probably could do it much. Approaching. Here we go. Thank you Alistair. So let's see where... Okay, so we are on, you know, GavCMS Cafe URL. You can see I just basically got the basic off credentials by running a local version of the site and exporting configs. So that's one little trick I want to quickly show you. I'm sure this is not surprising for you. Okay, let me clean up. Holy... Get clean. That's the config I don't care about at the moment. Okay. Now, you could see that the import of the database took some time. You know, like if you have a big website, government website, it can take 20 minutes to import. There is a beautiful facility and you can enable it here in the .env file, which by uncommenting the MariaDB variable and running, you can see that the Ahoy command has a nice documentation here. I can do RefreshDB, which actually GavCMS platform builds for you every night a container, like image Docker image, which the database built in its sanitized production database. So instead of you importing it, you just basically get the image and instantiate it. So let's do it. Let's see how quickly it takes if I do Ahoy RefreshDBing. And you can see here that it's trying to get the latest MariaDB data here. That's the nightly backup or nightly sanitization and starting the database. Okay, that took much, you know, before it was maybe a minute. Now it took like three seconds for, okay, let's open the local. Now I'm opening the local environment. Basic authentication we have sorted, but I can just uninstall the shield because now I can do whatever I want with the site. It's running on my local, so I should be able to see it. Here we are. Next little thing I want to show you, I want to log in to the site. There is Drashu live for that. I know that Ahoy has support for you once again. It's, you know, Ahoy login. Let's use it. Ahoy login. And let's see what the other site looks like. Oh dear. XSD9. That's probably because the user one is locked. And I happen to know that the new version of SkaFold directory, that's a directory which, sorry, codebase, which we can use to generate a new Kafka CMS website, has a new definition of the Ahoy login command. It's just a little bit more sophisticated. So I will find it here. And I also know that you can, if you can see here from the documentation, you can have custom command for yourself to add. So let me just add that one into custom Ahoy. So this is a file for you to create your own commands. And steal the new definition of the login command from the current SkaFold here. And you can see that here they are finding what the user ID on is first. And then they are unblocking it and only then running Drashu live, right? So I will take this. Here is another command. What's the echo here? I don't like it. Let me see. Okay. I will call it ULI. Apologies. I will stop rushing and do it again. Call it ULI. And now when I look, do Ahoy My, you can see my new command. I just defined is available. I can comment it and I can use it from now. So I can go Ahoy My ULI and see, I'm blocking the user and now I should be able to open this. It's my local site. I should be able to log in at zero one. So this custom Ahoy, it's a perfect file for you to use as a team. If you want an extra command you need for development of your project, you can define them, you can commit them, you can share them within the team. Perfect. And now the little trick I was going to show you. Perfect. Let me nine minutes so far. So good. Now I want to show you how to set up XDPa quickly. Once again, sometimes I saw people, every Drupal developer in my opinion, uses XDPa now and then, but sometimes with GavCMS you don't know how to start. You know how to use it, but you might get stuck a little bit setting it up. So let's just close a few windows here so you don't get lost. And there is this GavCMS repository, which has a nice wiki. I do recommend looking there and you will find that there is actually a debugging section. And it tells you exactly how to set up an XDPa with GavCMS, so let's try that. So you need the XDPa plugin for your browser. That one I already installed, I'm running Firefox, not Chrome, but I have it here. So you see here, I can see that I do want a XDPa to kick in, so I have done that. Then you need to define Docker host. So let's have a look at that. Me being a sysadmin, I know that the Docker host is actually used here in the Composer, and I can also see that there is a default value. So if the Docker host is not defined otherwise, this host Docker internal will be used. I can verify it by jumping inside the CLI container, ahoy CLI. Look what environment variables are here and grab for the host one. As you can see, it's set up. So if I'm running on Mac, I believe even on the Windows WSL2, this is ready for you, but on Linux, we will see that this doesn't exist. Sorry, internal. This doesn't exist because the networking is slightly different in Linux. Linux and Docker, there is a native support for Docker in Linux, while on Mac it's emulated. So I need to actually define the variable as the IP address of the Docker zero interface. So this is the IP address when my Docker is running. You can do following the appendage to the end file following the documentation here. So I'm defining Docker host equal my IP. So now it's here at the end. That's what I just did. The end of the end file. You can see it's a typo. Let me edit it. Perfect. And I need to rebuild the CLI container. And the next step will be run ahoy debug. And quickly, while this is rebuilding, let me one, two, three, four have a look what the command does. So I'm debug, we'll do this inside a container. And it's basically setting up the X. You don't have to know that I'm just trying to decipher what's happening inside when you run a command. I always look inside the ahoy definition file. So it's actually PHP being told to run in X debug mode. So let's do it. Ahoy debug. Perfect. And now we said that GavcMessage has this limitation that you basically can just work with theme and config, but not modules, right? So let's just test the X debug, apologies, X debug first on a theme. So let me get out. I just want to get this to a dev branch. Let me get the theme. Theme belongs to the theme directory. I downloaded a theme called DX. I don't know anything about DX. Just, I read about it. That's very simple. And I know, as a sysadmin, it doesn't need any dependencies. So I drop it in here. It will work for me. That's why I'm using it. I'm not saying I don't know anything about it. I'm just using it. Let's get it here. So now we have theme. And the last thing we need to tell, and I say, this is support for visual studio code, you need to create a launch JSON to define, to tell the ID how to talk to X debug. I happen to know that this need to go to this directory and copy this. And X debug three use this port 9003. I don't listen to local hosts, but all interfaces and I need to take care of the paths. I'll show you what I'm doing here, but I'm just saying that inside the container, I want to map it to the, like, for this to make sense. So this path workspace folder theme. So it's here in theme. I have my theme folder. And if I go inside a container and list the content of this directory, see, so it's one to one mapping perfectly. That's exactly what I need. So, and now I need to open the code. And because we installed the theme, I just put a breakpoint on that theme and start debugging. Let's see. Now I can do enable the theme, make a default. And I remember I have the breakpoint there. Okay. And I'm suddenly in my editor and I'm on the breakpoint set up. So this, this all it took me to be able to debug my theme. I can, you know, like step over step into. We all know that from debugging. But this is how you do it. Perfect. Now, so this is, this is nice. This works. But sometimes it happens that as a developer, you need to debug the core or you need to debug the modules. As I said, Gaussian analysis is this limitation, the core and the code is built inside the Docker container, right? I don't have it on my local. How do I debug it? Well, there is a trick. You can actually copy it out, right? So if I'm here, I know that the code is here in, if I go ahoy, cli, I know that the code is inside here. And this is Korea here under web. So I want the app folder to have locally. So the, my editor can see it. Let me see what containers are running. And Docker. Yes. So this is the name of the PHP container. And I can go Docker copy from there slash app to here. And now you can see I get about 250 megabytes copied. That's all the core modules, everything I need. I have it locally now. Not, I made a copy and exact copy of what is inside the container. And the last thing I need to tell the XD back to actually look at the directory. So I just add another mapping. Now it's easy from app to app because I did an exact copy. And now we can go here. And we have the app now. This is a copy of what we have inside the container. I can go and open index PHP. This is Drupal core PHP and put a break point here and start debugging. Okay. Stop first. Start. And let's see if we go to the side. Launch file, refresh. And I see pink. I'm in index PHP of core and I can debug. I can see what variables I have here. This is very helpful when you are debugging your app. So this is how you can run XD back on a SAS project when you need to. It doesn't take that much time. Check 18 minutes. So that's good. So that was it. What I was going to show you. Stop it. Perfect. Let me see what other tricks I want to tell you about. So there is this stage file proxy support. Once again, we all know what stage file proxy is. It's just that when you make a copy of site to your local, you don't need to bring down all the assets. You don't need the pictures. You can use the stage file proxy module to download it on demand. So if I need the logo, it takes the logo from the address I configure stage file proxy to use. I have seen developers who do not bother to define it here even though it's like one liner here. So just here is where you can say where to download the assets from. So if your site is already in production, this environment is probably the default environment doesn't exist anymore. Just make it use the production URL here and your local site will be running all images. So to know that it's here in the end file. And if you remember did I actually push my code or have I forgot? Ahoy. Let me see. Actually forgot to push it. So it doesn't matter. Ahoy. Sorry. Get status. I wanted to add all of this. No, not that. Push that. The dev branch. Get push origin dev. And what I was going to show you that the CI is actually running on each commit some pipelines. And because I forgot to push it, I don't have the current one here, but I have the previous one when I was preparing for my presentation. So let's see what the pipeline does. So that one I just pushed will take a few minutes and then we'll have similar output. So there is a built and deployed pipeline which got kicked on when I commit it to GitLab. And you can look at it and you go, go, go, go, go. And you see job succeeded. That looks good. But before we go there, let's scroll and see what happened here. I can see some error here. So what is it? How come I have errors here? And there's the theme I just committed. And I can see that there are like 29 problems from PHP, CBF. It can be fixed by it. And there are basically code standards. All I want to tell you is that it's good to know that it's actually Ahoy Lint, which is being executed on the pipeline. And you can do the same here as well. If you look at your Ahoy commands, of course, you have Ahoy Lint here. Ahoy Lint. So this is really good to know about that it's here. And basically when you are working on theme, you don't want this number to go up. If you are making any changes, you want it to go down ideally to zero. But you should not introduce more errors by your chance. That's what I'm saying. So please, please know there is Lint. And then now my pipeline should be now running. I push the def. So you see like I push def. And it will start a pipeline. It's my commit. Yeah, it's running. I'm running. Okay, so let's just wait for it. Recap what we have done so far. So we started site locally. We used it to get the production basic authentication via exporting config. We loaded database using two approaches. One was downloading the creating and downloading MySQL dump and importing it. And there is this RefreshDB command you can use, which I recommend using. We defined a custom command in Ahoy for ULI. You can use it to define our commands. And we also successfully managed to xd back trace the theme and also call even though we are on SAS. So far so good. And now I'm just showing you a little bit the deployment workflow. We could see the pipeline kicking on and see where we are. It's still running unfortunately. Okay, I will not be waiting for that one. So it will start with the stop with the message we showed before which says job finish. And it's a little bit misleading. So when you see this job finish, do you think that you deployed? You haven't. I've seen people I've got. I could see people looking at built and deployed tasks in pipeline. The pipeline successfully finishes. It tells you job finished. So you go to the production side. You test, you do sanity checking. It looks perfectly fine. So you go home. And 30 minutes later, the deployment triggers because this is just the CI pipeline and it just runs its own test and triggers deployment. And then you need to go here in your dashboard and look at the pipeline here. The deployment will pop up here in a minute. Even though the pipeline already tells me it's finished. So this is my pipeline hasn't finished it. So I can see it. So this is something to be aware of just because your pipeline finished successfully. It doesn't mean the deployment even started. You don't know you need to come here and have a look. And this deployment button is a new thing. It doesn't be in here in right top corner. Now we can see all the deployments to projects you have access to, which is very, very nice feature. So that was just a quickly show you how deployment works. I think when I'm finishing my talk in three minutes, I will have the depth environment will get provision here because I pushed into the depth branch. And I hopefully I can still have a few minutes to show you. I was going to talk about config management, but I just want to see and tell that it's disabled by default. That's because 4GavCM is much easier to keep updating your sites and modules without touching config. Because when you have new version of module, you might need to reexport config. So if config management is disabled, it's easy. But if you do need it, for example, to deploy a advanced feature, you need to talk to government support to open to enable it for you. So let's skip that. Common problems. People don't use refresh DB and take a lot of time importing database. Sometimes you when you set up project like I create quick copy, the files, private files, private TMP might not exist, but you will see it on the status page. Just create it. And the last thing I want to cover quickly is logs. So, of course, I have the site now running here locally. So I just enable DB log and I can see my logs there, right? Even from command line on inside the GUI. But if I want to see that, if I want to see logs on sites hosted by GavCMs, I go to logs, GavCMsAU. And I recommend starting with the discover feature. You want to discover your logs. We lock it for the project we are working on and start here with the application logs. I'm sure here I have to do it twice for it's not related to this. Should have something here potentially. Okay, here are some logs. And you can basically go and look at the details. I just want to lock it. I'm sure I'm not looking at any other project. And now, so what is it here? I'm looking at last, let's do last 15 days refresh. And here you have facets. So you can quickly look at Cron, okay. Lock level info. I think it didn't kick in that the refresh for 15 days didn't work. You can kind of say, I want to see early messages. You see some data messages. I can also, I also want to see what channel it belongs to. You know, so it's here like I'm looking at Cron. And now it's loaded all the 15 days. So like I have done. So what other channels are here? Cron and PHP. Maybe I don't care about the Cron. So I click here on minus. And now it will filter out the Cron events, which were the most frequently there. So now I can see others as well. And I can keep narrowing down like this. This is very handy. So I think I used all my time. So I won't go anywhere. Just like to conclude here. Personal wishlist. Just working on this as a DevOps engineer. It would be really nice to have Lando support in GavCMS because I think it's available. Lagoon now has Lando and supports Lando. So it should be doable for GavCMS to also use Lando. That's to replace Pygmy and Ahoy commands potentially. Be able to, as I said, I would love to run my own tests inside Gitlop. That's something I cannot do on SAS as it. I'm thinking something is cooking there. And it would be beautiful if once again, as I said, I could trigger a webhook from a deployment pipeline which hits my Slack or my other CI. I can do other things like notify people or run remote tests. It would be beautiful. Thank you very much.