Gitea Windows service does not see users/repos/oranizations


#1

HI, I am prototyping Gitea (1.6 windows binary) for a small development team and have been running it from the command line with
.\gitea-1.6-windows-4.0-amd64.exe web

I have created repositories/organizations and can use pretty much all of the features with no problem.

Except when I register and start Gitea as a Windows service, the Gitea service instance cannot see any of my repos/organizations that I created while running off the .exe from the command line. At first I thought that that I had overwritten my database, but I could stop the service, startup Gitea with the above command and all my work is back (users/repos etc.).

As near as I can tell both instances use the same “custom/conf/app.ini” configuration with the same root repository location and database file, etc. I even changed the log level and looked at the output when starting both ways (service vs. command-line) and the session ID’s even match.

Command Line:
2018/11/26 13:26:44 [I] Log Mode: File(Debug)
2018/11/26 13:26:44 [I] XORM Log Mode: File(Debug)
2018/11/26 13:26:44 [I] Cache Service Enabled
2018/11/26 13:26:44 [I] Session Service Enabled
2018/11/26 13:26:44 [I] Mail Service Enabled
2018/11/26 13:26:44 [I] Git Version: 2.19.1
2018/11/26 13:26:44 [I] SQLite3 Supported
2018/11/26 13:26:44 [I] Run Mode: Production
2018/11/26 13:26:44 [I] Listen: http://0.0.0.0:3000
2018/11/26 13:26:57 [D] Session ID: 7ca6a7bdb5534601
2018/11/26 13:26:57 [D] CSRF Token: 8oC-O8P2DGuO2wAJITFxe33gg-Y6MTU0MzI2NDgwODM5Nzk1MjAwMA==
2018/11/26 13:26:57 [D] Template: admin/config

Windows Service:
2018/11/26 13:29:02 [I] Log Mode: File(Debug)
2018/11/26 13:29:02 [I] XORM Log Mode: File(Debug)
2018/11/26 13:29:02 [I] Cache Service Enabled
2018/11/26 13:29:02 [I] Session Service Enabled
2018/11/26 13:29:02 [I] Mail Service Enabled
2018/11/26 13:29:02 [I] Git Version: 2.19.1
2018/11/26 13:29:03 [I] SQLite3 Supported
2018/11/26 13:29:03 [I] Run Mode: Production
2018/11/26 13:29:03 [I] Listen: http://0.0.0.0:3000
2018/11/26 13:29:11 [D] Session ID: 7ca6a7bdb5534601
2018/11/26 13:29:11 [D] CSRF Token: 8oC-O8P2DGuO2wAJITFxe33gg-Y6MTU0MzI2NDgwODM5Nzk1MjAwMA==
2018/11/26 13:29:11 [D] Template: admin/config
2018/11/26 13:29:18 [D] Session ID: 7ca6a7bdb5534601
2018/11/26 13:29:18 [D] CSRF Token: 8oC-O8P2DGuO2wAJITFxe33gg-Y6MTU0MzI2NDgwODM5Nzk1MjAwMA==

I am running Gitea on Windows Server 2012 and using the built-in sqlite3 db. Any help would be appreciated. Ideas?


#2

I solved the issue which is related to this thread: https://github.com/go-gitea/gitea/issues/821

After setting the absolute path to the gitea.db file “C:\gitea\data\gitea.db” instead of the relative path that gets set on the initial config from the web interface, Gitea finds the correct database when it starts up as Windows servcice. I believe this is because Windows services use system32 as the working directory so if you initially setup Gitea from another user account (and from that user’s working directly) it won’t be able to find your database file using the relative path.

[database]
DB_TYPE  = sqlite3
HOST     = 127.0.0.1:3306
NAME     = gitea
USER     = gitea
PASSWD   = 
SSL_MODE = disable
PATH     = C:\gitea\data\gitea.db

[repository]
ROOT = C:/git