Skip to content

[Docs] Linux Service Edit #9633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jan 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions docs/content/doc/installation/run-as-service-in-ubuntu.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ menu:
identifier: "linux-service"
---

### Run as service in Ubuntu 16.04 LTS
### Run Gitea as Linux service

#### Using systemd
You can run Gitea as service, using either systemd or supervisor. The steps below tested on Ubuntu 16.04, but those should work on any Linux distributions (with little modification).

Run the below command in a terminal:
```
sudo vim /etc/systemd/system/gitea.service
```
#### Using systemd

Copy the sample [gitea.service](https://github.com/go-gitea/gitea/blob/master/contrib/systemd/gitea.service).
Copy the sample [gitea.service](https://github.com/go-gitea/gitea/blob/master/contrib/systemd/gitea.service) to `/etc/systemd/system/gitea.service`, then edit the file with your favorite editor.

Uncomment any service that needs to be enabled on this host, such as MySQL.

Expand All @@ -35,6 +32,10 @@ sudo systemctl enable gitea
sudo systemctl start gitea
```

If you have systemd version 220 or later, you can enable and immediately start Gitea at once by:
```
sudo systemctl enable gitea --now
```

#### Using supervisor

Expand All @@ -49,19 +50,20 @@ Create a log dir for the supervisor logs:
mkdir /home/git/gitea/log/supervisor
```

Open supervisor config file in a file editor:
```
sudo vim /etc/supervisor/supervisord.conf
```

Append the configuration from the sample
[supervisord config](https://github.com/go-gitea/gitea/blob/master/contrib/supervisor/gitea).
[supervisord config](https://github.com/go-gitea/gitea/blob/master/contrib/supervisor/gitea) to `/etc/supervisor/supervisord.conf`.

Change the user (git) and home (/home/git) settings to match the deployment
environment. Change the PORT or remove the -p flag if default port is used.
Using your favorite editor, change the user (git) and home
(/home/git) settings to match the deployment environment. Change the PORT
or remove the -p flag if default port is used.

Lastly enable and start supervisor at boot:
```
sudo systemctl enable supervisor
sudo systemctl start supervisor
```

If you have systemd version 220 or later, you can enable and immediately start supervisor by:
```
sudo systemctl enable supervisor --now
```