Covery Monday, we haven't done one of these in a long time. It's been a month, probably a month, because we just got done with the holiday break, so we had to skip one or two of them. Anyway, welcome back. Today we're gonna talk about journaling, and we're gonna answer the question, is journaling air quotes good for anxiety? So as usual, this is your first time to a Monday afternoon live stream. Welcome, let's put the chat overlay up so that you guys can talk to each other and I can see what's going on. Generally the way these go, and if you're watching on the replay, by the way, feel free to comment. You won't see the live chat comments, but feel free to comment on the replay if you're watching and I pop in once or twice a week to YouTube and check out all the comments and I try to answer as many as I can. So whether you're live in the chat today or you are watching on a replay, welcome. Feel free to comment, ask your questions. If you're happy to be watching on the live stream right now, new to chat, welcome Ian, good to see you. I'm just seeing the comments as they come in right now. Welcome everybody, Jade made a live. Welcome, I'm glad that you did. If you're here and you're digging it, maybe just hit like the thumbs up button. I'm trying to experiment here evidently. If you like the live stream while it's happening, it's good, I guess. Yes, and we're back. By the way, I watched the movie B and I figured it out. All the other characters are himself. He learns to love himself.  Anyway, none of you get that except for one person in the room. So anyway, first time getting into a live, welcome guys and glad that you're here. We're gonna talk about journaling today. Who wants to talk about journaling? Who likes to journal? Pop it in the comments and we're gonna talk about it. Having joined one of these in a while. Welcome, Beth, hello, Samantha, how are you? GBG, what's up? Hello, Carol, happy new year to you too. Carol's in the UK. I recognize some names. This is good. Anyway, I'm glad you guys are back and I'm glad we get to hang out for a little while. We're gonna do about 40, 45 minutes. Generally the way these work is... Oh, the beloved coffee bean background. You're right, it's gone. Hey, let me see if I can get it back. What do I do here? I go here and oh, the coffee bean background is gone. Oh, well, what can I do? Anyway, let me go back to the chat. So we'll see what we got going on here. Let's see here, air hunger symptoms. Love to journal. Okay, fair enough. I love journaling, I love day planners. Oh, you know what? You guys that do like the day planning thing, who's a bullet journaler? Like you guys are way at another level here. Every once in a while I see what people do with their journals and bullet journals and bullet journals are pretty much like works of art. Are they journals or are they art? I don't get it. Anyway, some folks love to journal. That's totally fine. I'm not here to tell you that journaling is not good for anxiety, but we're gonna try to start to clarify things and see what it means to be good for anxiety. And in my opinion and my approach to anxiety and anxiety disorders, what some of the more helpful ways are to use the journaling activity as part of your recovery. And also we're gonna talk about some of the traps that people fall into in terms of journaling because some of the sort of the conventional wisdom or the common sense approach to journaling as a way to put down your feelings sometimes backfires in our community. So we're gonna talk about all that stuff. Let's see, huge fan of day planning and documenting each day, love lists and planners, but I don't journal. Journaling feels like too much work. Terry, I feel you on that, I get that. I'll tell you that I myself have never been a journaler for the past year and a half or so though I have been pretty regularly journaling and it has been really great. Part of my issue is I finally wound up agreeing to just use the day one app because it's on all of my devices. And if I try to journal by hand which seems super romantic and like that seems like the right way to journal. My brain is much faster than my hands. My handwriting is absolutely unintelligible even to me sometimes. I just get frustrated. So I journal in the day one app now. So yes, I am now a journaler. Not every day, but most every day I like it. Sometimes I feel for me that I have to take a break from journaling because it becomes almost a chore, something that I have to do or I'm supposed to do. So I take a little break. Anyway, let's see here. What else, what does everybody have to say? Handwritten journal is a time burner too. Yes, Tats and Cats, I love the name by the way. It is.   So sometimes I use it as a mindfulness tool a little bit here and there. Journaling hasn't helped me unfortunately. We're gonna talk a little bit about that. I keep a diary every night, not much used to me because I can't understand my writing Carol. I get that you and me are in the same boat for sure. Sorry I'm being rude and looking over here but I'm looking at the comments. Journaling causes me anxiety. Okay, Melissa this, let's put this up real quick. Usually we don't put comments up on the screen until the end when we do questions, Q and A and stuff. But so this is actually pretty common. Journaling causes me anxiety. Let's get into that, right? So let's talk about that. Let's hide, where is that? Now I have to hide it. Here it is. I love journaling but in the end I think it's avoidance. I have a small whiteboard on my work bench where I list my goals for the day. That's cool. I tried but I'm even critical of my own writing. Some people get trapped and like a journal is supposed to look a certain way. We're gonna talk about all of those things. So let's get into it. Journaling is one of those things that I think is almost universally held up as this is a good idea like for mental health and wellness and emotional development and personal growth and all of those things, healing. Use whatever words you want. That's totally fine. Like there's nothing wrong with that advice. There's a reason why so many people default to telling you that you should be journaling because it is not a bad exercise. It's a decent exercise for wellness and growth and organization and dealing with your emotions and getting stuff out there instead of keeping it followed up. There's a lot of great reasons to journal but some of the more common advice that revolves around the use of journaling as a wellness activity or healing activity or growth activity isn't necessarily anxiety disorder informed which is a thing that phrase that we like to use a little bit more often in the last year or so because and the people giving you that advice aren't necessarily giving you bad advice. They don't know they maybe are giving you bad advice and maybe it's not even bad advice for you but if you are listening to people who try to teach you how to journal, especially when they are very prescriptive in the way you're supposed to journal for your mental health or for your anxiety and you find that it's not helping you or it's making it worse for you. It's backfiring a little bit. It could just be that they're not necessarily aware of the specific challenges that you are facing if you're dealing with things like GAD or OCD or Gorephobia or Panic Disorder or the things that we talk about here. So they probably don't mean to give you bad advice, you just might necessarily be specifically aware of your specific context that we're dealing with here. So sometimes the traps of journaling and I see some of them in the comments, I kind of dig it here because you guys are sort of saying things before I even have to today. And I think I'm supposed to put the cap. Am I supposed to caption up? Yeah, I'm gonna put the caption back up so that people know what they're looking at. Oh, by the way, before I keep going I'm gonna put this one up. On February 7th, I can't remember when it is. For those of you, and this kind of plays into the journaling and getting stuck on your thoughts and writing your thoughts down, Josh and I, Josh Fletcher and I are doing a workshop called Worry and Rumination Explained. It's a two hour thing. Any of you have been in any of my workshops before you get an idea of what it is. It's based on Zoom, it's done over Zoom and we're gonna talk for about two hours on the mechanics and worry and rumination, some of the theories behind it and how if you feel like you cannot escape your thoughts and escape worry and rumination, some ways that you could start to change that and back away from those habits. So if you are interested in that, you can go to the URL that's up on your screen right now. Of course, if you're watching after February 7th, I believe it is, it's available on a replay as well. So there's my plug for the day.  Seriously though, it does help done right. Just don't take it so seriously. So some of the prescriptive advice that you find about journaling is keep a gratitude journal. There's nothing wrong with gratitude. It's fine, gratitude is okay, gratitude is not wrong, but some people immediately go to gratitude journaling, which is fine, but sometimes it's very, very difficult for somebody in the grips of an anxiety disorder who is trying desperately to find ways to create a specific way of feeling because that's sort of part of the gig for people in our community. I'm either anxious, I'm afraid, I'm uncertain, I feel vulnerable, I'm terrified, I'm shaking, I'm having physical sensations, I'm having thoughts on rapid fire. I repeat here that I don't like the very disturbing to me. And all I wanna do is find a magic way to create a specific state of feeling, knock this down and create happiness or peace or calmness. And often gratitude journaling is held up as a way to access that. So sometimes for folks in our community, there's nothing wrong with the suggestion for gratitude journaling. Sometimes it's really hard to access gratitude and then people in our community, especially if you're dealing with perfectionistic tendencies, if Gadd is your bag, you find that I can't gratitude journal correctly because I can't seem to find any gratitude right now, it's not working or I'm doing this and it's like bullets off a Superman, I'm still anxious, I'm still afraid, I'm still as uncomfortable I always have been, it's not working, it's not working. This is a thing that I hear a lot about suggestions like gratitude journaling or even journaling prompts that you're fed every day, which in the general public might make sense because they're designed to maybe connect you to what you're thinking and you're feeling, right? So in a lot of instances, people will hold up journaling as a way for people to get in touch with their thoughts or their emotions because especially in the West, we're pretty well known for like trying to blur those things out and blunt them and get numb to them by scrolling on our phones or eating or drinking or watching YouTube or like engaging in compulsive habitual type behaviors. And we try and drown out our thoughts and our emotions. That's true. So a lot of like generic journaling prompts generic journaling apps or workshops are meant to help you get in touch with what you're thinking and feeling. See where the problem can start to be though because for people in our community, all you care about is what you're thinking and feeling. You put a huge amount of importance on what you're thinking and feeling already. So people who are trying to give you good advice, who say, well, what are you thinking and feeling who tell you to write down your thoughts and everything you're experiencing in your journal could really be giving you accidentally bad advice because you are already so overly focused internally on your own internal experiences. You're judging them, you're evaluating them, you're afraid of them, you're trying to get away from them that you already know what you're thinking and feeling. You really do. I'm terrified. I'm having these symptoms. I'm having these thoughts. I keep having repetitive thoughts that I can't stop. Getting in touch with what you're thinking and feeling is not a problem for people in our community. It actually is the problem if you know what I mean. So be careful of journaling prompts. And again, this is not cut and dry, black and white, absolute advice. But keep in mind that if you are being told to journal as a feelings dump or an emotions dump, some people will say, well, that's because you have to get underneath the anxiety to find the emotions that are driving it. That's a different approach to anxiety disorders. You know that I'm not that guy necessarily. But if you find that journaling has become nothing but a habit that you do anyway, you force yourself to do because you're told that it's supposed to be good for you. And all it is, is you repeating to yourself, writing or typing or speaking how you feel, how I feel, how I feel, how I feel, then it starts to become like a merry-go-round of torture for some people. So I know that there have even been instances where people in our community, our friends have been told by therapists and counselors that they should make time every night to talk about in their journal, private journal, how they felt that day. What did you feel today? What did you experience that day? And they wind up a week and a half into it, recognizing that what they're doing is every night they sit down and pretty much make their anxious feelings and thoughts the most important thing in their life, which is the problem. That's why they went to the therapist or counselor to begin with. So we have to be mindful of those sort of things. Some people in our community can benefit from that kind of work. So only you know what's right for you or not, but if you're trying that type of journaling where you sit down and you just try to connect to every thought and feeling and sensation you have and I got to get it out on the page. For some people, they find that cathartic, it puts it on the page and they can walk away from it. Cool, but if you feel that it puts you on a treadmill of anxiety because all you do is just focus again and again on how it felt. And then you look back at your journal entries and they're the same, you know, virtually the same for weeks and weeks on end, that could certainly be problematic. Another issue sometimes with journaling, and again, I'm not picking on journaling on an absolute sense. I journal myself, as I said at the beginning of the thing, I'm just talking about within the context of our problem that we're dealing with here together in this community, these are the red flags that you really probably have to look for. Another issue that sometimes with journaling is, it's sometimes journaling apps or journaling experts or journaling advice that you see or journaling tips that you find online will be very prescriptive in not just what you're supposed to put in your journal, but how you're supposed to journal. So by sort of show of hands in the room, how many people get sucked into journaling imagery, right? So journaling seems like a thing that you would like to do or maybe you used to journal a lot and you used to love it but now you're having a hard time and it's a struggle for you and you can't and you get really enticed by the romantic imagery of journaling. The thumbnail on YouTube for today's live stream has a cup of coffee or a latte, you know, in a very well lit on the white, you know, the white cup on the white desk with a notebook and a pen and it's carefully posed. We see that journaling imagery all the time. The pensive woman posing by her window with her cup in her hand and she's writing in a beautiful like leather bound journal or some sort of impressive, very, you know, a book or journal or notebook and it's very romantic looking, right? So sometimes or it's bullet journaling and the bullet journal has to look a certain way and you wind up spending so much time trying to journal correctly that you forget the reason why you're journaling to begin with. So this is a thing that I have heard people say over and over and over. I spend so much time trying to set up my journaling experience where I make sure I have my coffee and the right cup and like it's almost being, it's almost performative in a way that could be problematic too. Again, especially if you are a little bit compulsive about it and if you are a perfectionist and you're struggling with those kinds of things or trying to get things just right or this isn't going to be good for my recovery unless I do it right and it looks like an Instagram photo that becomes problematic with journaling. Frankly, from where I sit, if you like literally grabbed a crayon held it in the wrong hand like an ape and scrolled on a paper bag, that's a journal but you would never see people say that, right? Some people might say it's fine to do it that way but generally speaking, social media really romanticizes sort of the aesthetic of journaling and that can start to become problematic for people in our community. So those are some of the kind of common red flags or pitfalls or traps that you might find around journaling. Another sort of trap around journaling would be the idea that if you journal, it makes your anxiety go away. Like so, in the title of this live stream is journaling good for anxiety which is a little bit tongue in cheek. Those of you who have been following along with my content or reading my books, listening to the podcast know that generally speaking, the phrase good for anxiety is a thing that I tend to use in a tongue in cheek kind of way, almost a condescending kind of way. Or we look, what does even good for anxiety mean? Sometimes you get trapped into like, oh journaling will calm me down or journaling will make my anxiety go away or if I could journal about my panic attacks then they'll stop happening. It's, that isn't necessarily true. In fact, for most people that journal, most people in our community that are dealing with a disordered state of chronic anxiety who try to use journaling to make it go away wind up frustrated. And then they get down in themselves and the whole Craig the critic thing pops in, right? Cause like, I'm not doing it right. Oh, can you guys hear if I do that? It's Craig the critic. You can hear that? Probably did, right? I can't hear it cause I don't have my headphones on. I'm being lazy. But so Craig the critic will pop in and tell you like, see, you're so anxious and you're so beyond hope. And nothing works because my favorite influencers told me that journaling is magic and it's not magic for me. So I'm beyond hope. So you gotta be careful about that too. Again, I need the eagle noise. I don't have the eagle noise. I gotta get the eagle noise. I will get the eagle noise. But I appreciate the fact that you recognize the eagle noise, which is something that you hear all the time on the Disordered Podcast that I do with Josh Fletcher. Anyway, so that's another sort of pitfall or trap of journaling. Why do you want to journal? What is it supposed to do? What is it supposed to do? I can play amygdala. That's this one. Amygdala. I guess you heard that because evidently, I actually remember what the buttons are now. So, and for those of you who don't get the joke, the podcast I do with Josh Fletcher is called Disordered. It comes out every Friday. That's at Disordered.fm and those little sound effects are in almost all of our episodes. So those are definitely some of the pitfalls or the traps of journaling for sure. Why are you journaling? What do you think it's supposed to do? Or the other associated trap or sort of pitfall of journaling could be from what I understand, if I could just journal enough, if I keep digging and digging on paper or in my app or on my phone and notes, however you do it, papyrus and quill pens. I see the quill pen jokes. If I just do it hard enough, I will uncover my hidden triggers or my hidden root cause. And that can be frustrating too, like no matter how hard I journal, I can't seem to come up with the magic trigger or the magic epiphany that tells me, oh, this is why, this is why I'm anxious or this is why my OCD is flaring up. Now I'm all better. So again, it's sometimes you have to be really careful. And I understand if in fact you are struggling right now and all you want to do is feel better, which nobody would blame me for, I want you to feel better too. It can be easy to fall into the trap of, I will journal because all the gurus and wellness influencers telling me to journal, it's gotta be magic. I'm gonna figure it out, I'm gonna do it right and it's gonna make me feel better and sometimes then it doesn't. So let's go into comments a little bit because that's a little bit more fun than just blabbing at you continuously for 30 minutes and then answering questions. So I'm gonna scroll up a little bit. We discovered that we cannot find the coffee bean background. That's because I switched restream plans and I have to re-upload that I think. So let me see what you guys have to say here. Journaling caused me anxiety. We put that up on the screen already. Journaling hasn't helped me. I'm just trying to get up here. I'm critical of my own writing. Let's put this up. This is a great name, by the way. Draw as I'll love it. I'm critical of my own writing is a thing. I'm not journaling right. I sit down to journal and I want it to come out a certain way. I want my writing to sound a certain way. I want to tell it a specific way and I can't seem to write properly or it doesn't look a certain way and then I don't like it and I get frustrated. That's pretty common, right? You have to be careful about that. Again, you would say, if we're going to approach the act of journaling and we're gonna talk about the way I like journaling in the recovery context in general, like as a general guideline, I would say that journaling has to be done without judgment. It's critically important that you journal without judgment about your journaling. It's so important, I think, to go there. This is the thing that you hear when we talk about practicing meditation or when you practice mindfulness. We do it without judgment. I'm thinking it's okay. I'm feeling whatever I'm feeling, it's okay. Whatever I'm thinking, it's okay. However way I write this thing on the paper, it's okay. So I think journaling could be a way to help kind of connect with that. Like, I'm okay, I don't have to be, I don't have to produce a specific outcome to be okay. So that might be one way to look at journaling for sure, as practice in that. Kat says that journaling might be avoidance. Anything can become avoidance. I like this comment. I wouldn't say that it's avoidance like on a universal standpoint. Oh, if you journal, you're avoiding, not at all, but if you yourself know that like, oh, as soon as they start to feel things, I have to run and open my journaling app or run and get my journal and start writing, then yeah, it might actually be avoidant. It's possible. So that's the thing. I love that comment, very good. I use notes on my phone. There's a million ways to journal.  Oh, let's see here. I kept a daily log of everything. Oh, this is good. Thank you, Beth, for this comment. Let's go through that. I kept a daily log of everything I did for a while, but he came incredibly obsessive and unhealthy and I felt like I couldn't take a day off because what if I need to remember this specific day?  Oh, let's see. Let me scroll down to the bottom real quick so I can get rid of this person.  Love it. Anyway, let's go back up here to this. Sorry, guys, I just don't like to leave them here. I like to block them when they show up. So what Beth is saying is true. That can be a thing for everybody. Like if I don't journal and I don't get this thought out of my head and I don't do it right, it's gonna destroy my recovery or I'm gonna miss something super important. So if journaling starts to become compulsive or you feel urgently like you must journal, and even worse, I must journal in exactly this way at exactly this time and exactly this app with this paper and this pen. And this is how I do it. And if it's not exactly right, it's not gonna work. Then you have to reexamine your relationship with the journaling activity, like anything else. Anything in recovery can become compulsive if we're not careful about it, right? So let's make you easier, understand how silly anxiety it can be. Yes, well, okay, we're gonna get to this. So Jason says journaling can make you, make it a little bit easier for you to understand how silly anxiety can be. And I see Kathleen definitely agrees with that. I agree, and we're gonna talk about success journaling, which is something that I sort of am a big fan of and I talk about quite a bit because success journaling, the way I'm gonna describe it and I've written about it in the anxious truth. I've done podcasts about it. I've talked about it in social media can really shine a light on like, oh, this is crazy. Like what's going on here is irrational or the fear that I was sure was true over and over and over again, actually turns out to never be true. So sometimes if you do it that way, you can in fact discover that like, oh, look at this, I'm seeing the irrationality in action. So that's a big deal. We're gonna talk about success journaling in a while. I just wanna sort of catch up a little bit. Let's hide Kathleen's comments here. Just write when I feel like it now, love it. This is good, so there's a follow up from Beth, I love it. Like if the urge strikes you, whatever you feel like writing, then you do it. And then journaling could become a useful thing or writing. Maybe it's just that you like to be creative and write. That's really cool. So I love it. Let's see. Kat Har says success journaling. We're gonna talk about that. Hello Israel from the Philippines. I'm glad you're here, welcome. You might be furthest away. Are there any like people from New Zealand or Australia in the room right now? I don't know. Let's see. I feel like journaling about anxiety will lead me to be thinking more about it and lead to more rumination and worry. I would not disagree with you. We talked about that before. The journaling activity can accidentally just hyper focus you on how you're feeling and what you're doing. Let's see. How long did it take? I'll answer it. It's not a journaling thing, but that's okay. How long did it take me to finally trust what I think and feel? Was that a tail end of recovery thing for you? What did that process look like for you? Well, I acted like I trusted and feel. How long did it take is irrelevant. It took me however long it takes me. It will take you however long it takes you. I'm never ever gonna give you guys like, oh, it took me six months to trust my feelings. South Africa, that might be the furthest away. I have to look at the map, I'm not really sure. But so in that situation, like trusting what you think and feel, the way I did that, what did it look like? What did it feel like? I would have to start to act like I could trust what I thought and felt. Like, because if I was assisting that like I can't trust what I feel so I have to counteract it. Very, very weird, like almost meta sounding. Like if the opposite is correct and the opposite of the opposite is correct.  Like I don't feel like I'm supposed to ignore this anxious feeling or this anxious thought. So I'm gonna have to ignore it and roll the dice. Then over time, you learn that like, oh, look at that. I can trust my instinct, which is my logic that says I don't have to run with that. I can leave that behind and leave it unaddressed and I'll still wind up okay. But timeline is gonna be different for everybody, right? I found it exhausting. Okay, this is cool. So Carrie's talking about exactly what I was talking about, right? I agree with you. I found that exhausting journaling about how I feel as it was just going over it all again and taking time doing it too.  If that is always front and center, it's the most important thing in the universe to you all the time. Why on earth would we wanna get involved in an activity that makes it even more important or confirms like, yeah, I gotta dig into this. I really better dig into this, right? Cause that what you're doing is basically confirming this is important, man, we gotta get into this. But do we, right? So it's important to look at that. Oh, this is good, this is a good comment. Let's see here. It depends when people say reading is good for you. Well, it depends on what you're reading and why, right? Same thing, right? Certainly true, like there's no universal thing that says journaling is like, I've literally heard people almost get berated, especially in like wellness circles. I kind of have a microphone problem. See this mic, this is not my real mic. It's how that mic is actually out being used by somebody else right now. So I got this cheap mic and it's not heavy. So they, my swing arm just slowly like it's possessed. It's not, it just has a very strong spring because this boom arm is meant for a much heavier mic. But yeah, I've heard people in social media circles, especially like in wellness circles or circles where they say phrases like, do the work over and over and over. Like it's some sort of achievement to take care of your mental health. People will say, if you're not journaling, you're doing it wrong. You're doing it, what are you, why are you not up at four o'clock in the morning sitting in a tub of ice doing a kettlebell workout? I'm being very masculine here, sorry about that. And then like sitting with a leather bound journal and 16 books by dead Roman emperors. Why are you not doing that? You must do that. Maybe, maybe not. It is an imposter mic. This is the cheap mic, but it gets the job done. It's an $80 mic and it works, right? So let's see, let's keep going down. I'm gonna try and catch up and then we're gonna go into like success journaling and what I think could be a positive aspect of journaling. I'm trying a gratitude and success journal, just bullet points to try and focus on good stuff more. So in a way, this could be a good way to go too. If you find that this will work for you, then that's really cool. Like what else is going on? So let me connect this to sort of some of the principles of recovery, right? We talk about, I mean, what Carrie's saying on the screen here. We talk all the time or I like to use the phrase attention is a verb. Anxious people tend to think that attention is a noun and like it's a thing and you have a finite amount of it. So if I feel really anxious or I have a scary thought about self-harm, for instance, I have to apportion all of my attention like it's a thing or like I have a jar of attention, I must give all the attention to that. It seems wrong to not give it all of the attention, but attention is a verb. I pay attention, I choose to put my attention. Attention is something that you do. So if you look at it this way, the way Carrie is approaching journaling sometimes could be helpful. I am having repetitive thoughts about self-harm, I am really anxious, I'm nauseous, I feel dizzy, my legs are shaking, I have air hunger, whatever it is, I feel those things, I can't ignore them if somebody paid me to ignore them, but I can also use attention as a verb and choose to try and connect to some other things that are happening in the world around me or other things that are happening in my life. Is it gonna make me feel any different? No, but it starts to teach you the lesson if you do what Carrie's talking about here and you do it judiciously, like you can start to learn that lesson of like, oh look, I can actually, I can write about like my family picnic that I was scared to be at, that I packed that twice, that I didn't have a good time at, but I can write that I went even though I was afraid and it doesn't change the way I'm feeling right now, but hey look, anxious thoughts and sensations and all of those things, you can be here with me, I'm gonna write in my journal right now and we'll put some bullet points down on some other stuff that isn't you, right? So I like that, Carrie, thank you for that comment, I appreciate it. Let's see, the aesthetic of journaling, correct. Ooh, this is, I appreciate this. I also never wanna open that book again, reading it because it gets me back to that place or let myself get there. So this is good, right? Like if your journal was just nothing more than a carousel or merry-go-round all the time of repeating how you feel and how you feel and how you feel, that would be a tough thing to go back and read. You wouldn't wanna read that. Down the road, you might, or you might choose to burn it one day or just keep it in a drawer and never open it.  You get to decide. It's all right, there's no wrong answer there. Let's see here. I'm gonna scroll down a little bit here. Yeah, so we're gonna E and S that might be a specific way to journal. I'm gonna talk about that now really when we go into sort of the second half of this. Where are we? 30 minutes, it's not too shabby. So I'll play a big deal. I forgot that you asked me to do that. I love office supplies. I love the comments section because I never know what you guys are gonna be talking about together. Let's see here. Keep going a long time ago. Kept the daily listing of all my activities for three years. Very little happened. I love that actually. Tried video journaling, but my OCD and Hyper Winners had me overthinking why I couldn't think clearly. Ah, let's put this up on the screen really quickly. Tats and Cats, great name, by the way. There must be some tats in there, right? Like, I appreciate you. So this could be that thing where like, I'm not journaling correctly. It's just reminding me. I've heard people say that like, oh, I wanna sit down and write in this beautiful like gratitude journal that my mom got me for for my birthday, cause she thought it would help me. But my hands are shaking so much that I can't write in it. And then that triggers like, I'm so anxious I can't even journal but I need to journal to be anxious. It's almost like exercise. You know the thing when people say, you should exercise. It's really good for your anxiety. And then you get into the treadmill and have a panic attack, cause it feels like a panic attack.  My anxiety is special because exercise makes me worse. And in this situation, like Tats and Cats is saying, the act of journaling made her feel even worse, triggered her even more. So I get that. Very good. If you journal often and then I've tried journaling in the past, but I never knew what to write about. You know what? This actually pretty common for almost anybody that journals took me a long time. I said in the beginning of a stream, I've been journaling pretty consistently most days for about a year and a half now. And at first I was like, I don't even know what to write about here. But then you've kind of figured out as you go. But again, that's just sort of regular journaling if you will, or people who like to keep a diary or whatever. That's a little different than recovered journaling. Okay. So let me scroll down to the bottom. I think I caught up. Okay. Oh, wait. Fake Canada is here.  I think that when journaling bad things, it's like I'm living it all over again. Okay. See, sometimes it just doesn't work. So the standard advice that says, write down what you're thinking and feeling like, I don't want to, I'm trying to get away from these things. Like all I care about is what I think and feel. You know, I'm trying to fix that. Thank you very much. So please don't tell me to write down my thoughts and my feelings. My thoughts and my feelings own me and I'm trying to learn how they cannot own me. So I get you on that. I feel you. So let's talk about one way that I think is a great way to use journaling. If you're not a journaler now or you are a journal and you tried all the different ways of journaling, it's not working for you.  And I am not sure who mentioned it in the comments. Maybe even Kathleen, I can't remember, or maybe it was Bessie. A success journal I think is a big deal. What I mean by a success journal is this is a stupidly simple journal. There's nothing special about it. Again, I don't care how you write it, scroll it on the wall like Tom Hanks and freaking Castaway put it on. Jason talked about journaling on a Doritos bag. I don't care how you do it. There's no right or wrong way to do it. Do it a different way every night, who cares? But if you can keep a record that basically says at the end of a day or after a scary experience, here are the things I was afraid of and what happened. So a great success journal entry might be was terrified of a psychotic break again today. Didn't have a psychotic break, see you tomorrow. That's really great. Another great success journal entry might look like I had no choice, had to take my daughter to the doctor, was terrified, had two panic attacks, did it, came home, I'm okay, I'm just scared. The end, see you tomorrow, next entry tomorrow. Like the success journal is really just a way to kind of give you an idea where you can go back and look at that and say, oh look, I was afraid to drive around the block six times in the last two weeks. And every single time I did it and nothing happened and I was able to drive around the block. Oh look, every single time I thought that today was definitely the day that I was going to lose my sanity, I didn't. But look at how every day I write that I'm afraid of a psychotic break today and then it doesn't happen. So that is one way to success journal. Success journal is not glamorous, it's not detailed in a lot of ways, it's very basic. I was afraid of this, I did it, I did this anyway, nothing happened. Or you can acknowledge I did this anyway and I was really afraid and I felt a lot of anxiety symptoms. Not, I went to the supermarket today and my heart was pounding and it felt like I couldn't breathe and then my hands were shaking. No, not that. I would not success journal where you just write down all of the things you feel. Don't write down every thought you have. Don't write down every sensation that you have. There's no reason for that. You already will tell anybody who will listen whether it's me, your therapist, your best friend or your cat what your symptoms are, am I right? So there's no reason to put your symptoms in your journal anymore. You've talked about them more than enough. So I did a scary thing today. I felt really afraid and uncomfortable. I didn't think I was going to make it and I did it. See you tomorrow. Good night journal. Like that's a great way to try a different form of journaling. Now what does that do? In the old days of CBT, we would do things like thought records and thought challenging and like fact checking. It's a form of that for sure.  I'm cured. It doesn't work that way. Nor did old school CBT work that way. But it is a way to inject a little bit of objectivity in what is a very subjective experience. So who's in the room right now that is completely and utterly wrapped up in every feeling, sensation, thought? You need to know about it. What caused it? Why is it happening? When is it going to go away? What does it mean? If you're wrapped up in that right now, you're in an incredibly subjective experience.  I would expect human beings to do that, but then it goes off the rails and then you wind up in an anxiety disorder state. So in this situation, we're saying, okay, I know I wanna just spew out again exactly what I was afraid of. Oh, my head felt weird again. No, no, no, not my head felt weird. How about just I was afraid? How about just I had a lot of anxiety sensations today? And what happened? Nothing, I was afraid. What else happened? Well, I guess nothing, I was afraid. Like, so in a way, you can use your success journal to just inject some objectivity into what was otherwise a very highly emotionally charged subjective experience. And that subjectivity and that emotional reasoning is part of what makes recovery so difficult. So we can use success journaling this way as a way to sort of start to balance that, counteract that.  My thoughts, but my thoughts, they come from inside of me. They're sacred, I must, I must connect to my thoughts and like flesh them out and dig into them. Oh, you don't, that's what got you into this problem to begin with. I'm not telling anybody to invalidate your humanness, but when you are literally in a stuck in a torture chamber of validating every emotion and thought and feeling and experience, internal experience that you have, we have to find a way to pry ourselves away from that for a little while, right? So sometimes you're gonna get people who say, that's crazy, you'll never heal if you start to like ignore your emotions that way because your anxiety is a hidden message and you have to dig to find it. If you've been digging and you haven't found it after two years, stop digging, try it this way. What's the harm? Like it's not working the other way anyway, right? So I'm looking at, I even I enjoyed the rain watching outside or having a roof above my head. Yes, stuff like that. Instead of like, hey, I was really scared today. Guess what else was going on in the world? The neighbor's kid was practicing with his band in their garage. They were terrible, but it was kind of cool because they're trying. How's that? That's a success journal entry. I was terrified, but my cat dragged a burden from the backyard. That sucked. See how like more than one thing can be true at a time and you begin to put in a little bit of objectivity. I was afraid, but life was still happening. And it was, I was okay that I was afraid. He didn't have to make it the most important thing. The other thing that I think a success journal can do for you and the purpose it can serve is it starts to become an objective brain for you. So we human beings, this isn't even an anxiety thing. This is just a human thing. Humans have an incredibly strong negative bias, right? We tend to remember bad things way easier than we remember good things. We remember bad things in far greater detail than we remember good things. Like this is just the way we seem to be wired.  We could probably talk about that for months or years. There are probably people who spend their entire careers trying to explain that sort of stuff. It's interesting, right? But your success journal can actually be a record that counteracts that negative recall bias because how many people in the room have worked on their recovery and maybe had one or two experiences where I took a leap of faith. And oh my God, I did it. You felt amazing that day, but then three days later, maybe you have a panic attack and you just, that's it. That's it.  You completely, completely forget all the things that you've done in the past. You throw them away and you start to, again, glue yourself to only the internal experience that you don't like that you're having now.  I feel bad today and that's the only thing that matters. That's a hallmark of somebody in a state of chronic and disordered anxiety. And when you get down to it, it's like, well, if I can go back to my success journal and say, hey, wait a minute here, I am feeling bad right now. I can acknowledge that. I don't have to pretend that I don't. But I can also go back and look, hey, remember when I used to be afraid to walk around the block? Or remember when I couldn't stay home alone at all and now I stay home alone regularly for half hour at a time? Remember when I would Google my symptoms every 15 minutes and now I can go three hours between? Like the success journal can remind you that like how you feel now isn't the only thing that matters. So that's another valuable thing in terms of success journal. Success journaling is not sexy. It's not romantic. There's no aesthetic to it. It's pretty dry, but it could be really useful if you want to look at it this way and play with it, like experiment with it. There's no right or wrong way. Just be careful of falling into the old journaling traps of my journal is to recall all of my symptoms and every scary thing I have. Somebody just asked about, oh, Bethany said, can you talk about values-based journaling? Sure. So values-based journaling is really interesting. The thing that is interesting about value-based journaling, and I got this out of the book that I read called The Upside of Stress by Kelly McGonagall, who I think we're gonna have on disordered. That's gonna be great if we can arrange it. She said she wants to come on, we're still trying to work it out. But there's research, a lot of research was done that says when I'm struggling with anxiety, if I can connect back to the things that are valuable to me, that I care about in life, not goals, but values, like I value creativity, I value kindness, I value curiosity, whatever it happens to be. If you can start to connect to your values, you start to remember, oh, that's right, I chose to do the school pickup run because I value family. Family is important to me. And I did that heart thing and I had a panic attack waiting in the pickup line at the middle school, but I did it because I value this. So there's a really cool exercise where you can sit down and start to look at what your values are. And by the way, if you can't identify your values right away, totally fine. Most people cannot, it might take a while. And then what you wind up doing is I do it once a month. Once a month, I have a list of like eight or 10 core values that are sort of important to me, sort of the core of my value system. And once a month, I'll sit for 10 minutes one night. I have it as a to-do list item. This is the way I remember to do it. And I will pick three of those values and I'll just write random stuff about those values for 10 minutes. And I do that once a month. And it's an interesting exercise because when you are actively involved in challenging your fears and doing exposures and going toward your fear and doing all the things we talk about here that nobody wants to do because it's freaking terrifying and it's so hard, sometimes if you can connect to your values and sometimes use your value, remind yourself of your values in your journal entries, you can remember, oh, this is why I'm doing this. It can be very helpful to stay connected to why you're choosing to stay home alone for 15 minutes.  So that's value-based journaling. Good question, B, thanks for asking. Where are we here? 42 minutes. So let's see what else we have. I like, I actually kind of like that. I went through the comments halfway through instead of wait until the end. That's better. Let's see here. I would try and catch up with your comments with each other, but I can't. I just dig that you guys talk to each other and support each other that way. Inject a little left brain, there you go. You want to look at it that way, that's totally fine. I kind of like the left brain, right brain stuff. That's a creative versus rational, emotion versus logical. Have a way you like to conceptualize it. If that's the way you conceptualize it, right brain, left brain, and that works for you. Go for it, right? Let's see here. What is this one? I also try to right-see little things as a win because of my perfectionism only focuses on the big things. I'm trying to value the little things now, like getting out of bed, brushing teeth, and dishes. That's awesome. So like that would be a really great thing to use in like the success journaling mode that I was talking about. Like I know I want to write down every, I want to sit down every night and make journal entries that talk about how recovered I am. But for the next week, I'm really just going to look at, today I listened to an entire, you know, side of an album. It was really hard for me to sit still because I'm so anxious, but I sat and I paid attention to the music. I listened to four whole songs before I got up and had to walk around. That's a huge win, but your perfectionism won't say it is, so you can use a journal to maybe remind yourself, hey, wait a minute here. Can I give myself some credit, right? Oh, I should try this as Kel's. Yeah, sure, give it a shot. You can't, you know, there's no harm here and you have to find your way in it for sure, but this is cool too. I like, oops, sorry for banging my watch on the desk. Might open my eyes to how much worry about losing my mind and undergoing crazy and how even the smallest did it anyway was done and I made it to tomorrow. What you're gonna find is if you can maintain this habit, you know me, I never like to say you made it because you were always gonna make it, did it. I did it anyway, I did it. So if you can keep recording your did, you know, we do, Josh and I do did it anyways on Disordered. Start your own did it anyway list. You can go to disorder.fm and send us email or voicemails on your did it anyways and we try to read some of them on the air or play your voicemails, but you can also use your success journal to document your own did it anyways. It's super valuable. Guess what? You did it anyways matter even if no one else sees it. I know that's hard to believe in the social media era. Like if you do a thing and nobody knows you did it, still actually happened. Like if you know it happened, then it happened. Put it in your journal. Let's see here. Yeah, Jade is kind of looking at this too. I see that at the end of the day we made it through with still don't believe we'll be okay and just move past the experience. This is when I wrote The Anxious Truth which is my big recovery guide. If you don't have that book and you wanna check it out, it's on my website which is TheAnxiousTruth.com. It's there. I talked about recovery as a changing of reactions. There are three reactions. The reaction before that's the anticipatory anxiety. The reaction during. What do you do when you're in the midst of that really scary experience and you're feeling all the feels and the reaction after. How do you frame the experience when it's over? That's the reaction that most people forget. Like I did it and now I wanna go home and just tell everybody how horrible it was and how I barely made it. And I felt like I was gonna go crazy. I felt like I was gonna have an auto attack but you didn't go crazy and you didn't have a heart attack. So it's so important that you can start to use a success journal formula if you will or that mode or that idea to build a more helpful after experience and after reaction. The reaction after is like I did it. I did it. I was really afraid. I was terrified. I felt a lot of things but I did it and I managed to do it. Remember I'll connect you back to like the three C's. I did a podcast episode. I don't know when. Just search for courage, competence, confidence on my website, whatever episode that is.  You're always good for that. The three C's of recovery. You start with courage. You take your leap of faith. The courage leads you to have experiences that show you that you are competent and that's all we care about. So your success journal doesn't have to tell you about how happy you are or how amazing or how full of gratitude you are for your school pickup run. Maybe you will. And that's cool if you feel that. Put it down, nothing wrong with that. But it will show you that you were competent even when you were afraid. Look, here's another day that I was competent. Here's another day when I was competent. Here's another day when I was competent. And then after a while, all of that competency fueled by courage leads to confidence. Confidence is the last C that you get and that tells you that I will be competent. Even before I did a thing, I started to recognize that, oh look, I will be competent. Right, so courage leads to competence, leads to confidence over time. I guess we're good. 47 minutes on journaling. I think we did pretty good. I don't know what you guys are talking about here, but I dig it. Usually there's all kinds of weird conversations going on, but these look strangely normal. You guys are just winding me today. Usually it's very random stuff. Anyway, I hope this has been helpful. Again, just to recap really quickly, I'm not here to tell you not to ever journal. I'm not picking on journaling. You know, a lot of people love journaling. I totally get that. When you are in a recovered state, you might journal completely differently. Maybe you'll go back to your old way. Maybe your journals will be flowery and aesthetic and romantic and maybe they will be full of digging into your emotions and your life experiences and that will be fine because you'll be able to do that then. But for now, if those type of practices that you maybe used to love or think you're supposed to do are hurting you or at least not helping you or keeping you stuck, consider what we've talked about today. So there's no universal journaling bed. It's not that. Consider what I talked about. Some of the red flags, the traps and some of the maybe the more productive ways to use journaling for anxiety. See how I did that? See what I did there? Anyway, guys, I'm going to back out of here. I guess if you want to, we do these if you're new to this or you're watching on a replay. First of all, if you like this video, hit the thumbs up and if you're new to the channel and haven't subscribed, please hit the subscribe button on YouTube for sure. The best way to always find these on the replay are on my YouTube channel because there's a playlist called Recovery Monday. If you ever want to go back and rewatch this, go to my YouTube channel, subscribe while you're there and look in the Recovery Monday playlist and you'll find this. You can go back and watch it anytime you want. If you're watching on a replay, by all means, leave a comment. I will circle back at some point today, at some point this week and try to answer your comments if I can. I will put up one more quick plug for the workshop that Josh Fletcher and I are doing in early February. It's in about a month or so. It's called worry and rumination explained. Just go to this URL that you see at the bottom of the screen, bit.ly slash worry rumination. It's a two-hour Zoom-based workshop that talks about the mechanics of worry and rumination and how you can start to take steps to break that habit. I'm actually gonna post about it today on Instagram and socials and that's it guys. Thanks for hanging out. Always fun. I can't believe it was been a month without one of these. I'll see you not next Monday, but the Monday after and then next week on Wednesday, there'll be an episode of the anxious truth. Every Friday there's an episode of Disordered. We're out. See ya.


What is going on guys today?


My name is Pyle and I'm going to talk about provisioning and automating high-availability Postgres on EC2. Just a quick question before we proceed. How many of you have worked with EC2 or RDS? That's a good number. Before we go on a little bit about myself, I'm a DBA at Omniti Computer Consulting. We are a group of Postgres consultants, amongst other things. That's my GitHub handle and that's where you'll find the repository where I've done most of this work that I'm going to talk about today. Feel free to go through my blog and follow me on Twitter and email me if you have any questions. The first thing we're going to talk about today is why would somebody choose to go with EC2 for Postgres as opposed to RDS? Especially that RDS is so popular and is doing very well. There can be some situations where EC2 might be a better choice for you. If that's the case, then we're going to talk about designing a provisioning tool around your Postgres on EC2 so that you can do a better job of administering a lot of things about Postgres that RDS does for you automatically, but EC2 does not. Consequently, we are going to look at the provisioning tools out there. There are a lot of automation tools and they each have their pros and cons, so we're going to briefly look at those and hopefully that will help you decide on what tool you want to go ahead with. And finally, we're going to actually look at how to automate all this stuff in a particular tool, Ansible, just as an example. The intention is that you won't be able to exactly replicate the code. You can use my code that's in my repository on GitHub, but the intention is that you will have enough understanding that you can pick up any tool and know what exactly you have to implement. So why EC2 over RDS? Firstly, because of the control it gives you. A lot of the times you need to step outside of Postgres and look back at it to see and understand what's going wrong with it. A very good example is the need for extended logging. You might want to log a lot more stuff than Postgres itself logs a lot of the times and there are tools out there that do that. If you're an RDS because you don't have access to the machine itself, it can be hard to place those logging tools in it. Similarly for third party extensions, RDS supports a lot of those, but there are a lot others that it doesn't. And so if you have to use an extension that is not supported by RDS, you have no way of doing that. Another major thing is the need for different resources. They can be more disk space, more storage, less storage. RDS does that, but then EC2 provides you the ability to do it yourself and take more decisions about those things. Secondly, flexibility is important, especially when you decide to migrate something from RDS. You cannot use PGDump all and consequently you cannot just dump out the roles and uses from Postgres. So you have to create those manually to the database you're moving to. Compatibility with non-AWS resources, one major example is let's say you have your master database in RDS, but you want to have a replica on a local machine or say even a replica on EC2. You cannot do that. You cannot have streaming replication because RDS does not support that outside of its own environment. And so these are just a few of the reasons why one might decide to host their Postgres databases on EC2, even though RDS is a great service. If you're going from RDS to EC2, you have to know there are a few things you're going to have to keep in mind. The first one of course is increased administration. RDS handles replication, backups, maintenance, upgrades, everything for you. When you're moving outside of RDS, you're going to have to handle that or find somebody who's responsible for that. Another thing is security. When you're creating an RDS instance, right there you're given the option to choose a VPC, a security group, and other similar security aspects of it. But when you put Postgres on EC2, you're solely responsible for security. There's very little hand-holding. It's just like hosting it on your own machines, except that it's rented from Amazon. And finally, basic monitoring. When you create an RDS instance, by default you get some level of monitoring in CloudWatch, which is another service by Amazon. You don't get that for Postgres when you install Postgres on EC2 because Amazon doesn't care what you're installing on EC2. So even a basic level of monitoring will have to be done and set up by you. Moving on to the automation tools, there are a lot of tools out there that do a lot of things. And the four main popular tools are Ansible, Puppet, Chef, and Salt. How many of you have heard of all four of this, please? Okay, that's great. How many of you have worked with Chef or Puppet and Ansible or Salt? Okay. My talk mainly focuses on Ansible, but I'm guessing you won't have much trouble since most of you have worked on one of these automation tools. So since most of you have already worked on these, you might know there's a push versus pull thing when it comes to provisioning tools. Ansible is the push type, and Chef and Puppet are pull. Salt is in both categories. One main advantage of push systems is, let's say if I want to run a bash command just once. I don't have to put it in any script. I don't have to make a file for it. All I can do is tell Ansible, go and run this one command on the subset of the servers, and it can do that. So that's one big advantage of push-based systems. And in general, push-based systems initially, at least, tend to be simpler. They can get complicated as you move up and scale, but in most cases, a push-based system is simpler. One tool that wasn't mentioned in there was Terraform. How many of you have heard of Terraform? Great. For those that haven't, it's a provisioning tool that specializes in cloud infrastructure management. And I have used it just to manage my EC2 resources. So while I've automated everything Postgres related using Ansible, I have used Terraform to create and destroy and maintain the EC2 instances. Why did I do that? I could have easily done that in Ansible. Yes, but not as easily as Terraform does it for me. Basically, all I have to tell Terraform is this is the information you need to log into my EC2 account and create an instance. I just tell it to create an instance and it can just do it for me. Because it has functions that are inbuilt in it for each of the popular cloud providers. Before we move on, just a quick tour of what Ansible is. Since most people here have worked with it, I won't spend too much time, but yes, the black arrows you see going to the servers are basically it executing its playbooks. A playbook in Ansible is just like a recipe in Chef. It's a collection of commands and tasks you put into that you want to execute on each or a subset or all of the servers. If there are certain modules in Ansible that you don't have, you're free to create it in Python. Yes, you just create a playbook, a collection of tasks and tell it to run, give the IP of the servers you want to run it on. And you're good to go. Why I chose Ansible? As I already mentioned, it's simple. It's clear because it uses YAML for all of its playbooks. So basically, you write every task in YAML format, which is very human readable. We're going to look at a lot of those ahead. And you shouldn't have trouble following what's actually going on there. There is also something called Ansible Galaxy, which is like CPAN in Perl. A collection, a place where people can go store their modules and roles and you can access it and reuse their roles. There's always some danger, but it's worth it. Let's move on to design. This is something you want to, when it comes to Postgres Automation, you want to design it beforehand. This is not something you start doing and then plan along the way because after a while you realize that it's doing completely different things than what you expected it to do as you add more modules and features to your automation tool. The first thing you want to design is planning out how to set up your EC2 instances, how to make changes to it, how to add new instances, and then how to manage Postgres installs, reinstalls. This also includes major upgrades as well as minor upgrades and the dependencies you might need, how to handle those. Tuning and customization because it's the next most important thing after setting up Postgres, right? And replication, this also will include slave rebuild as well as certain security aspects that you should keep in mind. Backups and replication, monitoring, and finally failover. In the failover section, I will go through semi-automated failover as well as fully automated. I would recommend to always have some level of human interaction when failing over, but again it depends on your needs and the choice is totally up to you. Such thing as a bad design in Postgres Automation? Yes, there is and it will hurt eventually. In the beginning it might not, but eventually, yeah, it's going to become more and more of a pain. You start with designing modules separately and try to make them work together and end up with a very ugly hack that barely works. You sometimes use tools that you shouldn't just for the heck of it. Like here, this bar graph actually could have been very well represented with a calendar. And for those of you wondering, the length of each bar graph corresponds to the day of the month and the x-axis is each state. So yeah, very easily could have been represented in the form of a calendar. In the same way, don't use a tool that doesn't make sense for the task you're going to do. Make sure your modules do not interfere with each other, they interact with each other. So a very good example of this would be, let's say you have two features in your tool, right, in your software. The first one is a slave rebuild feature and the second one is a normal replication. Let's say you have multiple replicas. If you're rebuilding one of the replicas, you don't want to break replication for the rest of them.  You do not want replication of the rest of your replicas to break just because you're rebuilding one of them. You also don't want your fragile infrequent tasks to break just because of your routine automation runs. For example, if you're performing an upgrade, which is a relatively infrequent task, you do not want your routine run to run in between and undo all the changes that you did for upgrade and break that activity. So you want to take into account that you're not doing that. And the best way that I could find was to create switches, which made it very easy for me to make those interact with each other in exactly the right way. And we're going to look at a few examples ahead. And finally, clear documentation. Avoid ambiguity. Do not reuse code amongst different features. Just copy it, redundancy is good in this case, because as it is, if somebody wants to make a change in the replication feature, they do not expect that to also change installation. So do not, yeah, code reuse, redundancy is better than reuse in this case. Moving on to setup and installation. And from here on out, this is the next few slides are Terraform. And the way Terraform works is basically it has, in the simplest terms, it has a variable file and a main file. In the variables, you provide it all the things you wanted to have to be able to access and create or interact with your AWS objects. In this case, I'm giving it a key name, my keys, and the AWS region I wanted to go and create the instances in. And then in the main file, .TF is the extension you use to create Terraform files. In the main file, all I have to do is tell it what my provider is, in this case, AWS, and give it all the variables that I just put my key values in and tell it which region to go to. And what user I want to use, what key it should use if it wants to SSH, and the type of instance, the security group, and how many such instances do I want to create. In this case, the count is two, one for master and one for replica, the absolute basic level. Even though you don't need to do this for your Postgres automation, it's still good to know. There's some amount of limited provisioning that Terraform does provide. So in this case, you're basically telling it to SSH into the AMIs, the instances that it just created, and install a couple of packages, just as an example. And if everything goes well, when you literally type that command Terraform, apply in the directory where you created the previous variables and main file in, it's going to start creating the instances with the values that I gave it. And yeah, it should finally spit out the IPs that it just created. In this case, this is what you should expect to see in the AWS console. In this case, the screenshot I took was of a terminated instance because I didn't want to paste the IPs of actual instances that I was running, so you should see the instances running and the public IPs mentioned in this page on your AWS console. The next part is Postgres installation. Before we go ahead with that, and now this is all Ansible, that was Terraform. We are done with the non-Postgres stuff, and we are on to Postgres. This is the simplest main file you can have, which is basically, for those that haven't worked with Ansible before, you can group IPs into groups, so in this case, I have three groups. I have the DB group that's first, I have the streaming masters and the streaming slaves, and then for each of these, I tell it to run certain roles, regardless of any switches, and then there are some switches that have defined in the variable section of Ansible, based on which some other roles run. For example, in the first portion where all the IPs in the DB group, which include the masters and the replicas run, if I turn on the install switch, it will run an install role and make sure Postgres installs and dependencies installs and all the related stuff. Similarly in streaming master, when I turn on the failover switch, it makes sure that the IP that belongs to the master now is the master. Typically how I would go about it is swap the IPs that I want to failover and then turn the switch on and Ansible will take care of the rest. Finally, the streaming slaves, when I want to rebuild a slave, I turn that switch on and it checks to see that switch and based on it, it runs or ignores the slave rebuild role. So this is an overview of how the main file should look like. Any questions? Yes, I am using Ansible for the Postgres install. Depending on what OS you're using and how many types of OS you have on your infrastructure and your dependencies, it just would make sense to have a central location where you're managing all the installs. But yes, if you're using only a particular OS, it might make sense to do that stuff in there. Postgres installs, the very first thing you do is make sure you have the source key list added. In this case, in this example, the instances that I created were in Ubuntu and Ansible has modules for a lot of the tools and it has a module for the aptitude package manager, which is what I'm using to add the key. That key belongs to the Postgres package, the 96 package. So I add the key. This is all YAML by the way. For those that haven't worked with it, it's basically you're telling it what the task is doing and then telling it what actually to do. Once I've added the keys, I tell Ansible to install Postgres for me. Again, I'm sorry, how many of you have worked with Ansible before? So with items is a defined array sort of a structure in Ansible wherein you can put in elements, a list of elements and Ansible would know to iterate over those. So in this case, I'm telling the aptitude module of Ansible to iterate over everything that's listed in with items and make sure they're present. One property of Ansible is that it is idempotent. So when I tell it that the state should be present, it's going to go run itself and check. If the package is already installed, it's not going to do anything. It's not going to make any change. But if the package is not installed, it's going to make sure it is. So it's going to install it then. So there's no harm in always letting the state present equals to true in this case because if it's already present, nothing would happen. Oh, and I'm using a variable Postgres version to make it simpler for me to change versions of Postgres. So basically the last part is the version is defined as 9.6. If I just want to upgrade it, it becomes easier for me. I don't have to make the change everywhere so I can just define it in my attributes file and it will change it everywhere else. Reinstalls are simpler, but just in the case that you're managing dev instances or test instances where you might need to destroy or recreate data, a PG data, a good idea is to have flags. A lot of people use flags everywhere. I wouldn't suggest that. I would suggest to just use Boolean parameters, switches, and handle them in the main file when it comes to different roles. But if you want to have conditions within the roles itself and within the tasks, then flags come in handy. So as long as it's controlled, it's a good thing. So in this case, I have a flags that says uninstalled binaries and data and depending on whether that's set to true or not, it only uninstalls binaries or installs both. The next part is customization and tuning because what might work for me may not for you. So the first thing is defining, telling Ansible where to place the PG data, configuration files and basic settings like that. And creating, this is how I went about it, but there are various ways to do that, but have an array postgres extensions where I put in all the extensions that I want to be installed at any time and then tell Ansible to iterate through it like we saw in the previous slides. And it makes sure that they're installed. Just to give you an idea, this is what a snippet of postgres SQL config template looks like. So basically all the usual parameters in there that point to variables. The variables themselves are defined in the attributes file. That's also within Ansible itself. And so when I typically go about running Ansible, Ansible knows when it goes through the template, it searches for that variables value in its attributes and places it in there. Similarly for PG HBA, I can either have customized option to put in single individual entries. If I have more than one replicas, it makes sense. The first part that I have an array with all the replica IPs and loop over it to make each entry into the HBA conf. And to find my values, the file is going to start looking something like that. And finally I tell Ansible to configure HBA file where to place it, where to place it from, give it the template source and give it the required permissions, the file permissions that it needs to have. If everything goes according to plan, the command you will run is Ansible playbook and give it the main files name. And in this case, the install switch is turned on and you can see it adding the source list and installing PG data, placing all the configuration files, installing the dependencies and making sure the service works and starts up fine. There are also roles in Ansible for managing roles and databases within Postgres. So you do not have to use raw SQL to do that. You can just use the modules to create roles for you and databases for you. And that's what's happening in this. The first portion is the roles getting created and the lower half is the databases and extensions. And we're done with tuning and customization. The next obvious thing to do is replication. And again, just like we saw with the tuning, we have related parameters, variables being defined in our attributes portion. And similar to HPA and Postgres, we define recovery.config file. We tell it where to place it, the template, the permissions it needs to have. And again, the lower half is what the template of recovery looks like. It uses all the variables that you've already defined before. So you do not have to put your replica IPs hard coded anywhere except for the host file in Ansible, which is the file you have in the parent directory where you define, where you state which IPs are replicas, which IPs are masters, and all the database other groups that you might want to have. This is basically what I was talking about. So in this case, since I only have one replica in place and one master, those are my groups, aside from the DV groups. For those who are especially paranoid about security and not comfortable with placing plain text password in recovery.con file for replication, PG Pass offers a slightly better approach wherein the file itself is hidden in the user's home directory. So that's what I'm telling Ansible to do here is to put the contents, the login contents in PG Pass file and place it in the home directory. And this is what you will see for replication. When the switch is turned on, it's going to recreate the database from a base backup of the master. That's state six. And configure recovery, create log direct trees in the usual setup of service. And once that's done, you can see that the master now knows that it has a replica that's streaming from it asynchronously. So just make sure the slave rebuild or the slave build, whatever switch you define is false by default. And you have to turn it on if you want to set up a replication from scratch or after a failover. And in this case, I use PG base backup to recreate my copy my data directory, but there are a lot of other alternatives. So all you have to do is change that in that particular task in Ansible's playbook. So it's literally the command PG base backup command. In Postgres 9.5 and above, there's a great new tool PG Revind, which would save you the effort of rebuilding a slave from scratch, especially after a failover. What this does is synchronizes a cluster with a copy of the same cluster. So if you move to a new master, you don't have to rebuild the old master, destroy the old master and recreate it from scratch. You can just tell the old master to start copying and synchronize based on what the new slave is. And it's a great tool. It saves you a lot of time, especially if the databases you have are quite large. And so instead of the slave rebuild option after a failover, you're free to use PG Revind if your Postgres is on 9.5 or above. It does require super user access, so that's a prerequisite. Other prerequisites are it requires wall log hints to be on or data checksums to be enabled.  So if you don't have it turned on, you should because it also helps with avoiding data corruption. And the way you can do it, the best way is the next time you're doing a major upgrade or a migration and you're initializing the cluster, make sure data checksums are turned on. So we're done with replication and we are on to something that is often ignored, but very important is to always have backups. So in this case, I have logical as well as point in time recovery. Logical backup is very simple. I don't need a lot of variables for that, but for recovery, just a few basic variables to define you want to set up yet another switch. Make sure you're giving it all the required information. And the way I have done this here is I wanted to stream all the wall logs directly to S3 and not have to store them anywhere on EC2 or elsewhere. So in this case, I used Ansible's S3 module, which requires me to define a few other variables. Basically, where do I want to store them? What's my bucket name? What's my key name? What's my secret key? And that's, that's all the variables you have to define to enable streaming to S3. As I said, logical backup is fairly straightforward and just provided to the PG dump command. I have a few variables in there, but if that's something that you won't be changing except for the date portion, you don't have to have it. And then I use the S3 module to upload the backup file. In this case, the logical backup that I just took. The S3 module has a mode just like the AWS Clies S3 command, or if those of you have used the tool S3 command. So the put mode uploads it and the get mode downloads it. So while taking backup I used put and while restores, I will use get. But first, normally when you go about restoring, you want to see if the file that you want to restore from is already present. A lot of the times you have a few days worth of backups on your local machine. You don't necessarily delete it as soon as you upload on S3. So that's what I'm doing here. I'm first making sure that the backup file that's requested is not present locally. If it's not present locally, then I will ask Ansible to download it for me. So the way I'm doing that is with the help of a register. So the register backup file in the first section checks to see if that file exists or not. And based on what the value it returns, I decide whether to download that file from S3 or not. The second last thing I have to do is make sure there's a log file in place to log the PG restore output. In case it errors out or there's some useful information I need to see. But yeah, that's all I have to do for restores. For point-in-time recovery, the tool that I chose was Wall-E. There are a lot of awesome tools out there. OmniPitter is my favorite. But the reason I used Wall-E was because it has inbuilt integration with the cloud storage systems. What that means is if I want to stream all my wall logs directly to S3, I don't have to do anything extra. All I have to tell Wall-E is that this needs to be uploaded to S3 on so-and-so bucket with so-and-so privileges and permissions. And it will do that for me. It has functions that are within it. I don't have to deal with anything additional to be able to store something elsewhere, as long as it's a cloud storage system. So here I'm giving it all the access permissions it needs. And Wall-E is an open-source tool. It's on GitHub. If you look at the readme, you will see it tells you precisely where to place these files that it needs for S3 access. So that's basically what I'm telling Ansible to do. Pretty much in all of this slide is telling Wall-E where the files are that it needs to be able to access S3. A tidbit Wall-E does require a few dependencies, so make sure you have those installed, particularly PIP and Daemon Tools. So that was pretty much setting up point-in-time recovery as well as logical backups, storing them on S3. But if I want to do it every day, I don't want it to depend on a person doing it. So of course I want to set up a cron. And Ansible does have a cron module. Who would guess? So yeah, basically you give it a time and date to run, tell it what it's doing, and you're done. Another very important thing and often overlooked is monitoring. You want to set up good monitoring and tell it to alert you on time before it's too late. And the good thing about Ansible is it has a plethora of monitoring modules. And that's the link where you can go to look at all the monitoring modules it supports. And this is an example of a monitoring service called Serkonus. And pretty simple stuff, self-explanatory. So it's an annotation module. It is supposed to set up a metric on an app change. And for those who still want to go ahead and do it on CloudWatch, this is a snippet of how you would go about doing it. Basically just giving it a name, telling it what the threshold is to alert on and giving it a description amongst other things. And again, CloudWatch also has a module inside Ansible, so that's what it's using here. How much you set things up and make sure everything's in place. Sometimes you do have a fallout and you do require a failover. And that's what is happening here. The switch that I have for failover is Promote Slave, which is by default false. So of course when you have to failover, you turn it to true. And based on that, remember the main file we looked at a couple of slides ago. If this is turned to true, it prompts the Promote Slave role to run, which essentially promotes your slave. And so that's what you should see if you're doing it exactly the way I did or using my repository. For a fully automated failover, there are a couple of alternatives out there. I decided to try out PG Pool and Watchdog, mainly because PG Pool has been around for a long time. And this is basically PG Pool 2 and Watchdog. This is an overview of how it basically works. Watchdog is a monitoring module on top of PG Pool. You place it on every PG Pool instance you're running above every database. And Watchdog can communicate with other Watchdogs in its cluster and talk and make sure that everything's running as it should. If say the Watchdog that's placed above the master, the left-hand side just notices that the master is no longer responding. How it does that is it keeps sending pings every few time periods of nanoseconds. And when it realizes that it's not responding, it will tell the other Watchdogs to make a decision to failover to one of those. And so a quick look at what you'll have to do to configure such a system is first of all make sure the master slave mode in PG Pool is turned on. And the replication mode is set to stream by default that is set to slownie. And make sure your failover command is in place. In this case it's just a simple bash script that tells it to failover to touch the trigger file. Give it the IPs of the databases that are masters and slaves. The first one will always point to the master. The subsequent ones will be the replicas. For Watchdog, turn it on by default. It's not turned on. And give each respective Watchdog's IP to it and tell it what it has to use to make sure the database is responding. In this case it's just select one from Postgres. And if everything goes well, once you've initialized it, this is the log output of a Watchdog that's on a replica. So the first few lines you can see it realizes it's a standby. And then it finds out which one is the master node. And then it knows that two Watchdog nodes are running right now. One thing you should keep in mind is setting up elastic IP. So you don't want to change the IP that your app points to to interact with the database every time you're performing a failover. And the way you avoid that in AWS is using elastic IPs, which is a fixed IP that always points to the current master. It doesn't matter which actual box it is. And so this is a Terraform snippet to do that, just a one line command. And there you go. You have an elastic IP set up. Finally, avoid a disaster at all costs. If you're the person who deals with the Postgres database on a day-to-day basis, you should be the one to automate it, not somebody else.  So you're the best person for the job. Do it yourself. And finally, a few useful links, docs for Ansible and Terraform, MyRepository, and AnsibleGalaxy, which is a collection of roles and modules. And questions. So Watchdog, yes, it does talk to PGPool, but eventually if PGPool tells it that I'm not working, it's going to help you failover. It does help you with automated failover. It was with Watchdog, but I will have to look into that. That's correct. Yes, that's correct. So if anything goes wrong, if PGPool stops responding, if PGPool goes wrong, then Watchdog is going to make sure that it has a talking PGPool. Except for all the Terraform stuff that I talked about, because everything that I talked related to Terraform was related to EC2. But everything that I talked about Ansible, which is Postgres automation, you're correct. Yes, yes. No, load balance is not on. Any other questions?