Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a nixos development build for for local linux development #105

Open
wants to merge 67 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
3cbfe66
chore(package.json): axios 1.6.8->1.7.4
naterfute Aug 22, 2024
af4394a
Update flake.lock inputs
naterfute Aug 23, 2024
a19d6bc
Merge branch 'main' into nixos-build
naterfute Aug 23, 2024
626d6e3
flake building for develop now works
naterfute Aug 23, 2024
125bd61
add composer and php to flake.nix
naterfute Aug 23, 2024
0a2f1fc
added --admin tag to making user in vagrant
naterfute Aug 23, 2024
c28467d
added preinstall to flake.nix and more packages
naterfute Aug 25, 2024
53f95f8
removed cowsay and lolcat from packages
naterfute Aug 25, 2024
32e0282
borrowed pterodactyl panels flake.nix
naterfute Aug 28, 2024
e303fa7
added a warning about migrating from pterodactyl panel and to backup …
naterfute Aug 28, 2024
ad29b0c
huge changes bringing the build system that much closer to working
naterfute Aug 28, 2024
1385b85
add configuration.nix file
naterfute Aug 28, 2024
713434e
Added temp buildsteps file
naterfute Aug 29, 2024
e9c0a21
moved from mariadb to mysql
naterfute Aug 29, 2024
9471ada
stopped cp of .env.example to .env and fixed access list for mysql
naterfute Aug 29, 2024
b1cc035
updated shell.nix to only run composer update when running
naterfute Aug 29, 2024
64ccdac
fixed broken minecraft forge egg
naterfute Aug 29, 2024
36d52a6
before I break vagrant I took back the old configuration file as well
naterfute Aug 29, 2024
bff53be
Transitioned most systemd tasks to nixos task configurations and repl…
naterfute Aug 29, 2024
9c883c4
updated flake.lock with latest nix configuration
naterfute Aug 29, 2024
6ba2b45
everything up to starting wings is working, time to see if I can get …
naterfute Aug 29, 2024
812f043
added "--rm \" to buildsteps
naterfute Aug 29, 2024
14f9839
updated nginx config in hopes of it working. It did not work
naterfute Aug 29, 2024
52f68e8
fixed many issues and working on getting mariadb working properly
naterfute Sep 6, 2024
582c5df
fix: mariadb now gets initialized properly
naterfute Sep 7, 2024
a2c1a57
fix: update favicon & password reset (#91)
he3als Sep 8, 2024
b9e2c27
removed linux info for local development
naterfute Sep 16, 2024
46256fb
chore: moved buildsteps to nix folder
naterfute Sep 16, 2024
16b1a92
removed all unnecesary services in configuration.nix
naterfute Sep 16, 2024
af2c180
added docker-compose.yml so that the buildsteps file has something to do
naterfute Sep 16, 2024
bfbe0a3
Switching to using mysql in a docker container over inside the nix flake
naterfute Sep 16, 2024
fb5850e
Fix: Changed from nixos-unstable to nixos-24.05 packages
naterfute Sep 16, 2024
399d2b5
updated flake.lock to match packager version change
naterfute Sep 16, 2024
3b1d14f
fix: buildsteps script not connecting to mariadb server
naterfute Sep 16, 2024
fc26608
fix: wings didn't work in cli so made it a docker container and organ…
naterfute Sep 16, 2024
3aef4ec
As we include a Dockerfile now, we need to push .dockerignore for sma…
naterfute Sep 16, 2024
69c9cac
Merge branch 'main' into nixos-build
naterfute Sep 16, 2024
55237f9
fix: changed directory for wings docker container from ./nix/pterodac…
naterfute Sep 16, 2024
9d2a74b
fix: changed docker-compose paths in flake.nix
naterfute Sep 16, 2024
547ce90
fix: wings docker-compose.yml now uses network_mode host
naterfute Sep 17, 2024
c7c8d41
added some resets for mariadb and pterodactyl whenever the app is sta…
naterfute Sep 17, 2024
da81979
updated some nixos specific "Features" and ensure mariadb and wings f…
naterfute Sep 17, 2024
84e3c36
deleted mariadb reset in buildsteps and added 20 seconds for mariadb …
naterfute Sep 17, 2024
ababdce
added mariadb docker-compose file and added extra stuff to .gitignore
naterfute Sep 17, 2024
40923c5
added nix files to dockerignore
naterfute Sep 17, 2024
c6858d4
added linux development guide
naterfute Sep 17, 2024
97a3ff4
Disable recaptcha on setup
naterfute Sep 17, 2024
0d27d1f
docs: Formatting fixes
naterfute Sep 17, 2024
9c3540c
docs: Linux doesn't use vagrant anymore
naterfute Sep 17, 2024
c1d6992
docs: https does not work
naterfute Sep 17, 2024
9b7803d
docs: Added Prereqs for linux local development
naterfute Sep 17, 2024
7c5980f
docs: we do not need to be told about the docker image twice
naterfute Sep 17, 2024
5985695
Merge branch 'dev'
he3als Sep 21, 2024
707949b
deleted configuration.nix and decreased flake.nix clutter
naterfute Sep 24, 2024
3f2de83
Merge branch 'main' into nixos-build
naterfute Sep 24, 2024
b33a97b
docs(README): notes about local development on linux
naterfute Sep 25, 2024
d926d58
fixed some broken markdown formatting
naterfute Sep 25, 2024
5f40753
Revert last commit
naterfute Sep 25, 2024
3eb91d7
added one more VERY important step to readme
naterfute Sep 25, 2024
10d5a1a
added a few fixes with systems other than mine
naterfute Sep 25, 2024
f432553
added a run.sh file to easily run nixos
naterfute Sep 25, 2024
6fb311f
Added a env.nix file because it's configuration is slightly different…
naterfute Sep 25, 2024
3b30946
fix(README): use Git for cloning
he3als Sep 30, 2024
76a4e71
Updated pterodactyl discord links to pyrodactyl links
naterfute Sep 30, 2024
4d19b7e
added a health check to maria to ensure it's up before continuing
naterfute Oct 3, 2024
606ca73
Merge latest main pushes into nixos-build
naterfute Oct 4, 2024
631c720
removed benign sql query and added --no-interaction to key:generate
naterfute Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Vagrantfile
vagrant/
.swc/
.turbo/
nix/
flake.nix
flake.lock

50 changes: 50 additions & 0 deletions .env.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
APP_ENV=production
APP_DEBUG=false
APP_KEY=base64:70nPUP+VYp/0HXxmnXbM2BJO6E1+JizA1XhAf72bAG8=
APP_THEME=pterodactyl
APP_TIMEZONE=UTC
APP_URL="http://localhost:8000"
APP_LOCALE=en
APP_ENVIRONMENT_ONLY=false

# If you are using a proxy server set this to be
# the Proxy server's ip adddress.
# TRUSTED_PROXIES=*

LOG_CHANNEL=daily
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=panel
DB_USERNAME=pyrodactyluser
DB_PASSWORD=pyrodactyl

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

CACHE_DRIVER=redis
QUEUE_CONNECTION=redis
SESSION_DRIVER=redis

HASHIDS_SALT=qFr7NZGVVpsX79HvKPqv
HASHIDS_LENGTH=8

MAIL_MAILER=smtp
MAIL_HOST=smtp.example.com
MAIL_PORT=25
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
[email protected]
MAIL_FROM_NAME="Pterodactyl Panel"
# You should set this to your domain to prevent it defaulting to 'localhost', causing
# mail servers such as Gmail to reject your mail.
#
# @see: https://github.com/pterodactyl/panel/pull/3110
# MAIL_EHLO_DOMAIN=panel.example.com

APP_SERVICE_AUTHOR="[email protected]"
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
blank_issues_enabled: true
contact_links:
- name: Installation Help
url: https://discord.gg/pterodactyl
url: https://pyro.host/discord
about: Please visit our Discord for help with your installation.
- name: General Question
url: https://discord.gg/pterodactyl
url: https://pyro.host/discord
about: Please visit our Discord for general questions about Pterodactyl.
13 changes: 9 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ _ide_helper_models.php
public/assets/manifest.json

# For local development with docker
# Remove if we ever put the Dockerfile in the repo
.dockerignore
docker-compose.yml
#docker-compose.yml

# for image related files
misc
Expand All @@ -33,8 +31,15 @@ resources/lang/locales.js
/public/build
/public/hot
result
docker-compose.yaml
#docker-compose.yaml
.swc/
.turbo
# Sentry Config File
.env.sentry-build-plugin

# Nix specific stuff
nix/docker/wings/pterodactyl
nix/docker/maria/mariadata
nix/docker/wings/etc/
nix/docker/wings/lib/
nix/docker/maria/mariadb_data/
90 changes: 31 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,23 @@ Pyrodactyl is the Pterodactyl-based game server management panel that focuses on

## Running Pyrodactyl

> [!TIP]
> Pyrodactyl now [has a Docker image avaliable](https://github.com/pyrohost/pyrodactyl/pkgs/container/pyrodactyl), which for previous users of the Pterodactyl panel in Docker, should make it easy to migrate.
>
> If you want to setup Pyrodactyl in Docker from scratch, see the [`docker-compose.example.yml`](https://github.com/pyrohost/pyrodactyl/blob/main/docker-compose.example.yml).

> [!WARNING]
> Nothing is Perfect, that apply's to this panel.
> If you are migrating your data from pterodactyl, always make sure you take a backup of your pterodactyl database and other relevant data.

### Prerequisites

- Latest LTS version of NodeJS
- Git

### Linux

> [!TIP]
> Pyrodactyl now [has a Docker image avaliable](https://github.com/pyrohost/pyrodactyl/pkgs/container/pyrodactyl), which for previous users of the Pterodactyl panel in Docker, should make it easy to migrate.
>
> If you want to setup Pyrodactyl in Docker from scratch, see the [`docker-compose.example.yml`](https://github.com/pyrohost/pyrodactyl/blob/main/docker-compose.example.yml). You can follow [Pterodactyl's instructions](https://github.com/pterodactyl/panel/tree/1.0-develop/.github/docker#pterodactyl-panel---docker-image) on setting it up.
<details><summary>Running on Linux</summary>
<p>

Setting up Pyrodactyl is a breeze on Linux. Follow the [official Pterodactyl documentation](https://pterodactyl.io/panel/1.0/getting_started.html) for your distribution up to the **Download Files** step.

Expand All @@ -60,8 +66,7 @@ mkdir -p /var/www/pterodactyl
cd /var/www/pterodactyl

# Download and extract panel
curl -Lo main.tar.gz https://github.com/pyrohost/pyrodactyl/archive/refs/heads/main.tar.gz
tar -xzf main.tar.gz --strip-components=1 -C /var/www/pterodactyl pyrodactyl-main/
git clone https://github.com/pyrohost/pyrodactyl.git /var/www/pterodactyl --depth=2

# Permissions for caches
chmod -R 755 storage/* bootstrap/cache/
Expand All @@ -71,6 +76,7 @@ npm ci && npm run ship
```

Proceed with the rest of the installation as you would with the official panel.
</p></details>

### Windows

Expand Down Expand Up @@ -102,74 +108,40 @@ Pyrodactyl is the world's first Pterodactyl panel that can be developed and run

- We do not recommend using Hyper-V as your virtualization layer. If your Vagrant installation asks you for a password, this is because you used Hyper-V. The password will be your Windows password.
- We recommend using VMWare Workstation or VirtualBox instead.

</p>
</details>
</p></details>

<details><summary>On Linux</summary>
<p>

### Extra prerequsites

In addition to the previous prerequsites, you need:

- [Vagrant](https://www.vagrantup.com/)
- `libvirtd`
- `nfs-utils`

### Install nfs-utils

- **Fedora:** `sudo dnf install nfs-utils`

- **Ubuntu/Debian:** `sudo apt-get install nfs-kernel-server`
### Prerequisites

Afterwards, start it:
- Nix
- Docker

- `sudo systemctl start nfs-server`
- To have it start when your computer starts
- `sudo systemctl enable nfs-server`
Local Development on Linux is A little different, because vagrant is the buggy software that it is, I couldn't get it to run properly... Anywhere, and on no Distro.
So I decided that instead of using Vagrant, I would use nix. This turned out to be a very good idea. Now, using nix the development boots faster because we aren't using
an entire vm to host a development server, it also uses way less resources, and is much easier to configure exactly how you want through the nix/buildsteps.sh file.

### Notes about Local Development on Linux
### How to get started

Using [Vagrant](https://www.vagrantup.com) on Linux is incredibly simple. Verify you met the prerequsites above, then follow these simple steps:
To get started, you obviously need nix on your system, and you need to configure nix to support flake files. Depending on your OS, this can vary

1. Clone the Pyrodactyl panel repository
2. Run `npm i` to install all required packages
3. Run `npm run ship` to build Pyrodactyl. This will cache the results of the build and upload sourcemaps to Sentry. Subsequent builds without code changes will finish in milliseconds.
1. run `npm i` to install all the packages necessary.
1. Run `npm run ship` to build Pyrodactyl. This will cache the results of the build and upload sourcemaps to Sentry. Subsequent builds without code changes will finish in milliseconds.
1. Copy `.env.nix` to `.env`
1. Run `nix develop`. This will setup wings and the necessary services in order to run Pyrodactyl's databases, services, and app. This process could take up to 15 minutes.
1. Once you receive a message that says "Pyrodactyl is now up and running at localhost:8000", visit that URL in your browser and login with the default credentials provided in your console. **It's important that you use localhost to connect to Pyrodactyl! If you use 127.0.0.1, you will run into CORS issues and other issues that will not be fixed.**
1. Visit http://localhost:8000/admin to provision your first server on Pyrodactyl!

> [!IMPORTANT]
> In order for `vagrant up` to work, your files must be in the `/var/www/pterodactyl` directory unless manually changed in the `Vagrantfile`!

4. Run `vagrant up`. This will setup wings and the necessary services in order to run Pyrodactyl's databases, services, and app. This process could take up to 15 minutes.
5. Once you receive a message that says "Pyrodactyl is now up and running at localhost:3000", visit that URL in your browser and login with the default credentials provided in your console. **It's important that you use localhost to connect to Pyrodactyl! If you use 127.0.0.1, you will run into CORS issues and other issues that will not be fixed.**

### Notes about Local Development on Linux

- If your having trouble installing Virtualbox on linux, you can try to follow instructions in these [docs](https://github.com/pyrohost/pyrodactyl/blob/main/VirtualBoxSetup.md)

- It should be stated that when running on Linux, if you are using a virtual machine manager other than libvirtd, you will have to add your configuration to the [Vagrantfile](https://github.com/pyrohost/pyrodactyl/blob/main/Vagrantfile). If not, it will boot the VM with 512 mb of ram, which is not enough to build Pyrodactyl!

- There might be a weird bug the first time you run `vagrant up`, where you get an error like this:
Due to a slight bug or two, pterodactyl wings does not as present work properly using the nixos development environment\
This will hopefully be fixed later, but for now just be warned

```
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3,udp xxx.xxx.xxx.x:/home/user/pyrodactyl /var/www/pterodactyl

Stdout from the command:

Stderr from the command:

mount.nfs: Connection refused
```

If this happens, just re-run `vagrant up` and it should work.

- If you're having permission errors, try running using sudo, e.g `sudo vagrant up`

</p>
</details>
</p></details>

## Star History

Expand Down
Loading