Browse Source

Able to set SSH port when install, update Docker docs

pull/1515/head
Unknwon 9 years ago
parent
commit
bd1d7d1509
  1. 2
      conf/locale/locale_en-US.ini
  2. 18
      docker/README.md
  3. 1
      modules/auth/user_form.go
  4. 36
      modules/bindata/bindata.go
  5. 2
      public/css/gogs.min.css
  6. 5
      public/less/_install.less
  7. 8
      routers/install.go
  8. 9
      templates/install.tmpl

2
conf/locale/locale_en-US.ini

@ -76,6 +76,8 @@ run_user = Run User
run_user_helper = The user must have access to Repository Root Path and run Gogs.
domain = Domain
domain_helper = This affects SSH clone URLs.
ssh_port = SSH Port
ssh_port_helper = Port number which your SSH server is using, leave it empty to disable SSH feature.
http_port = HTTP Port
http_port_helper = Port number which application will listen on.
app_url = Application URL

18
docker/README.md

@ -35,21 +35,19 @@ Directory `/var/gogs` keeps Git repoistories and Gogs data:
|-- log
|-- templates
## SSH Support
## Settings
In order to support SSH, You need to change `SSH_PORT` in `/var/gogs/gogs/conf/app.ini`:
Most of settings are obvious and easy to understand, but there are some settings can be confusing by running Gogs inside Docker:
```
[server]
SSH_PORT = 10022
```
- Repository Root Path: keep it as default value `/home/git/gogs-repositories` because `start.sh` already made a symbolic link for you.
- Run User: keep it as default value `git` because `start.sh` already setup a user with name `git`.
- Domain: fill in with Docker container IP(e.g. `192.168.99.100`).
- SSH Port: Use the exposed port from Docker container. For example, your SSH server listens on `22` inside Docker, but you expose it by `10022:22`, then use `10022` for this value.
- HTTP Port: Use the exposed port from Docker container. For example, your Gogs listens on `3000` inside Docker, but you expose it by `10080:3000`, then use `10080` for this value.
- Application URL: Use combination of **Domain** and **HTTP Port** values(e.g. `http://192.168.99.100:10080/`).
Full documentation of settings can be found [here](http://gogs.io/docs/advanced/configuration_cheat_sheet.html).
## Todo
Install page need support set `SSH_PORT`.
## Troubleshooting
If you see the following error:

1
modules/auth/user_form.go

@ -24,6 +24,7 @@ type InstallForm struct {
RepoRootPath string `binding:"Required"`
RunUser string `binding:"Required"`
Domain string `binding:"Required"`
SSHPort int
HTTPPort string `binding:"Required"`
AppUrl string `binding:"Required"`

36
modules/bindata/bindata.go

File diff suppressed because one or more lines are too long

2
public/css/gogs.min.css vendored

File diff suppressed because one or more lines are too long

5
public/less/_install.less

@ -2,9 +2,10 @@
padding-top: 45px;
padding-bottom: @footer-margin * 3;
form {
@input-padding: 320px !important;
label {
text-align: right;
width: 40% !important;
width: @input-padding;
}
input {
width: 35% !important;
@ -12,7 +13,7 @@
.field {
text-align: left;
.help {
margin-left: 41%;
margin-left: @input-padding+15px;
}
&.optional .title {
margin-left: 38%;

8
routers/install.go

@ -118,6 +118,7 @@ func Install(ctx *middleware.Context) {
}
form.Domain = setting.Domain
form.SSHPort = setting.SSHPort
form.HTTPPort = setting.HttpPort
form.AppUrl = setting.AppUrl
@ -241,6 +242,13 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
cfg.Section("server").Key("HTTP_PORT").SetValue(form.HTTPPort)
cfg.Section("server").Key("ROOT_URL").SetValue(form.AppUrl)
if form.SSHPort == 0 {
cfg.Section("server").Key("DISABLE_SSH").SetValue("true")
} else {
cfg.Section("server").Key("DISABLE_SSH").SetValue("false")
cfg.Section("server").Key("SSH_PORT").SetValue(com.ToStr(form.SSHPort))
}
if len(strings.TrimSpace(form.SMTPHost)) > 0 {
cfg.Section("mailer").Key("ENABLED").SetValue("true")
cfg.Section("mailer").Key("HOST").SetValue(form.SMTPHost)

9
templates/install.tmpl

@ -92,6 +92,11 @@
<input id="domain" name="domain" value="{{.domain}}" required>
<span class="help">{{.i18n.Tr "install.domain_helper"}}</span>
</div>
<div class="inline required field">
<label for="ssh_port">{{.i18n.Tr "install.ssh_port"}}</label>
<input id="ssh_port" name="ssh_port" value="{{.ssh_port}}">
<span class="help">{{.i18n.Tr "install.ssh_port_helper"}}</span>
</div>
<div class="inline required field">
<label for="http_port">{{.i18n.Tr "install.http_port"}}</label>
<input id="http_port" name="http_port" value="{{.http_port}}" required>
@ -105,6 +110,8 @@
<!-- Optional Settings -->
<h4 class="ui dividing header">{{.i18n.Tr "install.optional_title"}}</h4>
<!-- Email -->
<div class="ui accordion optional field">
<div class="title {{if .Err_SMTP}}text red{{end}}">
<i class="icon dropdown"></i>
@ -143,6 +150,7 @@
</div>
</div>
<!-- Server and other services -->
<div class="ui accordion optional field">
<div class="title">
<i class="icon dropdown"></i>
@ -170,6 +178,7 @@
</div>
</div>
<!-- Admin -->
<div class="ui accordion optional field">
<div class="title {{if .Err_Admin}}text red{{end}}">
<i class="icon dropdown"></i>

Loading…
Cancel
Save