forgejo?
This commit is contained in:
parent
532e01cbf1
commit
29eb6493be
3 changed files with 854 additions and 7 deletions
148
servers/README.md
Normal file
148
servers/README.md
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
# NixOS Server Configurations
|
||||
|
||||
This directory contains server-specific configuration files and modules for various services.
|
||||
|
||||
## Available Configurations
|
||||
|
||||
### common.nix
|
||||
Common server configuration that includes Docker support.
|
||||
|
||||
**Features:**
|
||||
- Docker container virtualization
|
||||
- Base server utilities
|
||||
|
||||
**Usage:**
|
||||
Include this module in your NixOS configuration for servers that need Docker support.
|
||||
|
||||
```nix
|
||||
imports = [ ./nixos/servers/common.nix ];
|
||||
```
|
||||
|
||||
### forgejo.nix
|
||||
Comprehensive Forgejo Git server configuration module.
|
||||
|
||||
**Features:**
|
||||
- Full Forgejo integration using NixOS native services
|
||||
- PostgreSQL database with local setup
|
||||
- TLS/SSL support via Let's Encrypt
|
||||
- Nginx reverse proxy with WebSocket support
|
||||
- Git LFS support
|
||||
- Automated daily backups with retention
|
||||
- OAuth2 authentication (GitHub)
|
||||
- Email notifications (SMTP)
|
||||
- Security hardening
|
||||
|
||||
**Configuration Example:**
|
||||
```nix
|
||||
{ config, pkgs, ... }: {
|
||||
imports = [ ./nixos/servers/forgejo.nix ];
|
||||
|
||||
services.forgejo = {
|
||||
enable = true;
|
||||
domain = "git.example.com";
|
||||
database.createLocally = true;
|
||||
backup = {
|
||||
enable = true;
|
||||
interval = "daily";
|
||||
retentionDays = 7;
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
### hugo.nix
|
||||
Docker-based Hugo static site generator configuration.
|
||||
|
||||
**Features:**
|
||||
- Hugo web server
|
||||
- Remark42 comment system
|
||||
- Watchtower for automatic updates
|
||||
|
||||
**Usage:**
|
||||
This file uses a docker-compose style format. Deploy using Docker Compose or migrate to NixOS containers.
|
||||
|
||||
## Adding a New Server
|
||||
|
||||
To add a new server configuration:
|
||||
|
||||
1. Create a new `.nix` file in this directory
|
||||
2. Follow the NixOS module pattern:
|
||||
```nix
|
||||
{ config, pkgs, lib, ... }: {
|
||||
# Your configuration here
|
||||
}
|
||||
```
|
||||
3. Import it in your system's `flake.nix` or configuration.nix
|
||||
|
||||
## Best Practices
|
||||
|
||||
- **Reusable Modules:** Design configurations to be reusable across multiple servers
|
||||
- **Security:** Keep sensitive data (passwords, API keys) out of version control
|
||||
- **Documentation:** Document complex configurations with inline comments
|
||||
- **Modularization:** Split complex services into separate files
|
||||
|
||||
## Integration with Main Configuration
|
||||
|
||||
To use these server modules in your NixOS configuration, add them to your `flake.nix`:
|
||||
|
||||
```nix
|
||||
{
|
||||
description = "My NixOS configuration";
|
||||
|
||||
outputs = { self, nixpkgs, ... }: {
|
||||
nixosConfigurations.my-server = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./nixos/servers/common.nix
|
||||
./nixos/servers/forgejo.nix
|
||||
# Other configurations
|
||||
./systems/my-server.nix
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
## Maintenance
|
||||
|
||||
### Backups
|
||||
Server configurations should be backed up regularly. The Forgejo module includes automated backups. For other services, implement appropriate backup strategies.
|
||||
|
||||
### Updates
|
||||
Update server configurations with:
|
||||
```bash
|
||||
sudo nixos-rebuild switch
|
||||
```
|
||||
|
||||
### Monitoring
|
||||
Monitor server services:
|
||||
```bash
|
||||
sudo systemctl status <service-name>
|
||||
sudo journalctl -u <service-name> -f
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Common Issues
|
||||
|
||||
1. **Docker Not Starting:**
|
||||
```bash
|
||||
sudo systemctl status docker.service
|
||||
sudo journalctl -u docker.service -f
|
||||
```
|
||||
|
||||
2. **Port Conflicts:**
|
||||
Check if services are conflicting on ports:
|
||||
```bash
|
||||
sudo netstat -tulpn
|
||||
```
|
||||
|
||||
3. **Permission Issues:**
|
||||
Verify file ownership and permissions for service directories
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [NixOS Documentation](https://nixos.org/manual/nixos/stable/)
|
||||
- [NixOS Options Search](https://search.nixos.org/options)
|
||||
- [Forgejo Documentation](https://forgejo.org/docs/latest/)
|
||||
- [Docker NixOS Module](https://search.nixos.org/options?query=virtualisation.docker)
|
||||
Loading…
Add table
Add a link
Reference in a new issue