forked from hswaw/hscloud
parent
bfe9bb0e3a
commit
b1de757249
|
@ -31,6 +31,7 @@ in fix (self: rec {
|
||||||
|
|
||||||
bgpwtf = readTree config ./bgpwtf;
|
bgpwtf = readTree config ./bgpwtf;
|
||||||
cluster = readTree config ./cluster;
|
cluster = readTree config ./cluster;
|
||||||
|
hswaw = readTree config ./hswaw;
|
||||||
ops = readTree config ./ops;
|
ops = readTree config ./ops;
|
||||||
|
|
||||||
pkgs = nixpkgs;
|
pkgs = nixpkgs;
|
||||||
|
|
|
@ -37,10 +37,8 @@ _TODO(q3k): move this to the bazel codelab once it's finished_
|
||||||
Deployment
|
Deployment
|
||||||
----------
|
----------
|
||||||
|
|
||||||
You'll need root access to customs.
|
This runs on customs.hackerspace.pl, which is a NixOS box with its own independant configuration. It imports hscloud and builds the `hswaw.laserproxy` attribute. You can replicate this by running:
|
||||||
|
|
||||||
bazel build --platforms=@io_bazel_rules_go//go/toolchain:openbsd_amd64 //hswaw/laserproxy
|
nix-build -A hswaw.laserproxy
|
||||||
ssh root@customs supervisorctl stop laserproxy
|
|
||||||
scp bazel-bin/hswaw/laserproxy/laserproxy_/laserproxy root@customs:/var/laserproxy/laserproxy
|
|
||||||
ssh root@customs supervisorctl start laserproxy
|
|
||||||
|
|
||||||
|
From the root of hscloud. To actually deploy it on customs, well, ssh there and upate `/etc/nixos/configuration.nix`. Some day its configuration might also get ported to hscloud.
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
{ hscloud, pkgs, ... }:
|
||||||
|
|
||||||
|
# This supports building laserproxy in nix, which is used for deploying it to customs.
|
||||||
|
# This is mildly hacky and should be reworked to function for any hscloud bazel target
|
||||||
|
# in a more generic fashion.
|
||||||
|
#
|
||||||
|
# To build:
|
||||||
|
# ~/hscloud $ nix-build -A hswaw.laserproxy
|
||||||
|
|
||||||
|
pkgs.buildBazelPackage rec {
|
||||||
|
name = "laserproxy";
|
||||||
|
src = hscloud.root;
|
||||||
|
bazelTarget = "//hswaw/laserproxy";
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
git python3 postgresql go
|
||||||
|
];
|
||||||
|
patches = [
|
||||||
|
./nix-disable-uwsgi.patch
|
||||||
|
./nix-use-system-go.patch
|
||||||
|
./nix-disable-workspace-status.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
removeRulesCC = false;
|
||||||
|
fetchConfigured = true;
|
||||||
|
fetchAttrs = {
|
||||||
|
inherit patches;
|
||||||
|
# Nicked from nixpkgs usages of buildBazelPackage.
|
||||||
|
preInstall = ''
|
||||||
|
rm -rf $bazelOut/external/{go_sdk,\@go_sdk.marker}
|
||||||
|
sed -e '/^FILE:@go_sdk.*/d' -i $bazelOut/external/\@*.marker
|
||||||
|
|
||||||
|
chmod -R 755 $bazelOut/external/{bazel_gazelle_go_repository_cache,@\bazel_gazelle_go_repository_cache.marker}
|
||||||
|
rm -rf $bazelOut/external/{bazel_gazelle_go_repository_cache,@\bazel_gazelle_go_repository_cache.marker}
|
||||||
|
|
||||||
|
rm -rf $bazelOut/external/{bazel_gazelle_go_repository_tools,\@bazel_gazelle_go_repository_tools.marker}
|
||||||
|
sed -e '/^FILE:@bazel_gazelle_go_repository_tools.*/d' -i $bazelOut/external/\@*.marker
|
||||||
|
'';
|
||||||
|
sha256 = "0d0vlls1i0nmlqiszfhwb0cn1kwll3ffxd3sn30pk7drhfrbvqhf";
|
||||||
|
};
|
||||||
|
buildAttrs = {
|
||||||
|
inherit patches;
|
||||||
|
installPhase = ''
|
||||||
|
install -Dm755 bazel-bin/hswaw/laserproxy/*/laserproxy $out/bin/laserproxy
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
diff --git a/third_party/py/requirements.txt b/third_party/py/requirements.txt
|
||||||
|
index 94765d7..d7f0f3d 100644
|
||||||
|
--- a/third_party/py/requirements.txt
|
||||||
|
+++ b/third_party/py/requirements.txt
|
||||||
|
@@ -42,6 +42,5 @@ six==1.12.0
|
||||||
|
SQLAlchemy==1.3.8
|
||||||
|
sqlparse==0.3.0
|
||||||
|
urllib3==1.25.3
|
||||||
|
-uWSGI==2.0.18
|
||||||
|
Werkzeug==0.15.5
|
||||||
|
WTForms==2.2.1
|
|
@ -0,0 +1,11 @@
|
||||||
|
diff --git a/.bazelrc b/.bazelrc
|
||||||
|
index 419641e..207ae15 100644
|
||||||
|
--- a/.bazelrc
|
||||||
|
+++ b/.bazelrc
|
||||||
|
@@ -3,6 +3,5 @@ build --host_force_python=PY2
|
||||||
|
test --host_force_python=PY2
|
||||||
|
run --host_force_python=PY2
|
||||||
|
build --stamp
|
||||||
|
-build --workspace_status_command=./bzl/workspace-status.sh
|
||||||
|
test --build_tests_only
|
||||||
|
test --test_output=errors
|
|
@ -0,0 +1,13 @@
|
||||||
|
diff --git a/third_party/nix/repository_rules.bzl b/third_party/nix/repository_rules.bzl
|
||||||
|
index 35c3d2d..3386d4b 100644
|
||||||
|
--- a/third_party/nix/repository_rules.bzl
|
||||||
|
+++ b/third_party/nix/repository_rules.bzl
|
||||||
|
@@ -16,7 +16,7 @@ def hscloud_go_register_toolchains():
|
||||||
|
imports_for_non_nix = """
|
||||||
|
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
|
||||||
|
def hscloud_go_register_toolchains():
|
||||||
|
- go_register_toolchains()
|
||||||
|
+ go_register_toolchains(go_version="host")
|
||||||
|
"""
|
||||||
|
|
||||||
|
if has_nix(ctx):
|
Loading…
Reference in New Issue