Installation: instructions on how to run gitea on another port #819

Closed
opened 2025-11-02 03:37:44 -06:00 by GiteaMirror · 6 comments
Owner

Originally created by @schmittlauch on GitHub (Jun 16, 2017).

  • Gitea version (or commit ref): 1.1.2 (pre-built binary)
  • Git version: 2.12.3
  • Operating system:
  • Database:
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
    • Not Relevant
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

As far as I understand gitea is supposed to create its required directory structure + config file when run for the first time (./gitea web).
If the default port 3000 is already in use, gitea fails before creating these.

side effect: installing gitea, default port 3000 already in use
expected behaviour: ./gitea web detects default port already being in use, nevertheless creates default directories and files, then exits after a port-already-in-use warning
actual behaviour: ./gitea web fails & exits after bind failure, doesn't create files and directories

Interestingly, setting the PORT environment variable also doesn't help: Even when running PORT=3006 ./gitea web the bind failure message still mentions the default port 3000. But this may be another issue.

As a workaround I just created custom/config/app.ini myself using the config/app.ini from this repo.

Log

$ ./gitea web
2017/06/16 19:59:41 [W] Custom config '/home/git/gitea/custom/conf/app.ini' not found, ignore this if you're running first time
2017/06/16 19:59:41 [T] Custom path: /home/git/gitea/custom
2017/06/16 19:59:41 [T] Log path: /home/git/gitea/log
2017/06/16 19:59:41 [I] Gitea v1.1.2 built with: bindata, sqlite
2017/06/16 19:59:41 [I] Log Mode: Console(Trace)
2017/06/16 19:59:41 [I] XORM Log Mode: Console(Trace)
2017/06/16 19:59:41 [I] Cache Service Enabled
2017/06/16 19:59:41 [I] Session Service Enabled
2017/06/16 19:59:41 [I] SQLite3 Supported
2017/06/16 19:59:41 [I] Run Mode: Development
2017/06/16 19:59:41 [I] Listen: http://0.0.0.0:3000
2017/06/16 19:59:41 [....io/gitea/cmd/web.go:702 runWeb()] [E] Failed to start server: listen tcp 0.0.0.0:3000: bind: address already in use
Originally created by @schmittlauch on GitHub (Jun 16, 2017). - Gitea version (or commit ref): 1.1.2 (pre-built binary) - Git version: 2.12.3 - Operating system: - Database: - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - [X] Not Relevant - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [X] Not relevant ## Description As far as I understand gitea is supposed to create its required directory structure + config file when run for the first time (`./gitea web`). If the default port 3000 is already in use, gitea fails before creating these. **side effect**: installing gitea, default port 3000 already in use **expected behaviour**: `./gitea web` detects default port already being in use, nevertheless creates default directories and files, then exits after a port-already-in-use warning **actual behaviour**: `./gitea web` fails & exits after bind failure, doesn't create files and directories Interestingly, setting the PORT environment variable also doesn't help: Even when running `PORT=3006 ./gitea web` the bind failure message still mentions the default port 3000. But this may be another issue. As a workaround I just created `custom/config/app.ini` myself using the `config/app.ini` from this repo. #### Log ``` $ ./gitea web 2017/06/16 19:59:41 [W] Custom config '/home/git/gitea/custom/conf/app.ini' not found, ignore this if you're running first time 2017/06/16 19:59:41 [T] Custom path: /home/git/gitea/custom 2017/06/16 19:59:41 [T] Log path: /home/git/gitea/log 2017/06/16 19:59:41 [I] Gitea v1.1.2 built with: bindata, sqlite 2017/06/16 19:59:41 [I] Log Mode: Console(Trace) 2017/06/16 19:59:41 [I] XORM Log Mode: Console(Trace) 2017/06/16 19:59:41 [I] Cache Service Enabled 2017/06/16 19:59:41 [I] Session Service Enabled 2017/06/16 19:59:41 [I] SQLite3 Supported 2017/06/16 19:59:41 [I] Run Mode: Development 2017/06/16 19:59:41 [I] Listen: http://0.0.0.0:3000 2017/06/16 19:59:41 [....io/gitea/cmd/web.go:702 runWeb()] [E] Failed to start server: listen tcp 0.0.0.0:3000: bind: address already in use ```
GiteaMirror added the type/question label 2025-11-02 03:37:44 -06:00
Author
Owner

@bkcsoft commented on GitHub (Jun 19, 2017):

The only bug I'm seeing here is that PORT=3006 ./gitea web doesn't work. IMO Gitea should not create anything if it fails to start.

@bkcsoft commented on GitHub (Jun 19, 2017): The only bug I'm seeing here is that `PORT=3006 ./gitea web` doesn't work. IMO Gitea should not create anything if it fails to start.
Author
Owner

@schmittlauch commented on GitHub (Jun 19, 2017):

After having a look at gogs' documentation I found that ./gitea web -port 3006 works. This should be added to the gitea docs if it is intended functionality.

IMO Gitea should not create anything if it fails to start.

Having successfully installed gitea now I tend to agree. It could be helpful to make the error message more helpful with adding instructions on how to run gitea on another port, at least if all signs point to "probably an installation", though.

@schmittlauch commented on GitHub (Jun 19, 2017): After having a look at gogs' documentation I found that `./gitea web -port 3006` works. This should be added to the gitea docs if it is intended functionality. > IMO Gitea should not create anything if it fails to start. Having successfully installed gitea now I tend to agree. It could be helpful to make the error message more helpful with adding instructions on how to run gitea on another port, at least if all signs point to "probably an installation", though.
Author
Owner

@Avalancs commented on GitHub (Jun 21, 2017):

Hi schmittlauch, I had a similar dilemma when first starting out with gitea, but using gitea help and gitea help web I could discover this parameter. I agree that it should be part of the wiki, and also the change you requested :)

@Avalancs commented on GitHub (Jun 21, 2017): Hi schmittlauch, I had a similar dilemma when first starting out with gitea, but using `gitea help` and `gitea help web` I could discover this parameter. I agree that it should be part of the wiki, and also the change you requested :)
Author
Owner

@bkcsoft commented on GitHub (Jul 4, 2017):

custom/conf/app.ini does not get created before you've completed the installation page

@bkcsoft commented on GitHub (Jul 4, 2017): `custom/conf/app.ini` does not get created before you've completed the installation page
Author
Owner

@techknowlogick commented on GitHub (Jun 27, 2018):

Closing this as above PR has been merged.

@techknowlogick commented on GitHub (Jun 27, 2018): Closing this as above PR has been merged.
Author
Owner

@s-bauer commented on GitHub (Aug 30, 2019):

@techknowlogick Why not add this to the docker container by default? I think there is no security concern doing so!
I'm currently using the following to get everything working:

FROM gitea/gitea:latest


RUN apk --no-cache add libcap
RUN echo "setcap 'cap_net_bind_service=+ep' /app/gitea/gitea" >> /etc/s6/gitea/setup
@s-bauer commented on GitHub (Aug 30, 2019): @techknowlogick Why not add this to the docker container by default? I think there is no security concern doing so! I'm currently using the following to get everything working: ``` FROM gitea/gitea:latest RUN apk --no-cache add libcap RUN echo "setcap 'cap_net_bind_service=+ep' /app/gitea/gitea" >> /etc/s6/gitea/setup ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#819