summaryrefslogtreecommitdiffstats
path: root/demo
diff options
context:
space:
mode:
Diffstat (limited to 'demo')
-rw-r--r--demo/Dockerfile44
-rw-r--r--demo/fly.toml35
-rwxr-xr-xdemo/loggen.py54
3 files changed, 133 insertions, 0 deletions
diff --git a/demo/Dockerfile b/demo/Dockerfile
new file mode 100644
index 0000000..25ded84
--- /dev/null
+++ b/demo/Dockerfile
@@ -0,0 +1,44 @@
+
+FROM debian:11.3-slim
+
+RUN set -eux; \
+ export DEBIAN_FRONTEND=noninteractive; \
+ apt update; \
+ apt install --yes --no-install-recommends bind9-dnsutils iputils-ping iproute2 curl ca-certificates htop wget unzip openssh-server; \
+ apt clean autoclean; \
+ apt autoremove --yes; \
+ rm -rf /var/lib/{apt,dpkg,cache,log}/; \
+ echo "Installed base utils!"
+
+ADD https://github.com/tstack/lnav/releases/download/v0.11.0/lnav-0.11.0-musl-64bit.zip /
+RUN unzip lnav-0.11.0-musl-64bit.zip
+
+COPY docs/tutorials tutorials
+RUN gunzip /tutorials/playground/logs/*.gz
+
+RUN useradd -rm -d /home/playground -s /bin/bash playground
+RUN echo 'playground:playground' | chpasswd
+RUN passwd -d playground
+
+RUN useradd -rm -d /home/tutorial1 -s /bin/bash tutorial1
+RUN echo 'tutorial1:tutorial1' | chpasswd
+RUN passwd -d tutorial1
+
+USER playground
+RUN /lnav-0.11.0/lnav -nN -c ":config /ui/theme monocai"
+
+USER tutorial1
+RUN /lnav-0.11.0/lnav -nN -c ":config /ui/theme monocai"
+
+USER root
+
+RUN echo 'Match User playground' >> /etc/ssh/sshd_config
+RUN echo 'ForceCommand env PATH=/lnav-0.11.0:$PATH /tutorials/playground/run.sh' >> /etc/ssh/sshd_config
+RUN echo 'PermitEmptyPasswords yes' >> /etc/ssh/sshd_config
+RUN echo 'Match User tutorial1' >> /etc/ssh/sshd_config
+RUN echo 'ForceCommand env PATH=/lnav-0.11.0:$PATH /tutorials/tutorial1/run.sh' >> /etc/ssh/sshd_config
+RUN echo 'PermitEmptyPasswords yes' >> /etc/ssh/sshd_config
+RUN service ssh start
+EXPOSE 22
+
+CMD ["/usr/sbin/sshd", "-D"]
diff --git a/demo/fly.toml b/demo/fly.toml
new file mode 100644
index 0000000..75affba
--- /dev/null
+++ b/demo/fly.toml
@@ -0,0 +1,35 @@
+# fly.toml file generated for lnav-demo on 2022-08-22T10:26:28-07:00
+
+app = "lnav-demo"
+kill_signal = "SIGINT"
+kill_timeout = 5
+processes = []
+
+[env]
+
+[experimental]
+ allowed_public_ports = []
+ auto_rollback = true
+
+[[services]]
+ http_checks = []
+ internal_port = 22
+ processes = ["app"]
+ protocol = "tcp"
+ script_checks = []
+ [services.concurrency]
+ hard_limit = 25
+ soft_limit = 20
+ type = "connections"
+
+ [[services.ports]]
+ port = 22
+
+ [[services.tcp_checks]]
+ grace_period = "1s"
+ interval = "15s"
+ restart_limit = 0
+ timeout = "2s"
+
+[build]
+image = "lnav-demo"
diff --git a/demo/loggen.py b/demo/loggen.py
new file mode 100755
index 0000000..6790a09
--- /dev/null
+++ b/demo/loggen.py
@@ -0,0 +1,54 @@
+import datetime
+import os
+import random
+import shutil
+import sys
+
+MSGS = [
+ "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
+ "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
+ "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
+ "Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
+]
+
+GLOG_DATE_FMT = "%Y%m%d %H:%M:%S"
+
+START_TIME = datetime.datetime.fromtimestamp(1490191111)
+
+try:
+ shutil.rmtree("/tmp/demo")
+ os.makedirs("/tmp/demo")
+except OSError:
+ pass
+
+PIDS = [
+ "123",
+ "123",
+ "123",
+ "121",
+ "124",
+ "123",
+ "61456",
+ "61456",
+ "61457",
+]
+
+LOG_LOCS = [
+ "demo.cc:123",
+ "demo.cc:352",
+ "loader.cc:13",
+ "loader.cc:552",
+ "blaster.cc:352",
+ "blaster.cc:112",
+ "blaster.cc:6782",
+]
+
+CURR_TIME = START_TIME
+for _index in range(0, int(sys.argv[1])):
+ CURR_TIME += datetime.timedelta(seconds=random.randrange(1, 22))
+ print("I%s.%06d %s %s] %s" % (
+ CURR_TIME.strftime(GLOG_DATE_FMT),
+ random.randrange(0, 100000),
+ random.choice(PIDS),
+ random.choice(LOG_LOCS),
+ random.choice(MSGS)))