Self Hosting Gitea On TrueNAS Scale With Working SSH Access

linkedinLinkedInredditReddit

This tutorial covers how to configure a Gitea instance on TrueNAS Scale with SSH functioning properly for server communication. As of the time I’m writing this tutorial, there are problems with getting SSH working when deploying Gitea using the TrueCharts catalog. I’ll update this tutorial when I’ve worked out how to resolve the SSH related issues with the TrueCharts install.

Before We Begin

A few quick things to note.

Create A Data Storage Location

Before you can create a Gitea container on your TrueNAS Scale server, you first need to create a dataset to hold it’s data. You can put it on any pool your like and name it whatever you like so long as you know where it is you’re storing your data.

You can see in my screenshot, below, that I’ve named my dataset gitea.

Create A Dataset For Gitea
Create A Dataset For Gitea

Docker Image Wizard

Starting off inside TrueNAS, go to the APPLICATIONS DASHBOARD by clicking APPS in the left side navigation. Then, from the dashboard click the blue LAUNCH DOCKER IMAGE button.

Applications Dashboard
Applications Dashboard

Application Name

Enter a name for your application – I’ve chosen gitea. Click the NEXT button to continue.

Applicatoin Name
Applicatoin Name

Container Images

In the field labeled Image repository enter gitea/gitea. Click the NEXT button to continue.

Container Images
Container Images

Container Entrypoint

Click the NEXT button to continue.

Container Entrypoint
Container Entrypoint

Container Environment Variables

Here we need to create two environment variables for our Gitea container. Click the ADD button twice. Name your environment variables USER_UID and USER_GID and give each a value of 1000. Click the NEXT button to continue.

Container Environment Variables
Container Environment Variables

Networking

Click the NEXT button to continue.

Networking
Networking

Port Forwarding Configuration

Gitea uses two ports internally that need forwarded – 3000 for HTTP and 22 for SSH. Click the ADD button twice.

For the first port forward, enter 3000 as the CONTAINER PORT then choose a NODE PORT value of 9000 or higher to use as the external port that you’ll use to access Gitea. I’ve chosen port 9000.

For the second port, enter 22 as the CONTAINER PORT then choose a NODE PORT value of 9000 or higher for SSH. I’ve chosen port 9022.

Click the NEXT button to continue.

Port Forwarding
Port Forwarding

Storage

Next you need to specify where your Gitea data will be stored. Click the ADD button that corresponds to HOST PATH VOLUMES. Find the dataset you created at the beginning of this tutorial then enter /data as the MOUNT PATH.

Click the NEXT button to continue.

Storage
Storage

Workload Details

Click the NEXT button to continue.

Workload Details
Workload Details

Scaling/Upgrade Policy

Click the NEXT button to continue.

Scaling/Upgrade Policy
Scaling/Upgrade Policy

Resource Reservation

Click the NEXT button to continue.

Resource Reservation
Resource Reservation

Resource Limits

Click the NEXT button to continue.

Resource Limits
Resource Limits

Portal Configuration

Click the NEXT button to continue.

Portal Configuration
Portal Configuration

Confirm Options

Click the SAVE button to create and start your Gitea container.

Confirm Options
Confirm Options

Once TrueNAS Scale has retrieved the container image from Docker Hub, the running application will appear like this on the APPLICATIONS DASHBOARD. You’re ready now to complete the setup via the Gitea Initial Configuration wizard.

Applications Dashboard - Running Gitea Container
Applications Dashboard – Running Gitea Container

Gitea Initial Configuration

To access your Gitea server, open a browser to the IP address of your TrueNAS Scale server and the port you specified. For example, on my test system the URL for my Gitea server is http://172.16.10.21:9000/.

When the page loads you’ll be presented with an INITIAL CONFIGURATION WIZARD. Skip past the DATABASE SETTINGS and go right to the GENERAL SETTINGS. I’ve highlighted the settings you either need to modify or should consider modifying.

Start by setting the SITE TITLE to whatever you’d like your Gitea site’s title to be. Next, change the server domain to be your TrueNAS Scale server’s IP address. For my example I’ve entered 172.16.10.21.

Gitea Initial Configuration - Part 1 of 2
Gitea Initial Configuration – Part 1 of 2

Next, modify the SSH SERVER PORT to match the external port you specified earlier. For my example I’ve entered 9022. Be sure the GITEA HTTP LISTEN PORT to set to 3000 as this corresponds to the internal port that Gitea uses. Now modify the GITEA BASE URL replacing localhost with your server’s IP address and the external port you specified earlier in the tutorial. For this example, I’ve entered https://172.16.10.21:9000/.

Under the heading OPTIONAL SETTINGS you can specify SMTP email server settings if you want your Gitea server to be able to send mail via a SMTP account you own. There are additional settings you should review under SERVER AND THIRD-PARTY SERVICE SETTINGS – such as being able to disable self registration for new accounts.

While the other optional settings are absolutely optional, I highly recommend you make sure to create an ADMINISTRATOR ACCOUNT at this time using the provided fields.

Once you’ve completed the wizard click the green INSTALL GITEA button.

Gitea Initial Configuration - Part 2 of 2
Gitea Initial Configuration – Part 2 of 2

Possible Error After Initial Configuration

After you’ve completed the initial configuration, the page will attempt to reload and you might experience an error when it does. If this happens, DON’T PANIC. Try loading the root URL itself without any directories and it should load fine.

Adding SSH Keys To Gitea

Once you’ve logged into the system, you can add your own SSH certificate to your account to allow for this method of accessing your repositories. If you need help with how to accomplish this, I have created a brief tutorial that shows you how this is done.

Conclusion

Congrats! You should now have a working Gitea instance on your TrueNAS Scale server. If you found this review helpful and would like to support my efforts to create additional resources like this, please consider a subscription for just $5 per month or a one time donation via the “Buy Me A Coffee” button on this website. It looks like a travel mug in the corner of the page – you can’t miss it! Your support is greatly appreciated!

If you can’t make a donation, please consider sharing this review with others who may be interested. If you have questions about anything regarding this review, please be sure to leave them in the comments below. Thanks for reading, and I hope you visit again soon!

linkedinLinkedInredditReddit

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

I accept the Privacy Policy