think.greaterchiangmai.com is running on ramus
This commit is contained in:
16
tests/default.nix
Normal file
16
tests/default.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{ self, ... }:
|
||||
{
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
checks =
|
||||
let
|
||||
checkArgs = {
|
||||
inherit pkgs self;
|
||||
};
|
||||
in
|
||||
{
|
||||
think-gtcm = import ./tests/think-gtcm.nix checkArgs;
|
||||
};
|
||||
};
|
||||
}
|
||||
18
tests/lib.nix
Normal file
18
tests/lib.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
test:
|
||||
# These arguments are provided by `flake.nix` on import, see checkArgs
|
||||
{ pkgs, self }:
|
||||
let
|
||||
inherit (pkgs) lib;
|
||||
# this imports the nixos library that contains our testing framework
|
||||
nixos-lib = import (pkgs.path + "/nixos/lib") { };
|
||||
in
|
||||
(nixos-lib.runTest {
|
||||
hostPkgs = pkgs;
|
||||
# This speeds up the evaluation by skipping evaluating documentation (optional)
|
||||
defaults.documentation.enable = lib.mkDefault false;
|
||||
# This makes `self` available in the NixOS configuration of our virtual machines.
|
||||
# This is useful for referencing modules or packages from your own flake
|
||||
# as well as importing from other flakes.
|
||||
node.specialArgs = { inherit self; };
|
||||
imports = [ test ];
|
||||
}).config.result
|
||||
102
tests/tests/think-gtcm.nix
Normal file
102
tests/tests/think-gtcm.nix
Normal file
@@ -0,0 +1,102 @@
|
||||
(import ../lib.nix) {
|
||||
name = "think-gtcm";
|
||||
nodes =
|
||||
let
|
||||
settings = {
|
||||
|
||||
DB_CONNECTION = "mysql";
|
||||
DB_HOST = "localhost";
|
||||
DB_PORT = 3306;
|
||||
DB_DATABASE = "thinkgtcm";
|
||||
DB_USERNAME = "gtcm";
|
||||
DB_PASSWORD = "";
|
||||
|
||||
APP_NAME = "Laravel";
|
||||
APP_ENV = "local";
|
||||
APP_DEBUG = "false";
|
||||
APP_URL = "http://localhost";
|
||||
|
||||
LOG_CHANNEL = "stack";
|
||||
LOG_LEVEL = "debug";
|
||||
|
||||
BROADCAST_DRIVER = "log";
|
||||
CACHE_DRIVER = "file";
|
||||
FILESYSTEM_DISK = "local";
|
||||
QUEUE_CONNECTION = "sync";
|
||||
SESSION_DRIVER = "file";
|
||||
SESSION_LIFETIME = "120";
|
||||
|
||||
MEMCACHED_HOST = "127.0.0.1";
|
||||
|
||||
REDIS_HOST = "127.0.0.1";
|
||||
REDIS_PASSWORD = "null";
|
||||
REDIS_PORT = "6379";
|
||||
|
||||
MAIL_MAILER = "smtp";
|
||||
MAIL_HOST = "mailpit";
|
||||
MAIL_PORT = "1025";
|
||||
MAIL_USERNAME = "null";
|
||||
MAIL_PASSWORD = "null";
|
||||
MAIL_ENCRYPTION = "null";
|
||||
MAIL_FROM_ADDRESS = "hello@example.com";
|
||||
|
||||
AWS_DEFAULT_REGION = "us-east-1";
|
||||
AWS_USE_PATH_STYLE_ENDPOINT = "false";
|
||||
|
||||
PUSHER_PORT = 443;
|
||||
PUSHER_SCHEME = "https";
|
||||
PUSHER_APP_CLUSTER = "mt1";
|
||||
|
||||
UPLOAD_MAX_FILESIZE = "5000M";
|
||||
POST_MAX_SIZE = "5000M";
|
||||
|
||||
TEST_LOCAL = "false";
|
||||
};
|
||||
in
|
||||
{
|
||||
gtcm1 =
|
||||
{ self, ... }:
|
||||
{
|
||||
nixpkgs.overlays = [ self.overlays.packagesOverlay ];
|
||||
imports = [ self.nixosModules.think-gtcm ];
|
||||
services.think-greaterchiangmai = {
|
||||
enable = true;
|
||||
settings = settings // {
|
||||
APP_SERVICES_CACHE = "/run/think-gtcm/cache/services.php";
|
||||
APP_PACKAGES_CACHE = "/run/think-gtcm/cache/packages.php";
|
||||
APP_CONFIG_CACHE = "/run/think-gtcm/cache/config.php";
|
||||
APP_ROUTES_CACHE = "/run/think-gtcm/cache/routes-v7.php";
|
||||
APP_EVENTS_CACHE = "/run/think-gtcm/cache/events.php";
|
||||
};
|
||||
};
|
||||
};
|
||||
backend1 =
|
||||
{ self, ... }:
|
||||
{
|
||||
nixpkgs.overlays = [ self.overlays.packagesOverlay ];
|
||||
imports = [ self.nixosModules.think-backend-gtcm ];
|
||||
services.think-backend-greaterchiangmai = {
|
||||
enable = true;
|
||||
settings = settings // {
|
||||
APP_SERVICES_CACHE = "/run/think-backend-gtcm/cache/services.php";
|
||||
APP_PACKAGES_CACHE = "/run/think-backend-gtcm/cache/packages.php";
|
||||
APP_CONFIG_CACHE = "/run/think-backend-gtcm/cache/config.php";
|
||||
APP_ROUTES_CACHE = "/run/think-backend-gtcm/cache/routes-v7.php";
|
||||
APP_EVENTS_CACHE = "/run/think-backend-gtcm/cache/events.php";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
# This is the test code that will check if our service is running correctly:
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
gtcm1.wait_for_unit("phpfpm-think-gtcm")
|
||||
gtcm1.wait_for_open_port(80)
|
||||
output = gtcm1.succeed("curl localhost")
|
||||
|
||||
backend1.wait_for_unit("phpfpm-think-backend-gtcm")
|
||||
backend1.wait_for_open_port(80)
|
||||
output = backend1.succeed("curl localhost")
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user