go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.43k stars 5.43k forks source link

easier installation #31324

Open ralyodio opened 3 months ago

ralyodio commented 3 months ago

Feature Description

THe docker-compose method seems buggy, I get permission denied errors.

Please provide a working docker-compose.yml file and Dockerfile that is needed to get gitea working behind an nginx proxy.

Screenshots

No response

lunny commented 3 months ago

You can find Dockerfile in this repository root directory. What's the error log? Sometime it's a real permission problem which cannot be resolved by the docker-compose file.

ralyodio commented 3 months ago

I do not see a docker-compose.yml file in the root can you point me to it?

lunny commented 3 months ago

You can find an example in https://docs.gitea.com/installation/install-with-docker

ralyodio commented 3 months ago

what's the diff between docker and rootless docker?

ralyodio commented 3 months ago

so i copied and use this:

version: "3"

networks:
  gitea:
    external: false

services:
  server:
    image: gitea/gitea:1.22.0
    container_name: gitea
    environment:
      - USER_UID=1000
      - USER_GID=1000
      - GITEA__database__DB_TYPE=mysql
      - GITEA__database__HOST=db:3306
      - GITEA__database__NAME=gitea
      - GITEA__database__USER=gitea
      - GITEA__database__PASSWD=gitea
    restart: always
    networks:
      - gitea
    volumes:
      - ./gitea:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      - "3000:3000"
      - "222:22"
    depends_on:
      - db
  db:
    image: mysql:8
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=gitea
      - MYSQL_USER=gitea
      - MYSQL_PASSWORD=gitea
      - MYSQL_DATABASE=gitea
    networks:
      - gitea
    volumes:
      - ./mysql:/var/lib/mysql

I get the error:

$ docker-compose up                                                                                                                     
Recreating 2b277680206d_gitea_db_1 ...                                                                                                  

ERROR: for 2b277680206d_gitea_db_1  'ContainerConfig'                                                                                   

ERROR: for db  'ContainerConfig'                                                                                                        
Traceback (most recent call last):                                                                                                      
  File "/usr/bin/docker-compose", line 33, in <module> 
lunny commented 3 months ago

Can you try change - "222:22" to `- "22222:22"?

ralyodio commented 3 months ago

same error.

ralyodio commented 3 months ago
Recreating 2b277680206d_gitea_db_1 ... 

ERROR: for 2b277680206d_gitea_db_1  'ContainerConfig'

ERROR: for db  'ContainerConfig'
Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 33, in <module>
    sys.exit(load_entry_point('docker-compose==1.29.2', 'console_scripts', 'docker-compose')())
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 81, in main
    command_func()
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 203, in perform_command
    handler(command, command_options)
  File "/usr/lib/python3/dist-packages/compose/metrics/decorator.py", line 18, in wrapper
    result = fn(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 1186, in up
    to_attach = up(False)
  File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 1166, in up
    return self.project.up(
  File "/usr/lib/python3/dist-packages/compose/project.py", line 697, in up
    results, errors = parallel.parallel_execute(
  File "/usr/lib/python3/dist-packages/compose/parallel.py", line 108, in parallel_execute
    raise error_to_reraise
  File "/usr/lib/python3/dist-packages/compose/parallel.py", line 206, in producer
    result = func(obj)
  File "/usr/lib/python3/dist-packages/compose/project.py", line 679, in do
    return service.execute_convergence_plan(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 579, in execute_convergence_plan
    return self._execute_convergence_recreate(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 499, in _execute_convergence_recreate
    containers, errors = parallel_execute(
  File "/usr/lib/python3/dist-packages/compose/parallel.py", line 108, in parallel_execute
    raise error_to_reraise
  File "/usr/lib/python3/dist-packages/compose/parallel.py", line 206, in producer
    result = func(obj)
  File "/usr/lib/python3/dist-packages/compose/service.py", line 494, in recreate
    return self.recreate_container(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 612, in recreate_container
    new_container = self.create_container(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 330, in create_container
    container_options = self._get_container_create_options(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 921, in _get_container_create_options
    container_options, override_options = self._build_container_volume_options(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 960, in _build_container_volume_options
    binds, affinity = merge_volume_bindings(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 1548, in merge_volume_bindings
    old_volumes, old_mounts = get_container_data_volumes(
  File "/usr/lib/python3/dist-packages/compose/service.py", line 1579, in get_container_data_volumes
    container.image_config['ContainerConfig'].get('Volumes') or {}
KeyError: 'ContainerConfig'
ralyodio commented 3 months ago

so i had to do docker system prune and that worked. I also had to do docker compose up instead of docker-compose up...but now I have a different problem.

I am getting this error in the UI:

The database settings are invalid: dial tcp 127.0.0.1:3306: connect: connection refused

lunny commented 3 months ago

Have you changed database configuration in the installation UI?

ralyodio commented 3 months ago

i had to remove everything and start over. however now the request on the installation page just times out. DOes this not work behind an nginx proxy?

ralyodio commented 3 months ago

i just get this log: gitea | 2024/06/12 09:38:28 ...s/install/install.go:228:checkDatabase() [I] Gitea will be installed in a database with: hasPostInstallationUser=false, dbMigrationVersion=299 on the docker cli. but it never returns.