-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
203 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
.idea | ||
.direnv | ||
/bin | ||
/tmp | ||
/vendor | ||
/rooter | ||
/result | ||
box.phar | ||
rooter.phar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,46 +18,12 @@ This guide assumes you have successfully installed: | |
|
||
What exactly is being installed on macOS is documented here: https://nixos.org/manual/nix/stable/installation/installing-binary.html#macos-installation. | ||
|
||
## Installation | ||
## Installation via flake | ||
|
||
Clone the rooter repository to your local and change directory to rooter | ||
```bash | ||
git clone [email protected]:run_as_root/internal/rooter.git rooter | ||
cd rooter | ||
``` | ||
No we need to download all dependencies using nix. | ||
This can be triggered using direnv or using nix. | ||
Choose one: | ||
|
||
1. direnv | ||
```bash | ||
direnv allow . | ||
``` | ||
|
||
2. nix | ||
```bash | ||
nix-shell | ||
# … wait for the process to finish, it will take quite a few minutes if executed for the first time | ||
exit # exit the shell | ||
``` | ||
|
||
Install Composer dependencies required to executed rooter | ||
```bash | ||
composer install | ||
``` | ||
|
||
Now that all dependencies are installed, we can continue with the rooter installation. | ||
It will initialise directories, configurations, process, ssl certs, etc. | ||
```bash | ||
./rooter install | ||
nix profile install --accept-flake-config "git+ssh://[email protected]/run_as_root/internal/rooter.git?ref=main" | ||
``` | ||
|
||
Last but not least, we suggest to make sure rooter binary is globally available. | ||
For that you should either create | ||
- an alias for rooter in you `~/.basrc` or `~/.zshrc` e.g. `alias rooter=/<path-to-rooter>/rooter` | ||
- or create a symlink in any dir that is included in your path | ||
- or add the rooter directory to the PATH `export $PATH="$PATH:/<path-to-rooter>/rooter"` | ||
|
||
## Project setup | ||
|
||
### Quickstart | ||
|
@@ -85,7 +51,7 @@ Manually add `.devenv/` and `.env` to .gitignore | |
|
||
This command will also create a `.env` file in your project root or overwrite values for rooter. | ||
It will find available ports for the project and write them to the .env file. | ||
Ports will selected from a range defined for each service type. | ||
Ports will be selected from a range defined for each service type. | ||
|
||
### Configure auto-initialisation | ||
|
||
|
@@ -205,9 +171,53 @@ see [TEMPLATES.md](docs/TEMPLATES.md) | |
|
||
## DEVELOPMENT | ||
|
||
For local development of rooter you can use the default installation. | ||
PHP Debugging can be enabled by replacing this line in ``shell.nix``: | ||
### Installation Development | ||
|
||
Clone the rooter repository to your local and change directory to rooter | ||
```bash | ||
git clone [email protected]:run_as_root/internal/rooter.git rooter | ||
cd rooter | ||
``` | ||
No we need to download all dependencies using nix. | ||
This can be triggered using direnv or using nix. | ||
Choose one: | ||
|
||
1. direnv | ||
```bash | ||
direnv allow . | ||
``` | ||
use nix -o shell.dev.nix | ||
|
||
2. nix | ||
```bash | ||
nix-shell | ||
# … wait for the process to finish, it will take quite a few minutes if executed for the first time | ||
exit # exit the shell | ||
``` | ||
|
||
Install Composer dependencies required to executed rooter | ||
```bash | ||
composer install | ||
``` | ||
|
||
Now that all dependencies are installed, we can continue with the rooter installation. | ||
It will initialise directories, configurations, process, ssl certs, etc. | ||
```bash | ||
./rooter install | ||
``` | ||
|
||
Last but not least, we suggest to make sure rooter binary is globally available. | ||
For that you should either create | ||
- an alias for rooter in you `~/.basrc` or `~/.zshrc` e.g. `alias rooter=/<path-to-rooter>/rooter` | ||
- or create a symlink in any dir that is included in your path | ||
- or add the rooter directory to the PATH `export $PATH="$PATH:/<path-to-rooter>/rooter"` | ||
|
||
### Using dev version of rooter | ||
|
||
For local development of rooter you can use the default installation. | ||
|
||
```bash | ||
nix build ".#rooterDev" --impure | ||
alias rooter-dev="<path-to-rooter>/rooter/result/bin/rooterDev" | ||
# optional per environment: | ||
export ROOTER_BIN="/Volumes/MyData/Entwicklung/Workspace/run-as-root/rooter/result/bin/rooterDev" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
{ | ||
description = "rooter"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; | ||
utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { | ||
self, | ||
utils, | ||
nixpkgs, | ||
... | ||
} @ inputs: | ||
utils.lib.eachDefaultSystem (system: | ||
let | ||
pkgs = nixpkgs.legacyPackages.${system}; | ||
# @todo adapt PHP version if required | ||
php = pkgs.php82.buildEnv { | ||
extensions = { all, enabled }: with all; enabled; | ||
extraConfig = '' | ||
memory_limit=-1 | ||
''; | ||
}; | ||
phpDev = pkgs.php82.buildEnv { | ||
extensions = { all, enabled }: with all; enabled ++ [ xdebug ]; | ||
extraConfig = '' | ||
memory_limit=-1 | ||
xdebug.mode=debug | ||
''; | ||
}; | ||
in rec { | ||
packages.php = php; | ||
packages.rooter = | ||
let | ||
inherit (pkgs) stdenv lib; | ||
magerun = builtins.fetchurl { | ||
# @todo fetch rooter.phar from github releases | ||
url = "https://github.com/netz98/n98-magerun2/releases/download/7.2.0/n98-magerun2.phar"; | ||
sha256 = "0z1dkxz69r9r9gf8xm458zysa51f1592iymcp478wjx87i6prvn3"; | ||
}; | ||
in | ||
pkgs.writeScriptBin "rooter" '' | ||
#!${pkgs.stdenv.shell} | ||
${php}/bin/php ${magerun} "$@" | ||
''; | ||
|
||
packages.rooterDev = | ||
let | ||
inherit (pkgs) stdenv lib; | ||
PROJECT_ROOT = builtins.getEnv "PWD"; | ||
in | ||
pkgs.writeShellScriptBin "rooterDev" '' | ||
${phpDev}/bin/php ${PROJECT_ROOT}/rooter.php "$@" | ||
''; | ||
|
||
packages.rooterDevPhar = | ||
let | ||
inherit (pkgs) stdenv lib; | ||
box = builtins.fetchurl { | ||
url = "https://github.com/box-project/box/releases/download/4.3.8/box.phar"; | ||
sha256 = "061vrxjvmqxy4yyi6j6i28kwl6ixfwhc743b6lw7bjgc4kdkvml3"; | ||
}; | ||
rooterPharLocal = pkgs.stdenv.mkDerivation { | ||
name = "rooterPharBin"; | ||
src = self; | ||
buildPhase = " | ||
${pkgs.php82Packages.composer}/bin/composer install | ||
${phpDev}/bin/php ${box} compile --composer-bin=${pkgs.php82Packages.composer}/bin/composer | ||
"; | ||
installPhase = " | ||
mkdir -p $out/bin; | ||
install -t $out/bin rooter.phar; | ||
"; | ||
}; | ||
in | ||
pkgs.writeShellScriptBin "rooterDevPhar" '' | ||
${phpDev}/bin/php ${rooterPharLocal}/bin/rooter.phar "$@" | ||
''; | ||
|
||
defaultPackage = self.packages.${system}.rooter; | ||
|
||
devShell = pkgs.mkShell { | ||
buildInputs = [phpDev]; | ||
}; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters