Hi there. I'm Jase Lindgren, a solutions engineer at Perforce Software. And today, I'm going to be taking you through how to add an extra storage volume as well as automatic backups to your digital ocean perforce image. So I'm assuming for this that you have already created a Helix core digital ocean droplet You can do that by going up to create a droplet, and then choosing from the marketplace, the Perforce Helix core image.

So I'm assuming you've already done that. And now we have our instance up and running, our droplet, as it's called on digital ocean, And the first thing we're going to do is to connect via the console. So I'm gonna click here to launch the online console You could also do this through SSH, but I'm just doing it this way to keep it simple. When you log in here, you will see this message of the day, And if you have a recent version of the Helix core SDP image, you will have this extra message down here at the bottom that says digital ocean setup, We highly recommend that you set up a separate depot volume for your digital ocean server.

This will make backups easier and potentially save you a lot of money as your depots grow. To quickly and easily set up a depot volume and automatic backups, run this script right here and follow the instructions.

Alright. So what we can do here is come up and run this script. So I will just copy this path here with control c. And then I'll paste it in here.

This script will give explanations of what it's going to do at each step along the way. So this first one here explains that this script will assist in transitioning your Helix core depot data off of your root volume, and onto a dedicated volume.

It's important to note that in order to do this, it is going to shut down your Helix core server for a little bit While it sets up the new volume, moves data over, remap some paths, and then starts it back up again. What that means is If anyone is currently logged in, like if you've already given people logins to your server and they're actively trying to submit or sync files, They're going to run it to errors, and it's gonna crash part way through because the server is going to shut down. So just be sure that nobody is using it right now, let all of your users know. Hey, you need to stop this for a little bit.

I have to do some maintenance on the server. If this is a brand new server that you've just set up, you can just go ahead, keep using this script. If you've already been using this and you already have data on it, I would strongly recommend that you follow these steps here and make a checkpoint create a snapshot through digital ocean so that if the worst possible thing happens, if, for some reason, things get totally screwed up, you could go back to that snapshot and restore your server from there. So if you're gonna do that, just exit out of this script and then run this script that it mentions here, which is for doing a daily checkpoint.

You'll run this daily checkpoint script as the perforce user, And then in digital ocean, you'll go and make a snapshot, take a live snapshot of your whole instance. So you can use that to get back to it and restore that snap shot if you have to. I don't think that you will, but always better safe than sorry. Assuming this all looks good and you've already done that, you can click y to continue and hit enter.

This next step says that it's going to prompt you to authenticate DOCTL So DOCTL is the command line client for digital ocean. What this script is doing is actually running DOCTL on the instance itself. So you don't have to install anything else or configure anything else yourself.

But in order to authenticate, it needs a digital ocean API token.

So there are steps here of how to do that, but I will go through this with you right now. So the first thing is we go back to our digital ocean dashboard here.

And on the left hand navigation, we'll see down at the bottom, there is this API.

We'll click on that.

This will bring us here to our personal access tokens. You can see I have a few already.

If you have not made any tokens yet, you would not see anything here. And then you'll come up to this button, generate new token.

You'll give it a name. So this could be, you know, my, d o backup, token, or whatever you wanna call it, doesn't really matter. That's just for your own records.

I would set your expiration here to No expire. The reason for that is that this script is going to set up not only a separate volume, which it needs to do using DOCTL right now, But it's also going to use this key to do snapshots of your instance every night. And so if this ticket ever expires. If this token ever expires, those backups won't be happening anymore. Those snapshots of the storage won't be happening anymore.

And we do need to check this write permission here because, like I said, it's going to be creating snapshots. That's a write operation, so we need to do that. Then you'll hit generate token.

It will generate it here, and this token is going to be displayed right here, and copy it But this will never be shown again. So if you don't copy this right now and save it somewhere, you know, paste it into notepad or something so you can put it into your digital ocean instance.

If you don't do that, you can never get this back again. So in that case, your only option will be to come here, delete it, and generate a new one, or, hit this regenerate token. When you hit regenerate token, it will invalidate any past tokens. So if you already used this and then you come back and say regenerate, all those old ones will stop working. And it'll issue you a new one. So what we'll do is we'll just copy this.

And, don't worry. The fact that you're seeing my token is fine because I'm gonna delete this as soon as we're done here. But normally, don't let anybody else see this token. And with that, we're gonna go back into here. It explains all those same steps that we just did We're gonna save that somewhere safe. There's a link to their docs if you need those.

And then down here, it says, please authenticate DOCTL for use with your digital account. You can generate a token with the control panel here. Enter your access token. Note.

You will not see what is pasted or typed in. So if I come right here and I hit command v, I don't see anything that it has pasted, and I'll hit enter. It's gonna check if that token was okay, it was, and then we're gonna move on. If I pasted that wrong or I typed it wrong, if I was trying to type it by hand, it would tell me no and ask me again for it.

So you'll get a second chance if you mess that up. But just note, you're not gonna see any text there. Alright. The next question is, what size in gigabytes would you like your new depot volume to be?

This can be increased later, but this can't be decreased.

By default, this is gonna be a hundred gigs. I'm gonna leave it on that for this example, but you could, of course, make this larger if you know for sure. Oh, yeah. I'm gonna put a lot more data in that right away.

Otherwise, you can expand that later on. We have a video on our YouTube channel that talks about how to expand storage, just generally on any Linux instance like this one. So you can go check that out for instructions on that to do later. You'll have to do stuff in the command line again, but it's relatively straightforward.

So I'm gonna leave this on one hundred.

And then you can give a name for this Helix core depot volume. This name has to be unique per digital ocean region. Whatever region your instance is in, you just have to use a name that's unique. And this is the name that Digital Ocean will call this volume.

So if I leave this on the default and hit enter, it's going to create my new volume, And this is using that digital ocean API on the back end. So you can see it's doing some steps here. If I actually go back to my digital ocean account here, And if I go back to my instance, so I just clicked on my project here, if I go to my instance, I click on that, If I look now at the volumes tab on the left, I'll actually see Helix Court Depot. It's created this one hundred gig volume called Helix port depot because that's what I entered up here. So just just to clarify that all this stuff, it's doing that on the back end, the same as you could have done yourself here, but it's just doing that automatically for you.

So it it is worth noting that when it says this name must be unique per digital ocean region, that's unique per region for your account. So not unique globally across all users, but just for yourself.

And, okay, you can see it goes through these steps. The important part is just seeing that it's verified everything completely, What it's doing is it's creating this new volume, setting up the file system on it, and then it's also copying any files that you currently have in your depot. Over onto this new volume so that it will be used and when we start back up, all that data will be there in the new location where it needs to be.

Next, below this line, it explains that a new crontab entry has been created for the perforce user that will create a checkpoint of the database and then snapshot the Helix Court depot volume on a daily basis.

So between the checkpoints and those snapshots, You can restore from a snapshot and then use those checkpoints to restore your server completely from backup if something terrible should happen and and your whole server goes to put.

This script is automatically going to create a new snapshot every night, and it will automatically prune any older snapshots up to a certain number, and that's what we're going to set down below. Down here, it just explains a little bit about snapshots, how you can find those in the Digital Ocean console, and you can edit this maximum number of snapshots it's going to keep later To do that, you actually have to go into your terminal here and edit this text file here, this bash script, to change the Mac snapshots value. That's a little bit more advanced. So ideally, we're gonna pick a number that we like right here.

This also explains a little bit about if you wanna disable this automatic snapshotting altogether, you can edit the cron tab entry and just remove this line here. Again, a little bit more advanced. Let's just talk quickly about pricing for this just so you understand it. So this is as of February twenty twenty four, but, you can check this yourself by going to digital ocean stocks, but volumes cost ten cents per gigabyte, as you can see here.

That's similar to a gigabyte, so I usually just call it that, even though technically, they're just slightly different from each other. So ten cents per gigabyte per month. So if we multiply that by a hundred to get a hundred gigabyte volume, that's ten dollars per month. If I go to the snapshot pricing page, these are six cents per gigabyte per month for droplets and the same for volumes.

So in this case, we're making snapshots of volumes.

So that means that this is gonna be six cents per gigabyte per month per snapshot.

So if you have seven snapshots of a volume, that's a hundred gigs, that's gonna be six dollars per month per snapshot, multiply six by seven. That's forty two dollars per month for all of those. So just keep that in mind, having more snapshots, gives you further back in history if you don't notice a problem for a few days, but it does cost you this six cents per gigabyte. So just keep that in mind.

Definitely keep at least one snapshot just for safety, maybe two or three just so you have something to go back to, just make sure that that you're okay with that cost, and nothing catches you by surprise. And, of course, you could go in and manually delete the snapshot if you needed to as well. So down here, it's asking us to enter the maximum number of snapshots you would like to keep. This must be an integer of one or higher.

So by default, this is gonna be seven, which means we're gonna make a snapshot every day for a week, and then after that week, when we make the next snapshot, it will automatically delete the oldest one of those previous ones, and it'll keep going like that. You could also make this much smaller, like, say only three. If you're like, nope. If anything goes wrong, three days worth of backups is gonna be fine for me.

Either way, you can hit enter here.

And you'll see new drive setup complete. It will give you the volume's name, its size, the mount points, the device ID, some various other information like this. It'll remind you. That you can check this. It confirms here that the latest three snapshots will be stored on digital ocean because three is what I entered up here.

And then down here it explains again about advanced users if you want to disable or change the timing of the automated snapshots, You can edit the cron tab, which you can do by running cron tab dash e in your terminal here, That's a little bit more advanced. Please reach out. Let me know if you want me to cover some more stuff about that. I'll leave a comment on this video, let us know, But, hopefully, you can just leave this. Let it do those backups every night, and then you can come check those in your digital ocean dashboard and just make sure those backups are happening. And, hopefully, if everything goes well, you don't ever have to use them. They're really just there for emergencies.

The last thing it says here is that this script will now prevent itself from being run again. What that means is if I came and tried to run this add depot volume script again, and I hit enter here, it's gonna say no such file or directory. What it's done is it's just renamed the file to something else so that you don't accidentally try and run that again. Just as a little safety feature. But if you ever had to, you could go back and just manually rename it. It's still in the same folder where it was.

So now let's do this. If I type d f dash h, so d f space dash h, This is going to show me all of my disks on my instance and how much storage is on all of them. So I do this, and you'll see that I now have this new mount point here called HX depots that I didn't have before that has a hundred gigs. It's used eight hundred ninety two megs out of a hundred gigs. So I basically have my full hundred gigs left. So you can see I'm using one percent of it. So before everything was just being stored on the root volume, which is much smaller, twenty four gigs in this case, and to increase that is much more expensive on digital ocean, whereas to expand an external storage volume like this is much cheaper.

One thing worth noting here is that from the Digital Ocean console, this shows you the total size of your volume, but doesn't show you how much of it you've used. Similarly in graphs and also in p four admin, you will not see the space on this volume by default. So the way to check that is to Go back into your console again, and then run this command d f space dash h. So in this case, d f is for disk free. I believe is what that stands for.

By default, just d f by itself will show you all of the story space in bytes, which is a little bit hard, at least for me to read as a human. So the dash h makes it human readable. So then it will actually show you in gigs and megs and kilobytes in certain cases. So d f space dash h is a nice easy way to come in here. And just check how much space do I have left. And if I'm starting to run low, that's when you should check out our other video on our YouTube channel about expanding the storage space on your volume. I hope this was helpful, and I will see you again in the next one.

Course - Getting Started with Helix Core - For Admins