fix: finally got ssl working in nix environment #104

This commit is contained in:
KalebSchmidlkofer
2024-11-23 15:37:17 -08:00
parent 6757e9d617
commit c3b6a5549d
3 changed files with 38 additions and 19 deletions

View File

@@ -17,12 +17,25 @@
export PATH=${pkgs.mariadb}/bin:$PATH
export PATH=${pkgs.docker}/bin:$PATH
export PATH=${pkgs.docker-compose}/bin:$PATH
export PATH=${pkgs.caddy}/bin:$PATH
redis-server --daemonize yes
redis-server --daemonize yes
redis-cli ping
sleep 5
#mariadb-install-server
#php artisan serve --host=127.0.0.1 --port=8000
# Clean up and create directories for MariaDB data
echo "Deleting MariaDB data directory"
rm -rf $(pwd)/nix/docker/maria/mariadb_data
echo "Creating MariaDB data directory"
mkdir -p $(pwd)/nix/docker/maria/mariadb_data
bash ./nix/buildsteps.sh
redis-cli shutdown
'';
# Development shell
@@ -30,7 +43,7 @@
nativeBuildInputs = [
pkgs.php
pkgs.phpPackages.composer
pkgs.nginx
pkgs.caddy
pkgs.nodejs_20
pkgs.tmux
pkgs.redis
@@ -49,30 +62,17 @@
# Clean up and create directories for MariaDB data
echo "Deleting MariaDB data directory"
#rm -rf $(pwd)/nix/docker/maria/mariadb_data
rm -rf $(pwd)/nix/docker/maria/mariadb_data
echo "Creating MariaDB data directory"
mkdir -p $(pwd)/nix/docker/maria/mariadb_data
#echo "Creating MariaDB data directory"
#mkdir -p $(pwd)/nix/docker/maria/mariadb_data
echo "Run 'php artisan serve' to start the application."
'';
};
# NGINX configuration
nginxConfig = pkgs.writeText "nginx.conf" ''
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
'';
# Systemd services
nixosConfigurations.default = pkgs.lib.nixosSystem {
@@ -114,3 +114,4 @@
};
};
}

View File

@@ -93,12 +93,18 @@ php artisan p:node:configuration 1 >$(pwd)/nix/docker/wings/etc/config.yml
docker-compose --project-directory ./nix/docker/wings up -d --force-recreate
tmux new-session -s pyrodevelopment -d
tmux send-keys -t pyrodevelopment 'npm run dev' C-m
tmux new-window -t pyrodevelopment
tmux send-keys -t pyrodevelopment 'caddy run --config ./nix/caddyfile' C-m
tmux new-window -t pyrodevelopment
tmux send-keys -t pyrodevelopment 'php artisan serve' C-m
tmux attach-session -t pyrodevelopment
tmux kill-session -t pyrodevelopment

12
nix/caddyfile Normal file
View File

@@ -0,0 +1,12 @@
# Reverse proxy for pyrodactyl-panel
panel.localhost {
reverse_proxy 127.0.0.1:8000
tls internal
}
# Reverse proxy for pterodactyl-wings
wings.localhost {
reverse_proxy 127.0.0.1:8080
tls internal
}