⬅️ **[[$-Tools|Tools]]** | [[Home Network]]
***
# Gogs Git Service
> siehe auch [[Git]]
https://gogs.mauritz-familie.de/
[Docker Hub - Gogs](https://hub.docker.com/r/gogs/gogs/tags)
## Upgrade [[Docker]] Container
- **Gogs Changelog:** https://github.com/gogs/gogs/releases
1. At location of `docker-compose.yml` run `docker-compose pull` to pull newer images as it is configured with `:latest`
2. Run `docker-compose up -d` to update containers
## Change Domain URL
> Done in 2023-12-18 for https://gogs.mauritz-familie.de/
1. Stop Container
2. Edit file in container: `gogs/conf/app.ini` and change the Domain
3. Start Container
## Migration from SW package to docker image
> Done in 2022-05
1. Backup **GitRepos** from old Installation
2. Create `docker-compose.yml` and create Docker Container
1. **Important:** use for Ports written as `'9222:22'` in quotes
3. Edit HTTP_PORT in Docker data
1. Falls in Installationsschritt unten Erste Einrichtung z.B. Port 80 eingetragen wurde, obwohl der Docker Container mit 3000 arbeiten
2. Dies kann nachträglich korrigiert werden in `docker-data/gogs/gogs/conf/app.ini`
4. First configuration
1. sqlite
2. defaults
3. Edit URL, Hostname, Port etc. to later have correct recommended commands
4. ![[Tools_Gogs_Home_Config.png]]
5. Create new Gogs User Account: **reaver1202**
6. Migrate Repo
1. Create new Repo e.g. **d4r-k8s**
2. Delete that folder in `docker-data/gogs/...`
3. Copy the backup files from **d4r-k8s** Backup to the `docker-data/gogs/..` folder e.g. `sudo cp -r GitRepos/reaver1202/d4r-k8s.git ../docker-data/gogs/git/gogs-repositories/reaver1202/`
4. It is important to use the new Git Hook Scripts. So create a test Git Repo and copy the hook scripts into all the migrated Git Repos
5. Change owner of that folder as before e.g. `sudo chown 1000:1000 -R <directory>`
```ad-example
sudo rm -rf docker-data/gogs/git/gogs-repositories/reaver1202/*
sudo cp -r test/GitRepos/reaver1202/* docker-data/gogs/git/gogs-repositories/reaver1202/
sudo cp docker-data/gogs/git/gogs-repositories/reaver1202/test.git/hooks/* docker-data/gogs/git/gogs-repositories/reaver1202/life.git/hooks/
sudo chown 1000:1000 -R docker-data/gogs/git/gogs-repositories/reaver1202/*
```
6. Refresh in WebBrowser and all data from before is there
## DEPRECATED Installation ca 2019
https://pimylifeup.com/raspberry-pi-gogs/
sudo apt install mariadb-server git unzip
tobi@pi-home:~ $ sudo mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] n
... skipping.
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Login into MariaDB MySQL:
sudo mysql -u root -p
CREATE DATABASE gogs;
GRANT ALL PRIVILEGES ON gogs.* TO 'goguser'@'localhost' IDENTIFIED BY 'Pass4Gogs';
FLUSH PRIVILEGES;
exit
Exited
sudo adduser (--disabled-login) git
cd /home/git
sudo wget https://cdn.gogs.io/0.11.91/gogs_0.11.91_raspi_armv7.zip -O gogs.zip
sudo unzip gogs.zip
sudo rm gogs.zip
sudo chown -R git:git /home/git/gogs
sudo systemctl enable /home/git/gogs/scripts/systemd/gogs.service
sudo systemctl start gogs.service
sudo systemctl status gogs.service
hostname -I
Web Config
User
Hostname
Verzeichnisse
Admin UI User (erster Benutzer)
reaver1202 ?StandardG!
Linux git user in /etc/shadow mit null anstatt !
https://unix.stackexchange.com/questions/96892/what-does-adduser-disabled-login-do#96897
migrate Old Git Repos to Gogs
Simple create a project in Gogs UI. After that copy content from Old Git Repo folder into new folder of Gogs.
cp -r jekyll-tobi.git reaver1202/