I Built the PERFECT Game Server with Pterodactyl and Docker

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
i've been on a quest trying to build the perfect game server one that lets me host games like minecraft valhem counter-strike team fortress 2 terraria and more i wanted one with a management panel that allows me to quickly spin up new game servers and tear them down one that i could use to see logs and quickly issue commands and also one that's user friendly secure can scale and while we're at it throw in free and open source and make it docker to the core and that's when i found pterodactyl pterodactyl is a free and open source game management panel that is built on a modern stack it's designed with security in mind and runs all games and servers isolated in docker containers it has a user-friendly ui that lets you quickly create game servers monitor their status issue commands add users edit and modify game server files and much much more it supports games like minecraft russ terraria team fortress 2 counter-strike garry's mod arc factorial grand theft auto risk of rain 2 satisfactory space engineers and many many others and with all of this functionality comes a little bit of complexity but there's some terms we'll have to talk about pterodactyl is made up of a few parts first we have a pterodactyl server which is actually a game panel this is where you configure your server and your games next we have wings wings are really the control plane for all of your nodes and nodes are just servers so each of the servers run the wings agent and this is how games are deployed to your server nodes i say server knows because you can actually have more than one each node that has the wings agent installed on it can have game servers deployed to it we're going to stick with one node but it's easy to expand later next going down this turn tree we have nests yes play along with this metaphor for a minute nest are really a collection of individual games for most games you will have one nest but multiple games can belong to a nest games are called eggs yes eggs eggs are a combination of a game in configuration and like i said you could have multiple in one nest take for instance minecraft you may have a nest called minecraft but multiple eggs like bedrock paper vanilla or other variations of the game okay here's one more bird metaphor and then we're done it's yolks seriously yolks yolks are a pre-built docker image that work with eggs these are the images that will run inside of our nodes so to recap pterodactyl is a panel that you can add one or more nodes that run the wings agent and works with docker to create game servers of which are part of a nest that includes one or more eggs and that egg container image is a yoke hopefully you got all that because there will be a pop quiz at the end this has traditionally been challenging however over the last week i've put all of this together using docker and would love to share it with you so today we're going to set up pterodactyl panel using docker we're going to get the panel up and running with a mariadb database a redis database for caching and working with the reverse proxy so we can do all of this securely we're then going to set up and configure docker wings agent on our nodes so we can deploy game servers to it then we're going to set up and configure games like minecraft counter strike terraria team fortress 2 and even belgium which gives you a great start to the perfect gaming server so what do we need to get started we need two servers both that can run docker one for our panel and one to run all of our game servers if you're running containers already somewhere else like fortener or even kubernetes that will work great for your panel so all you need is another server to run your games we'll need to remote into our first server the one that's going to run the panel once we're in here we'll want to create a folder for pterodactyl and then once we're in here i'm going to create a folder called panel and then in this folder we're going to create a docker compose file and in the docker compose file goes this file right here so this is our daca compose for the panel service as you can see this stack does quite a bit a lot of this are the default settings and some of it is tweaking that i had to do to get this to work but i did mention that we'll need two databases one mariadb and another redis for caching and this stack includes that so you don't need to worry about that but if you have those databases somewhere else you can supply credentials for them but if we look at the stack we're just doing some configuration here we're setting up our database passwords and credentials we're setting up some additional environment settings here this app url here you'll want to make sure it points to the app url when this is hosted so i mentioned we're going to put this behind a reverse proxy it's kind of important you don't have to but i highly recommend doing it need help setting up a reverse proxy i've got a couple guides on them so check those out but this is going to be the https endpoint that this is hosted on this is only hosted internally you can see it's gameserver.local.tektronik.us then you'll want to make sure you set the timezone and this is the time zone of the server if you're using utc you can put utc or if you're using a time zone based on location you can set that then we'll set an email for the app service author this isn't too important right now but what is really important is this trusted proxy this took me a while to figure out so if you're putting this behind a reverse proxy you'll want to make sure that you set your trusted proxy now this will be the ip address of your reverse proxy if you're having troubles like i did in the beginning you can say that all proxies are trusted as you can see i did with the star it's a wild card but i would highly recommend replacing this star with the ip address of your reverse proxy if not you'll have a lot of problems like i did next you can set up mail i didn't set this up but this is nice and handy so that if someone that's using your panel needs to reset their password it will email them a reset link i'm the only one using this panel so i'm not going to configure it but nice to know it's there next below you'll see some more configuration for our services as i mentioned we're going to set up mariadb we're going to map some volumes to where that data lives we're going to set up some username and passwords you should probably change this we're going to use this for now but this is going to create a database with the use of pterodactyl and it's going to use our password from above then it's going to set up a redis database so redis is a in-memory database key value pair it's used for mainly for caching but a lot of other things super high performance and pterodactyl uses this next we're going to expose some ports so we're only going to expose 80 and 443. technically i think we only need to do 443 but we're going to expose them both then we're linking both our database and our cache setting up some volumes and then setting up some more configuration for our database and our environment and then setting up a network for these to communicate on so you'll want to tweak these to your liking but i would highly recommend just copying and pasting mine from the documentation and you can find that in the description below so let's paste this in our docker compose and save it then let's spin this up using docker dash compose up dash d dash dash force dash recreate and if you're having problems with docker dash compose i think in the latest version they've split them out to say docker space compose but if you're using an older version and upgraded i think they created an alias for you anyways let's spin this up so it created our database our mariadb database then it created our cache or redis cache and then it created the panel so now we should be able to go out and see our panel and now if you go out to the pterodactyl panel we have a sign in awesome so what's our username and password no clue because we didn't set one so in order to set one we actually need to go back to our server and we need to run a command it's this docker dash compose run dash rm panel php artisan and then p user and then mac or make so this will actually exact into that pod and initiate a command so we can create a user so let's do that first question isn't it administrator yes then we'll enter an email address then we'll enter our username then we'll enter a password now we should be able to log into the panel and we got signed in this is our dashboard we don't have any servers yet so we need to create some but let's check out the settings first if we go into settings we can see an overview of all of the settings you can see things like obviously settings application api if you want to use their api database location nodes which we'll set up here in a little bit servers users mounts and nests so the first thing we want to do is actually set up one of our nodes or one of our servers not a game server but a node or a virtual machine or a physical machine that will end up running our game servers so let's start that process first first you think you go into nodes but as soon as you try to create one it says we need to create a location first so let's create a location so a location can be a physical location a virtual location or really anything to help group your servers together i'm just going to call this one home once we create our location then we can create a node so to create our node the first thing we want to do is give it a name now i'm just going to give mine the same name of the node the fully qualified domain name which brings us back to our fully qualified domain name so here i'm going to set the same thing here and so this is where it gets a little bit complicated and where i went off in the weeds earlier this week and so we want to communicate over ssl for obvious reasons and if your panel's running ssl your nodes will also need to be running ssl for the agent for that endpoint it's a little bit tricky here but you want to choose use ssl connection obviously and then you'll want to say you're behind a proxy you'll need to choose that this is behind a proxy otherwise when the wings agent starts up it'll try to look for some certificates that it generated that aren't going to be there so basically telling it it's behind a proxy says hey we're going to supply certificates for you but still use ssl that's the way i understand it so make sure you choose behind a proxy and if you're doing this without certificates just to test it out you would set these both to use http and you're not using a proxy anyways took a while for me to figure that out next we'll need to set the total memory for this node and this is how much memory the node can use i'm going to say mine can use 10 gigs and i'm going to say the memory over allocation is zero next is how much disk space this node will use i'm setting mine to 100 gigs now that seems like a lot but some games that we're going to install can be really big so this is really going to be up to you i would go higher and give this machine more disk space than you ever think you're going to use because some game servers are really big and i'm going to do the same thing the disk over allocation is zero and the daemon port this is where i got tripped up quite a bit quite a bit so traditionally you would set the daemon port to 8080 but i found that with this combination of using ssl saying i'm behind a proxy using my own reverse proxy i need to set the daemon port to 443 sounds kind of weird but i actually do need to do it i mean it makes sense if you're saying https but i thought i could map it in my reverse proxy to 443 and then have it switch and use a port of 8080 but we actually have to use this port in the week's agent that you'll see here in a second anyways if you're doing this behind a reverse proxy like i am i would highly recommend using 443 otherwise you're gonna go crazy okay so now we can create this node but before we do we actually need to install the agent on that node the wings agent wings ah so this is going to be on our second server now and i promise it gets a lot easier after this this is the hardest part of this whole entire setup and i probably spent a good five six hours trying to figure this out so we'll want to remote into the server where our games will be running remember the one that's running the wings agent and we'll want to make a folder called pterodactyl and then we'll cd into that directory and then we'll make a directory called wings and then we'll cd into that directory and you should see we don't have anything in here so what's going to go in here well a docker compose file so what's going to go in that docker compose file are wings agent so this is our wings agent and this is what we'll be pasting into that docker compose file this one's a lot smaller than the other one but really what it is is an agent that exposes some ports that allows communication between the server and the node to deploy games to it and so pretty high level what we're doing is exposing some ports setting some environment variables setting a username that's the same one that should match on the server panel mapping some volumes and setting up some networks okay so let's copy this file and let's paste it into here let's close out of there then let's bring our agent up and if we check our docker logs we see some errors but this is kind of normal because we didn't add a configuration file which is a good segue into creating our configuration file here in a second so let's go back into the server now and we have this form partially filled out let's make sure everything's good name public name use ssl behind a proxy memory set disk space set and our ports are set so now let's create a node so it doesn't look like anything's happening so let's go to nodes and we can see here that our node is listed but we can see this heart not sure why it's a heart but this is not a good sign you should see a green heart not a red heart so it can't connect to our node because we need to create a configuration for it so let's drill into this node let's go into configuration and here's our configuration for this node to be able to connect to our server so we should see some hints of what we configured we can see here that our host is going to be localhost or all ips on this machine but we're saying the port is 443 and we see that ssl enabled is false this is what i was talking about earlier we don't want to supply our own certificates because we're behind a reverse proxy and then we're seeing some additional ports so sftp so it can transfer data to the server and then allow mounts we don't need to worry about that and then remote so this is where our server panel is this should be pointing to your server panel and it should be https so let's copy this configuration and it says it needs to go into etsy pterodactyl in a file called config.yaml so let's go back to our server and do that so let's cd into etc paradoctyl let's see pterodactyl do an ls we don't see a config here so i actually need to do a sudo nano config dot yml or yaml paste the contents in here save this exit then let's recreate this container and after it's recreated let's do a docker logs for this container and now we actually see a good sign so some good logs so let's go back to our server panel now if we go into nodes we now have a green heart so this is a good sign if you make i shouldn't say if when you make it to this point this means you're at a good point if you don't see a green heart i wouldn't do anything else until you make this heart green it's kind of confusing but take it slow and make sure you have everything filled out properly and if you're behind a reverse proxy make sure that those dns entries are actually served out through https so this is a good sign let's go into our node now so now it can communicate with this node again no good sign next thing we need to do is assign allocations i had no idea what this was until i started using this but basically we need to set aside a block of ports that we can use on the server to run our game servers and we need to assign those to an ip address so what we need to do here is put the ip address of this node it's actually hard to figure out what ip address you need i mean after i got it working and i explained it the way i just did it makes sense but everyone says put in the ip address of your server and in my head i think the panel's the server no you put in the ip address of this node that we're going to configure and for ports you're going to want to use a block of ports for your servers now most game servers are going to have one two three four five ports and then you multiply that by all of your games you can go as far and as wide as you want so i typically pick 27 000 to 27.0999 so that gives me 100 ports so i'm saying hey this server is going to host games on ports 27 000 to zero 27.000 nine and if you need more ports than that feel free to add more and you wanna pick ports that are in a higher ranged ones that aren't typically used but since this node isn't doing anything besides running our games and running this wing's agent we shouldn't have any conflicts with any ports so it's a safe bet 27 000 to 27099 and we'll submit this and then once we submit this we can see okay now this ip address you see right here this ip address which is this node has assigned a port of twenty seven thousand and it has a port of twenty seven thousand one and this becomes important here a little bit when we start our servers which is a great segue into configuring our first game server everything we did up until now was is pretty challenging everything else is super fun so let's get into that let's create our first server so we want to create a game server what game server do we want to create so if we go down here to our nest configuration you can see our nest is minecraft this is what i was talking about earlier you have a nest and you have eggs so the nest is minecraft an umbrella of minecraft and under that are different flavors of minecraft let's pick vanilla minecraft and say that this server is going to be minecraft so let's scroll back up and name this i'm going to name this minecraft vanilla the server owner you'll always need to assign this i forget to pick myself every time but sign the server to someone then you're going to allocate this to a server this is why we created allocations so we have our game server node right here it's already selected and then we have allocations these are the ports we're going to assign them to and you can see i have 100 ports to choose from i'm going to choose the first one makes it a little bit easier you can assign additional allocations if for some reason this server needs additional ports but we don't need that for minecraft next are database limits allocation limits backup limits i don't have any of that set so i'm not going to touch any of that now we have some resource management for this container really i'm going to set up only a couple of things i'm going to say that this minecraft server can use up to a gig of ram zero swap and then i'm going to actually say it can use 2048 two gigs of disk space now like i mentioned earlier some servers are going to use a lot more disk space and some are going to use a lot less you can configure this now if you see that your server won't start because it's out of disk space just bump this up a little bit restart it and it should run fine but now that we have that going i should be able to say create server and if we go into this tab right here this pop out we actually can see our server is starting up so this server starting up i didn't pick the java image you should most likely pick the latest version of java for this so let's click update docker image to the latest java it's nice it prompted me should have picked it to begin with because i think it was on java 6. next it's going to ask you for the ula for minecraft this is typically hard i think you'd have to create some text file or set some environment variables they're asking you right here which is super nice say accept pulling those images down starting our minecraft server now it's preparing our world and you can see we get some stats down here the memory usage some cpu usage that's nice we can see over here ram disk space super nice if you don't see these charts down here there's a quick fix you need to add a line to your grub entry and then update your grub i'll have that in the documentation just in case it took me another 45 minutes to hunt down and figure out so i'll have that in the documentation if you don't see this but most likely you should all right our server is now running awesome well it was running and then it finished everything and then it now prompted the java update so it's going to run that really quick pick the latest version of java if you do this and you won't run into that but this should go fairly quick because i think everything was already cached so it did crash once and i think it's because i didn't give it enough ram so let's actually kill this and do this really quick i can show you how that works go back to our server settings go back to our servers choose minecraft go into our build configuration let's give it two gigs of ram let's update that and while we're at it let's change our docker configuration to say it's 17 to begin with save modifications then let's pop back out let's start it back up now we can see we have two gigs of ram and it started with open jdk 17 so off to a good start should have did that from the beginning okay now the server is running and it's green so let's connect to it so let's launch the client say play now we have the client running let's say multiplayer let's edit the server because i already tested one and what's our ip address it's right up here it's being served out through 192 168 30.33 and it's on port 27 000. so let's say done and let's try to connect we look at the logs we could say hey techno tim logged in and joined so now i'm actually on this server that we're self-hosting awesome so there's minecraft easy enough now let's choose a different server let's disconnect we can see we're disconnected and now let's create a new server go into servers and let's create a new one and let's go down and see what else is available so it looks like we only have a few servers here but actually we have more because these are more like engines or nests if you will but under source engine we can see that we have a lot of eggs because these are all based on the same type of server so we can spin up arc counter strike gary's mod insurgency or team fortress 2. so let's what should we do team fortress 2 or or counter-strike let's go team fortress 2 probably not a popular opinion but let's do that so let's say it's tf2 server owner is going to be me and here we go again with allocations that node the only node i have and a new ip address 27001 so that's enough for there memory i'm going to give this more memory i'm going to give this 4 gigs and disk space this actually needs quite a bit of disk space so i found this needs around 12 or 13 gigs of disk space i'm going to give it that number because i found that works that's kind of the minimum but it needs a lot of disk space for it then we'll see some additional settings down here the game id we don't need to change this and the default map we can change this if we want so we should be able to create a server now and if we go into servers now and we can see team fortress 2 we'll pop out to the console and we can see this is downloading and extracting so this is going to take some time and this is actually pretty cool because it uses steamcmd to download the game anonymously from steam pull it down extract it and start your server so while that's going let's start up another one so what do we do if we need to add a custom game as we saw we can create new servers and we can see here that we have a limited amount of games don't get me wrong it's a decent amount but what happens if we want to add more wow the community has built tons of nests with tons of games and it's actually really cool so if we go out to this github repo parker vcp eggs will find a lot of eggs and in here we can see different eggs for games so if we go into game eggs we can see we have a lot of a lot of eggs here a lot of servers among us beaming factorio minecraft terraria and a ton of other ones too and there's actually more nested within the steam folder so steam cmd folders if we go into there these are a whole bunch more of steam games that launch with steam cmd that they've already configured for us so arma seven days to die left 4 dead left 4 dead 2 quake starbound team fortress 2 classic the forest tower unite valheim and more so let's actually pick one i'm going to pick something totally different and i'm going to pick terraria so within terraria this would be our nest and in here we have different eggs so we have t-mod loader t-shock and vanilla let's grab vanilla so what we need to do here is actually just copy this json right here so if you see each server name is a json file we go into there we have the json so let's actually copy this json let's create a new file i'm going to name this terraria.json and in here i'm going to paste that json and save it now that we have that saved let's actually go back to our server and then back in our server instead of going into servers let's actually go into nest so let's create a new nest you can see the ones that we had here already so let's create a new nest i'm going to name this terraria and save it that doesn't give us a game that just gives us an umbrella a nest for all of our eggs what i usually do now because i'm not sure what to do here i go back to nests again and then i say import an egg so let's import an egg and let's find that json file we just created and here's the file we created terraria.json and then it's going to ask us which nest we want to associate this egg with so i'm going to choose terraria here import and now we have it so now if we go into nests we see it here and we can see our nest in our egg here's our egg down here so let's create a server now for terraria so create new terraria name this vanilla server owner is me allocation again is the one server node we have on these ports then we're gonna set the memory i'm gonna give this a gig of memory and disk space i'm gonna give this two gigs of disk space i don't think it needs much now we'll choose our new nest of terraria didn't spell array and then choose our egg which is vanilla and now you'll see we have some additional configuration and this comes from that json file so i can set the version i want i'm going to set it to latest in i can name the world if i'd like how many max players the world size difficulty and a message of the day but i'm not going to set any of that let's create a server now this is installing let's check the panel we can see it's pulling all of that down so while that's going let's go back and check on team fortress 2. so let's go into servers team fortress 2 and go back to our panel and it looks like that's all ready to go and you can see my public ib address but i'll hide that here in a little bit but team fortress 2 is ready to go so let's launch it and i just realized hopefully my music wasn't too loud this whole time i've been recording i think i've been playing music in the background too so i apologize i don't know i'll figure it out rookie hour anyway so now let's join this server actually let's collapse this down a little bit let's take it out of full screen mode let's go into windowed run in a window okay okay just going to make this a little bit smaller so we can see it while we play okay let's go to find a game community servers created a server let's connect we can already see i connected to the server here cool it also woke up from hibernation so it must stay in a low power state it's vax secure for any cheat so this might take a second the first time you launch it and here we go we're connected continue choose blue sure you can engineer and here we go so i'm in my server pretty lonely it's just me but you get the idea okay so let's stop this game disconnect and leave it saw us leave and now it says it's hibernating pretty awesome and let's go back i think terraria should be done because that's a pretty small game so terraria pop out to the console we're up and going so it's twenty seven thousand zero zero two the server started okay so let's go into multiplayer join vip is going to join me and here is my server found my server connected and we are connected now i can't get this into windowed mode so you're gonna have to trust me that it was connected uh we are connected to the server for some reason torreira is being weird and i can't get it into windowed mode i think it's an older game so but you can see i'm playing on my own server right now and uh yeah this is pretty pretty awesome okay so we've connected to three different servers and things are looking really good so i mentioned valeem a pretty popular game we can spin up a valheem server pretty easy too if we go back to that repo of eggs and we go to steam cmd servers we can see here at the bottom that we also have valheem and we can choose either plus or vanilla so let's choose vanilla copy this create a new file balahim json paste this json in here save this awesome i'm getting a captcha on my own server pretty awesome i didn't mention capture but it does have captcha it comes with the default captcha set uh based on the server i highly advise if you're going to make this public to change that captcha based on your own captcha for your own account and while i'm talking about it i might as well show you where it is if we go into settings and settings again we go into advanced here's your secret key and here's your captcha you just have to go out to google get a new site key and get a new secret key paste it here but pretty cool they have captcha no idea why i didn't appear human well if you've seen some of my earlier videos i didn't appear human either anyways so let's go into servers no let's go into nests create new say valheim import choose valheim into valheim create a node create a create a server new server valheim write allocations 4096 forty eight zero valen there we go now i have it set and here we have some additional configuration again server name password app id whether it's dedicated or not auto update beta password which branch you want on we'll create this server because that's all good for me the owner id field is not said i thought it was going to make it through this without forgetting that but there we go and let's set that create server go to our panel or console and here it is being created as we speak the other cool thing while we're in here i should talk about a little bit is you also have a file manager you can go well once it's done installing let's go into minecraft that's probably a better example if we go into our servers and then say minecraft and then go into a terminal or a console we can see we have a file manager here and we can go and modify and edit any of these files that are here like this json file doesn't have anything here but if we had band players and we wanted to add a band player like techno tim we could and we could end me from not ever joining or modify any of these files really is the important piece here but you can explore the file system within that container and make modifications super super duper cool so you can upload create new files or modify existing um we also have some additional settings here databases i don't use this schedules i don't use this either um users backup network startup and settings so a lot of configuration that we can apply to these servers which is really really cool and yet another reason why i wanted a system like this to be able to manage this so that if i ever give someone else access to the server i don't have to tell them how to use docker commands or ssh into my servers i can give them access to this panel and they can issue commands right here if they wanted for minecraft who issue specific commands or any server that's where it gets really cool so let's check on valium it looks like it's running so awesome it's up and running we have some cpu usage and some memory usage so pretty awesome if we go back out and pop into our server itself by clicking on pterodactyl we get a dashboard of all of our servers here so pretty awesome so what do you think of pterodactyl do you think it's overly complicated do you think it has a nice ui are you gonna use it let me know in the comments section below and remember if you found anything in this video helpful don't forget to like and subscribe thanks for watching this morning i was i was kind of thinking the same thing like i want to shift some stuff around i usually do like i was talking about my chin bro case earlier like that was my test bed for quite a few things um and uh i i was i have this urge to kind of shift some stuff around and you mentioned ted gigg and you also meant mentioned uh bare metal june ass those are the things that have been going through my head uh the last uh i'd say the last two weeks uh maybe maybe i will maybe i won't we'll see but uh
Info
Channel: Techno Tim
Views: 93,991
Rating: undefined out of 5
Keywords: techno tim, technotim, pterodactyl, docker, docker gaming, docker server, homelab, self-hosted, selfthosted, game server, dedicated game server, gaming server, gaming, steamcmd, steamcmd docker, open source, game panel, free, rust, terraria, tf2, team fortress 2, valheim, ark, garry's mod, factorio, GTA, csgo, counter strike, home server, dedicated gaming server, hosting, game server hosting, software, image, container, minecraft, managment, wings, nodes, nest, egg, yolk, node, agent, pterodactyl game server
Id: _ypAmCcIlBE
Channel Id: undefined
Length: 33min 30sec (2010 seconds)
Published: Sat Apr 30 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.