2024-06-03 07:04:29 -07:00

4.8 KiB

type, assigned, created, updated
type assigned created updated
topic 2024-01-06T01:25:36.066Z 2024-01-06T01:25:36.066Z

Gogs

# https://gogs.io/docs/installation/run_as_windows_service
nssm install gogs
Application Tab:
    Path: D:\go-lang\gogs\gogs.exe
    Startup directory: D:\go-lang\gogs
    Arguments: web
Details Tab:
    Display name`: Gogs
    Description: Gogs is a painless self-hosted Git service.
    Startup type`: Automatic (Delayed Start)
I/O Tab:
    Output (stdout): D:\go-lang\gogs\log\gogs-nssm.txt
    Error (stderr): D:\go-lang\gogs\log\gogs-nssm.txt
File rotation Tab:
    Check: Rotate files
    Restrict rotation to files bigger than: 1000000 bytes
Environment Tab:
    Environment variables: PATH=%PATH%;D:\go-lang\gogs;C:\Program Files (x86)\Git\bin
BRAND_NAME = Gogs
RUN_USER   = DESKTOP-RCALEHG$
RUN_MODE   = prod

[database]
TYPE     = sqlite3
HOST     = 127.0.0.1:5432
NAME     = gogs
USER     = gogs
PASSWORD = 
SSL_MODE = disable
PATH     = data/gogs.db

[repository]
ROOT = L:/Gogs/git/gogs-repositories

[server]
DOMAIN           = gogs
HTTP_PORT        = 3000
EXTERNAL_URL     = http://gogs/
DISABLE_SSH      = false
SSH_PORT         = 22
START_SSH_SERVER = false
OFFLINE_MODE     = false

[mailer]
ENABLED = false

[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL     = false
DISABLE_REGISTRATION   = false
ENABLE_CAPTCHA         = true
REQUIRE_SIGNIN_VIEW    = false

[picture]
DISABLE_GRAVATAR        = false
ENABLE_FEDERATED_AVATAR = false

[session]
PROVIDER = file

[log]
MODE      = file
LEVEL     = Info
ROOT_PATH = L:/Gogs/gogs_0.12.10_windows_amd64/log

[security]
INSTALL_LOCK = true
SECRET_KEY   = JJxp7NE0URIxoak
sudo -i
cd /home/gogs
wget https://dl.gogs.io/0.13.0/gogs_0.13.0_linux_amd64.tar.gz
tar -xvzf gogs_0.13.0_linux_amd64.tar.gz
rm gogs_0.13.0_linux_amd64.tar.gz
cd gogs
./gogs web
links http://localhost:3000
^c
mkdir /home/gogs/gogs-repositories
chown mike /home/mike -R
chgrp mike /home/mike -R
# https://github.com/gogs/gogs/blob/main/scripts/systemd/gogs.service
nano /etc/systemd/system/gogs-daemon.service
[Unit]
Description=Gogs
After=syslog.target
After=network.target

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple
User=gogs
Group=gogs
WorkingDirectory=/home/gogs/gogs
ExecStart=/home/gogs/gogs/gogs web
Restart=always
Environment=USER=gogs HOME=/home/gogs

# Some distributions may not support these hardening directives
# If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
ProtectSystem=full
PrivateDevices=yes
PrivateTmp=yes
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target
systemctl enable gogs-daemon
systemctl stop gogs-daemon
systemctl start gogs-daemon
systemctl status gogs-daemon.service
journalctl -fu gogs-daemon.service
journalctl --rotate
journalctl --vacuum-time=1s
systemctl daemon-reload
mkdir /etc/gogs-copy
cp /home/gogs/gogs/custom/conf/app.ini /etc/gogs-copy/
ln -s /home/gogs/gogs/custom/conf /etc/gogs
# nano /home/gogs/gogs/custom/conf/app.ini
nano /etc/gogs/app.ini
BRAND_NAME = Gogs
RUN_USER   = gogs
RUN_MODE   = prod

[database]
TYPE     = sqlite3
HOST     = 127.0.0.1:3306
NAME     = gogs
SCHEMA   = public
USER     = gogs
PASSWORD = 1178
SSL_MODE = disable
PATH     = data/gogs.db

[repository]
ROOT           = /home/gogs/gogs-repositories
DEFAULT_BRANCH = master

[server]
DOMAIN           = localhost
HTTP_PORT        = 3000
EXTERNAL_URL     = http://d98b8bcf651717df3301d99689440f5fd6f411d4@beelink:3000/
DISABLE_SSH      = false
SSH_PORT         = 22
START_SSH_SERVER = false
OFFLINE_MODE     = false

[mailer]
ENABLED = false

[auth]
REQUIRE_EMAIL_CONFIRMATION  = false
DISABLE_REGISTRATION        = false
ENABLE_REGISTRATION_CAPTCHA = true
REQUIRE_SIGNIN_VIEW         = false

[user]
ENABLE_EMAIL_NOTIFICATION = false

[picture]
DISABLE_GRAVATAR        = false
ENABLE_FEDERATED_AVATAR = false

[session]
PROVIDER = file

[log]
MODE      = file
LEVEL     = Info
ROOT_PATH = /home/gogs/gogs/log

[security]
INSTALL_LOCK = true
SECRET_KEY   = czo27vBeXWU7HTi
systemctl restart gogs-daemon
# http://localhost:3000/
# https://github.com/gogs/docs-api/tree/master/Repositories#migrate
# https://github.com/Kos-M/GogsThemes
cd /home/gogs
git clone https://github.com/Kos-M/GogsThemes
mkdir -p /home/gogs/gogs/custom/templates/inject/
mkdir -p /home/gogs/gogs/custom/public/css/
echo  '<link rel="stylesheet" href="/css/themes/dark_theme.css">' >>  /home/gogs/gogs/custom/templates/inject/head.tmpl
mv ./GogsThemes/themes/ /home/gogs/gogs/custom/public/css/
cp -r  GogsThemes/img/ /home/gogs/gogs/custom/public/
rm -r ./GogsThemes
systemctl restart gogs-daemon