diff options
Diffstat (limited to 'docs/content/doc/usage')
-rw-r--r-- | docs/content/doc/usage/backup-and-restore.en-us.md | 46 | ||||
-rw-r--r-- | docs/content/doc/usage/backup-and-restore.zh-tw.md | 45 | ||||
-rw-r--r-- | docs/content/doc/usage/command-line.md | 80 |
3 files changed, 171 insertions, 0 deletions
diff --git a/docs/content/doc/usage/backup-and-restore.en-us.md b/docs/content/doc/usage/backup-and-restore.en-us.md new file mode 100644 index 0000000000..4346c6da43 --- /dev/null +++ b/docs/content/doc/usage/backup-and-restore.en-us.md @@ -0,0 +1,46 @@ +--- +date: "2017-01-01T16:00:00+02:00" +title: "Usage: Backup and Restore" +slug: "backup-and-restore" +weight: 11 +toc: true +draft: false +menu: + sidebar: + parent: "usage" + name: "Backup and Restore" + weight: 11 + identifier: "backup-and-restore" +--- + +# Backup and Restore + +Gitea currently has a `dump` command that will save your installation to a zip file. There will be a `restore` command implemented at some point in the future. You will be able to use this to back up your installation, as well as make migrating servers easier. + +## Backup Command (`dump`) + +First, switch to the user running gitea: `su git` (or whatever user you are using). Run `./gitea dump` in the gitea installation directory. You should see some output similar to this: + +``` +2016/12/27 22:32:09 Creating tmp work dir: /tmp/gitea-dump-417443001 +2016/12/27 22:32:09 Dumping local repositories.../home/git/gitea-repositories +2016/12/27 22:32:22 Dumping database... +2016/12/27 22:32:22 Packing dump files... +2016/12/27 22:32:34 Removing tmp work dir: /tmp/gitea-dump-417443001 +2016/12/27 22:32:34 Finish dumping in file gitea-dump-1482906742.zip +``` + +Inside the `gitea-dump-1482906742.zip` file, you will find the following: + +* `custom/conf/app.ini` - This is your server config. +* `gitea-db.sql` - SQL dump of your database. +* `gitea-repo.zip` - This zip will be a complete copy of your repo folder. + See Config -> repository -> `ROOT` for the location. +* `log/` - this will contain various logs. You don't need these if you are doing + a migration. + +Intermediate backup files are created in a temporary directory specified either with the `--tempdir` command-line parameter or the `TMPDIR` environment variable. + +## Restore Command (`restore`) + +WIP: Does not exist yet. diff --git a/docs/content/doc/usage/backup-and-restore.zh-tw.md b/docs/content/doc/usage/backup-and-restore.zh-tw.md new file mode 100644 index 0000000000..6f54858818 --- /dev/null +++ b/docs/content/doc/usage/backup-and-restore.zh-tw.md @@ -0,0 +1,45 @@ +--- +date: "2017-01-01T16:00:00+02:00" +title: "用法: 備份與還原" +slug: "backup-and-restore" +weight: 11 +toc: true +draft: false +menu: + sidebar: + parent: "usage" + name: "備份與還原" + weight: 11 + identifier: "backup-and-restore" +--- + +# 備份與還原 + +Gitea 目前支援 `dump` 指令,用來將資料備份成 zip 檔案,後續會提供還原指令,讓你可以輕易的將備份資料及還原到另外一台機器。 + +## 備份指令 (`dump`) + +首先,切換到執行 Gitea 的使用者: `su git` (請修改成您指定的使用者),並在安裝目錄內執行 `./gitea dump` 指令,你可以看到 console 畫面如下: + +``` +2016/12/27 22:32:09 Creating tmp work dir: /tmp/gitea-dump-417443001 +2016/12/27 22:32:09 Dumping local repositories.../home/git/gitea-repositories +2016/12/27 22:32:22 Dumping database... +2016/12/27 22:32:22 Packing dump files... +2016/12/27 22:32:34 Removing tmp work dir: /tmp/gitea-dump-417443001 +2016/12/27 22:32:34 Finish dumping in file gitea-dump-1482906742.zip +``` + +備份出來的 `gitea-dump-1482906742.zip` 檔案,檔案內會包含底下內容: + +* `custom/conf/app.ini` - 伺服器設定檔。 +* `gitea-db.sql` - SQL 備份檔案。 +* `gitea-repo.zip` - 此 zip 檔案為全部的 repo 目錄。 + 請參考 Config -> repository -> `ROOT` 所設定的路徑。 +* `log/` - 全部 logs 檔案,如果你要 migrate 到其他伺服器,此目錄不用保留。 + +你可以透過設定 `--tempdir` 指令參數來指定備份檔案目錄,或者是設定 `TMPDIR` 環境變數來達到此功能。 + +## 還原指令 (`restore`) + +持續更新中: 此文件尚未完成. diff --git a/docs/content/doc/usage/command-line.md b/docs/content/doc/usage/command-line.md new file mode 100644 index 0000000000..e3e1f2356b --- /dev/null +++ b/docs/content/doc/usage/command-line.md @@ -0,0 +1,80 @@ +--- +date: "2017-01-01T16:00:00+02:00" +title: "Usage: Command Line" +slug: "command-line" +weight: 10 +toc: true +draft: false +menu: + sidebar: + parent: "usage" + name: "Command Line" + weight: 10 + identifier: "command-line" +--- + +## Command Line + +### Usage + +`gitea [global options] command [command options] [arguments...]` + +### Global options + - `--help`, `-h`: Show help text and exit. Optional. This can be used with any of the subcommands to see help text for it. + - `--version`, `-v`: Show version and exit. Optional. (example: `Gitea version 1.1.0+218-g7b907ed built with: bindata, sqlite`). + +### Commands + +#### web +Starts the server +- Options: + - `--port number`, `-p number`: Port number. Optional. (default: 3000). Overrides configuration file. + - `--config path`, `-c path`: Gitea configuration file path. Optional. (default: custom/conf/app.ini). + - `--pid path`, `-P path`: Pidfile path. Optional. +- Examples: + - `gitea web` + - `gitea web --port 80` + - `gitea web --config /etc/gitea.ini --pid /var/run/gitea.pid` +- Notes: + - Gitea should not be run as root. To bind to a port below 1000, you can use setcap on Linux: `sudo setcap 'cap_net_bind_service=+ep' /path/to/gitea`. This will need to be redone every time you update Gitea. + +#### admin +Admin operations +- Commands: + - `create-user` + - Options: + - `--name value`: Username. Required. + - `--password value`: Password. Required. + - `--email value`: Email. Required. + - `--admin`: If provided, this makes the user an admin. Optional. + - `--config path`: Gitea configuration file path. Optional. (default: custom/conf/app.ini). + - Examples: + - `gitea admin create-user --name myname --password asecurepassword --email me@example.com` + - `change-password` + - Arguments: + - `--username value`, `-u value`: Username. Required. + - `--password value`, `-p value`: New password. Required. + - Examples: + - `gitea admin change-password --username myname --password asecurepassword` + +#### cert +Generates a self-signed SSL certificate. Outputs to `cert.pem` and `key.pem` in the current directory and will overwrite any existing files. +- Options: + - `--host value`: Comma seperated hostnames and ips which this certificate is valid for. Wildcards are supported. Required. + - `--ecdsa-curve value`: ECDSA curve to use to generate a key. Optional. Valid options are P224, P256, P384, P521. + - `--rsa-bits value`: Size of RSA key to generate. Optional. Ignored if --ecdsa-curve is set. (default: 2048). + - `--start-date value`: Creation date. Optional. (format: `Jan 1 15:04:05 2011`). + - `--duration value`: Duration which the certificate is valid for. Optional. (default: 8760h0m0s) + - `--ca`: If provided, this cert generates it's own certificate authority. Optional. +- Examples: + - `gitea cert --host git.example.com,example.com,www.example.com --ca` + +#### dump +Dumps all files and databases into a zip file. Outputs into a file like `gitea-dump-1482906742.zip` in the current directory. +- Options: + - `--config path`, `-c path`: Gitea configuration file path. Optional. (default: custom/conf/app.ini). + - `--tempdir path`, `-t path`: Path to the temporary directory used. Optional. (default: /tmp). + - `--verbose`, `-v`: If provided, shows additional details. Optional. +- Examples: + - `gitea dump` + - `gitea dump --verbose` |