Skip to content

Support automatic installation via configuration management (ansible, puppet, chef, etc) #2324

@vizcay

Description

@vizcay

I'm trying to setup an ansible playbook that installs and configures everything but it needs manual intervention and that's not desirable from a devops point of view.

The main problem is, to configure the admin user account, I need the database schema to be created before issuing gitea create-user .. that is currently failing with "CreateUser: no such table: user". That needs to server to be started and navigated at least once.

Just for the record, this is as far as I can get (it's very easy to follow):

- block:
  - name: Create gitea directory
    file:
      path: /home/deploy/applications/gitea/
      state: directory
      owner: deploy
  - name: Download gitea executable
    get_url:
      url: https://dl.gitea.io/gitea/master/gitea-master-linux-amd64
      dest: /home/deploy/applications/gitea/gitea
      mode: 0550
      owner: deploy
      force: no
  - name: Create gitea config directory
    file:
      path: /home/deploy/applications/gitea/custom/conf/
      state: directory
      owner: deploy
  - name: Copy config
    template:
      src: templates/app.ini
      dest: /home/deploy/applications/gitea/custom/conf/app.ini
      owner: deploy
  - name: Copy nginx site for gitea
    template:
      src: templates/nginx
      dest: /etc/nginx/sites-available/gitea
  - name: Enable nginx site for gitea
    file:
      src: /etc/nginx/sites-available/gitea
      dest: /etc/nginx/sites-enabled/gitea
      state: link
  - name: Restart nginx to pick config
    service:
      name: nginx
      state: reloaded
  - name: Copy monit config for gitea
    template:
      src: templates/monit
      dest: /etc/monit/conf-available/gitea
  - name: Enable monit config for gitea
    file:
      src: /etc/monit/conf-available/gitea
      dest: /etc/monit/conf-enabled/gitea
      state: link
  - name: Restart monit to pick config
    service:
      name: monit
      state: reloaded
  become: true
- name: Create admin user for gitea
  command: /home/deploy/applications/gitea/gitea admin create-user --name xxxxx --password xxxxx --admin
  ignore_errors: yes
  args:
    chdir: /home/deploy/applications/gitea

Please: manual intervention should never be needed to install software.

By the way, I love the simplicity and requirements of gitea = )

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions