Browse Source

several doc fixes

Nicola Murino 5 years ago
parent
commit
3702bc8413

+ 3 - 3
.github/workflows/development.yml

@@ -32,14 +32,14 @@ jobs:
 
       - name: Build for Linux/macOS
         if: startsWith(matrix.os, 'windows-') != true
-        run: go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo
+        run: go build -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo
 
       - name: Build for Windows
         if: startsWith(matrix.os, 'windows-')
         run: |
           $GIT_COMMIT = (git describe --always --dirty) | Out-String
           $DATE_TIME = ([datetime]::Now.ToUniversalTime().toString("yyyy-MM-ddTHH:mm:ssZ")) | Out-String
-          go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/version.date=$DATE_TIME" -o sftpgo.exe
+          go build -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/version.date=$DATE_TIME" -o sftpgo.exe
 
       - name: Initialize data provider
         run: ./sftpgo initprovider
@@ -142,7 +142,7 @@ jobs:
           go-version: 1.14
 
       - name: Build
-        run: go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo
+        run: go build -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo
 
       - name: Run tests using PostgreSQL provider
         run: |

+ 4 - 4
.github/workflows/release.yml

@@ -102,14 +102,14 @@ jobs:
 
       - name: Build for Linux/macOS
         if: startsWith(matrix.os, 'windows-') != true
-        run: go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo
+        run: go build -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo
 
       - name: Build for Windows
         if: startsWith(matrix.os, 'windows-')
         run: |
           $GIT_COMMIT = (git describe --always --dirty) | Out-String
           $DATE_TIME = ([datetime]::Now.ToUniversalTime().toString("yyyy-MM-ddTHH:mm:ssZ")) | Out-String
-          go build -i -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/version.date=$DATE_TIME" -o sftpgo.exe
+          go build -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=$GIT_COMMIT -X github.com/drakkan/sftpgo/version.date=$DATE_TIME" -o sftpgo.exe
 
       - name: Initialize data provider
         run: ./sftpgo initprovider
@@ -160,9 +160,9 @@ jobs:
           cp -r templates output/
           if [ $OS == 'linux' ]
           then
-            cp -r init/sftpgo.service output/init/
+            cp init/sftpgo.service output/init/
           else
-            cp -r init/com.github.drakkan.sftpgo.plist output/init/
+            cp init/com.github.drakkan.sftpgo.plist output/init/
           fi
           ./sftpgo gen completion bash > output/bash_completion/sftpgo-completion.bash
           ./sftpgo gen completion zsh > output/zsh_completion/_sftpgo

+ 5 - 5
cmd/gencompletion.go

@@ -16,24 +16,24 @@ var genCompletionCmd = &cobra.Command{
 
 Bash:
 
-$ source <(sftpgo completion bash)
+$ source <(sftpgo gen completion bash)
 
 # To load completions for each session, execute once:
 Linux:
-  $ sftpgo completion bash > /etc/bash_completion.d/sftpgo-completion.bash
+  $ sftpgo gen completion bash > /etc/bash_completion.d/sftpgo-completion.bash
 MacOS:
-  $ sftpgo completion bash > /usr/local/etc/bash_completion.d/sftpgo-completion.bash
+  $ sftpgo gen completion bash > /usr/local/etc/bash_completion.d/sftpgo-completion.bash
 
 Zsh:
 
-$ source <(sftpgo completion zsh)
+$ source <(sftpgo gen completion zsh)
 
 # To load completions for each session, execute once:
 $ sftpgo completion zsh > "${fpath[1]}/_sftpgo"
 
 Fish:
 
-$ sftpgo completion fish | source
+$ sftpgo gen completion fish | source
 
 # To load completions for each session, execute once:
 $ sftpgo completion fish > ~/.config/fish/completions/sftpgo.fish

+ 1 - 1
docker/sftpgo/alpine/Dockerfile

@@ -7,7 +7,7 @@ ARG TAG
 ARG FEATURES
 # Use --build-arg TAG=LATEST for latest tag. Use e.g. --build-arg TAG=0.9.6 for a specific tag/commit. Otherwise HEAD (master) is built.
 RUN git checkout $(if [ "${TAG}" = LATEST ]; then echo `git rev-list --tags --max-count=1`; elif [ -n "${TAG}" ]; then echo "${TAG}"; else echo HEAD; fi)
-RUN go build -i $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o /go/bin/sftpgo
+RUN go build $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o /go/bin/sftpgo
 
 FROM alpine:latest
 

+ 1 - 1
docker/sftpgo/debian/Dockerfile

@@ -7,7 +7,7 @@ ARG TAG
 ARG FEATURES
 # Use --build-arg TAG=LATEST for latest tag. Use e.g. --build-arg TAG=0.9.6 for a specific tag/commit. Otherwise HEAD (master) is built.
 RUN git checkout $(if [ "${TAG}" = LATEST ]; then echo `git rev-list --tags --max-count=1`; elif [ -n "${TAG}" ]; then echo "${TAG}"; else echo HEAD; fi)
-RUN go build -i $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo
+RUN go build $(if [ -n "${FEATURES}" ]; then echo "-tags ${FEATURES}"; fi) -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo
 
 # now define the run environment
 FROM debian:latest

+ 1 - 1
docs/build-from-source.md

@@ -36,7 +36,7 @@ Version info, such as git commit and build date, can be embedded setting the fol
 For example, you can build using the following command:
 
 ```bash
-go build -i -tags nogcs,nos3,nosqlite -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo
+go build -tags nogcs,nos3,nosqlite -ldflags "-s -w -X github.com/drakkan/sftpgo/version.commit=`git describe --always --dirty` -X github.com/drakkan/sftpgo/version.date=`date -u +%FT%TZ`" -o sftpgo
 ```
 
 You should get a version that includes git commit, build date and available features like this one:

+ 13 - 5
docs/service.md

@@ -9,19 +9,22 @@ Here are some basic instructions to run SFTPGo as service, please run the follow
 ```bash
 # create the required directories
 sudo mkdir -p /etc/sftpgo \
-  /var/lib/sftpgo
+  /var/lib/sftpgo \
+  /usr/share/sftpgo
 
 # install sftpgo executable
 sudo install -Dm755 sftpgo /usr/bin/sftpgo
 # install the default configuration file, edit it if required
 sudo install -Dm644 sftpgo.json /etc/sftpgo/
 # override some configuration keys using environment variables
-sudo sh -c 'echo "SFTPGO_HTTPD__TEMPLATES_PATH=/var/lib/sftpgo/templates" > /etc/sftpgo/sftpgo.env'
-sudo sh -c 'echo "SFTPGO_HTTPD__STATIC_FILES_PATH=/var/lib/sftpgo/static" >> /etc/sftpgo/sftpgo.env'
+sudo sh -c 'echo "SFTPGO_HTTPD__TEMPLATES_PATH=/usr/share/sftpgo/templates" > /etc/sftpgo/sftpgo.env'
+sudo sh -c 'echo "SFTPGO_HTTPD__STATIC_FILES_PATH=/usr/share/sftpgo/static" >> /etc/sftpgo/sftpgo.env'
 sudo sh -c 'echo "SFTPGO_HTTPD__BACKUPS_PATH=/var/lib/sftpgo/backups" >> /etc/sftpgo/sftpgo.env'
 sudo sh -c 'echo "SFTPGO_DATA_PROVIDER__CREDENTIALS_PATH=/var/lib/sftpgo/credentials" >> /etc/sftpgo/sftpgo.env'
+# if you use a file based data provider such as sqlite or bolt consider to set the database path too, for example:
+#sudo sh -c 'echo "SFTPGO_DATA_PROVIDER__NAME=/var/lib/sftpgo/sftpgo.db" >> /etc/sftpgo/sftpgo.env'
 # install static files and templates for the web UI
-sudo cp -r static templates /var/lib/sftpgo/
+sudo cp -r static templates /usr/share/sftpgo/
 # initialize the configured data provider
 # if you want to use MySQL or PostgreSQL you need to create the configured database before running the initprovider command
 sudo /usr/bin/sftpgo initprovider -c /etc/sftpgo/
@@ -35,6 +38,10 @@ sudo systemctl status sftpgo
 sudo systemctl enable sftpgo
 # optional, install the REST API CLI. It requires python-requests to run
 sudo install -Dm755 examples/rest-api-cli/sftpgo_api_cli.py /usr/bin/sftpgo_api_cli
+# optional, create shell completion script, for example for bash
+sudo /usr/bin/sftpgo gen completion bash > /etc/bash_completion.d/sftpgo-completion.bash
+# optional, create man pages
+sudo /usr/bin/sftpgo gen man -d /usr/share/man/man1
 ```
 
 ## macOS
@@ -47,6 +54,7 @@ Here are some basic instructions to run SFTPGo as service, please run the follow
 # create the required directories
 sudo mkdir -p /usr/local/opt/sftpgo/init \
   /usr/local/opt/sftpgo/var/lib \
+  /usr/local/opt/sftpgo/usr/share \
   /usr/local/opt/sftpgo/var/log \
   /usr/local/opt/sftpgo/etc \
   /usr/local/opt/sftpgo/bin
@@ -59,7 +67,7 @@ sudo chown root:wheel /usr/local/opt/sftpgo/init/com.github.drakkan.sftpgo.plist
 # install the default configuration file, edit it if required
 sudo cp sftpgo.json /usr/local/opt/sftpgo/etc/
 # install static files and templates for the web UI
-sudo cp -r static templates /usr/local/opt/sftpgo/var/lib/
+sudo cp -r static templates /usr/local/opt/sftpgo/usr/share/
 # initialize the configured data provider
 # if you want to use MySQL or PostgreSQL you need to create the configured database before running the initprovider command
 sudo /usr/local/opt/sftpgo/bin/sftpgo initprovider -c /usr/local/opt/sftpgo/etc/

+ 1 - 1
examples/ldapauth/README.md

@@ -7,7 +7,7 @@ You need to change the LDAP connection parameters and the user search query to m
 You can build this example using the following command:
 
 ```console
-go build -i -ldflags "-s -w" -o ldapauth
+go build -ldflags "-s -w" -o ldapauth
 ```
 
 This program assumes that the 389ds schema was extended to add support for public keys using the following ldif file placed in `/etc/dirsrv/schema/98openssh-ldap.ldif`:

+ 1 - 1
examples/ldapauthserver/README.md

@@ -7,5 +7,5 @@ You can configure the server using the [ldapauth.toml](./ldapauth.toml) configur
 You can build this example using the following command:
 
 ```console
-go build -i -ldflags "-s -w" -o ldapauthserver
+go build -ldflags "-s -w" -o ldapauthserver
 ```

+ 2 - 2
init/com.github.drakkan.sftpgo.plist

@@ -11,9 +11,9 @@
         <key>SFTPGO_LOG_FILE_PATH</key>
         <string>/usr/local/opt/sftpgo/var/log/sftpgo.log</string>
         <key>SFTPGO_HTTPD__TEMPLATES_PATH</key>
-        <string>/usr/local/opt/sftpgo/var/lib/templates</string>
+        <string>/usr/local/opt/sftpgo/usr/share/templates</string>
         <key>SFTPGO_HTTPD__STATIC_FILES_PATH</key>
-        <string>/usr/local/opt/sftpgo/var/lib/static</string>
+        <string>/usr/local/opt/sftpgo/usr/share/static</string>
         <key>SFTPGO_HTTPD__BACKUPS_PATH</key>
         <string>/usr/local/opt/sftpgo/var/lib/backups</string>
         <key>SFTPGO_DATA_PROVIDER__CREDENTIALS_PATH</key>