Ready to test in Fab

This commit is contained in:
2023-06-03 19:05:08 -07:00
parent 1f5deedc73
commit 2c38ecb399
46 changed files with 1159 additions and 347 deletions

View File

@ -0,0 +1,13 @@
---
---
# apt-get-install
sudo -i
apt-get install links unzip net-tools ufw nginx git -y
## Sub-tasks
- [x] phares3757
- [x] unity4
- [x] unity5

View File

@ -0,0 +1,72 @@
---
---
# configure-ufw
```bash
sudo -i
ufw allow from 192.168.0.0/24 to any port 22 comment "01) SSH"
ufw allow to 0.0.0.0/0 port 80 comment "02) HTTP"
ufw allow to 0.0.0.0/0 port 443 comment "03) HTTPS"
ufw allow to 0.0.0.0/0 port 9418 comment "04) Git"
ufw allow from 192.168.0.0/24 to any port 8005 comment "05) Pi-hole"
ufw allow from 192.168.0.0/24 to any port 8006 comment "06) Ajenti"
ufw allow from 192.168.0.0/24 to any port 8007 comment "07) code-server"
ufw allow from 192.168.0.0/24 to any port 8008 comment "08) Nginx"
ufw allow from 192.168.0.0/24 to any port 5002 comment "09) BaGet"
ufw allow to 0.0.0.0/0 port 5000 comment "10) .netCore"
ufw allow to 0.0.0.0/0 port 5001 comment "11) .netCore"
ufw allow from 192.168.0.0/24 to any port 53 comment "12) DNS"
ufw allow from 192.168.0.0/24 to any port 67 comment "13) Unknown"
ufw allow from 192.168.0.0/24 to any port 9654 comment "14) barcode-server"
ufw allow from 192.168.0.0/24 to any port 8009 comment "15) barcode-server-statistics"
ufw allow from 0.0.0.0/0 to any port 9400 comment "16) dashkiosk"
ufw delete 16
ufw allow from 0.0.0.0/0 to any port 8010 comment "16) Test"
ufw allow from 0.0.0.0/0 to any port 5052 comment "17) NGINdeX.io"
ufw allow from 0.0.0.0/0 to any port 3000 comment "18) gogs"
ufw allow from 0.0.0.0/0 to any port 4001 comment "19) gogs"
ufw delete 19
ufw allow from 192.168.0.0/24 to any port 4001 comment "19) photoview api"
ufw allow from 192.168.0.0/24 to any port 1234 comment "20) photoview ui"
ufw allow from 192.168.0.0/24 to any port 3306 comment "21) mysql"
ufw allow from 192.168.0.0/24 to any port 8011 comment "22) syncthing"
ufw allow from 0.0.0.0/0 to any port 5201 comment "23) iperf3"
ufw enable
ufw status numbered
```
```conf
Status: active
To Action From
-- ------ ----
[ 1] 22 ALLOW IN 192.168.0.0/24 # 01) SSH
[ 2] 80 ALLOW IN Anywhere # 02) HTTP
[ 3] 443 ALLOW IN Anywhere # 03) HTTPS
[ 4] 9418 ALLOW IN Anywhere # 04) Git
[ 5] 8005 ALLOW IN 192.168.0.0/24 # 05) Pi-hole
[ 6] 8006 ALLOW IN 192.168.0.0/24 # 06) Ajenti
[ 7] 8007 ALLOW IN 192.168.0.0/24 # 07) code-server
[ 8] 8008 ALLOW IN 192.168.0.0/24 # 08) Nginx
[ 9] 5002 ALLOW IN 192.168.0.0/24 # 09) BaGet
[10] 5000 ALLOW IN Anywhere # 10) .netCore
[11] 5001 ALLOW IN Anywhere # 11) .netCore
[12] 53 ALLOW IN 192.168.0.0/24 # 12) DNS
[13] 67 ALLOW IN 192.168.0.0/24 # 13) Unknown
[14] 9654 ALLOW IN 192.168.0.0/24 # 14) barcode-server
[15] 8009 ALLOW IN 192.168.0.0/24 # 15) barcode-server-statistics
[16] 8010 ALLOW IN Anywhere # 16) Test
[17] 5052 ALLOW IN Anywhere # 17) NGINdeX.io
[18] 3000 ALLOW IN Anywhere # 18) gogs
[19] 4001 ALLOW IN 192.168.0.0/24 # 19) photoview api
[20] 1234 ALLOW IN 192.168.0.0/24 # 20) photoview ui
[21] 3306 ALLOW IN 192.168.0.0/24 # 21) mysql
[22] 8011 ALLOW IN 192.168.0.0/24 # 22) syncthing
[23] 5201 ALLOW IN Anywhere # 23) iperf3
```
## Sub-tasks
- [x] phares3757
- [x] unity4
- [x] unity5

View File

@ -0,0 +1,40 @@
---
---
# Create as Service
```bash
sudo -i
echo >/etc/systemd/system/barcode-host.service && nano /etc/systemd/system/barcode-host.service
```
```conf
[Unit]
Description=Barcode Server
After=multi-user.target
[Service]
User=unity4
WorkingDirectory=/var/www/Barcode-Host/Server
ExecStart=/usr/local/bin/dotnet /var/www/Barcode-Host/Server/Barcode.Host.Server.dll
Restart=always
# Environment=ASPNETCORE_ENVIRONMENT=Development
# Environment=ASPNETCORE_ENVIRONMENT=Staging
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
```
```bash
systemctl daemon-reload
systemctl enable barcode-host.service
systemctl start barcode-host.service
systemctl status barcode-host.service
systemctl stop barcode-host.service
journalctl -fu barcode-host.service
journalctl --rotate
journalctl --vacuum-time=1s
```
## Sub-tasks
- [ ] phares3757
- [x] unity4
- [x] unity5

View File

@ -0,0 +1,22 @@
---
---
# Install .net 7.0
```bask
# https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install
cd /home/unity4
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
chmod +x ./dotnet-install.sh
./dotnet-install.sh --channel 7.0
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools
ln -s /home/unity4/.dotnet/dotnet /usr/local/bin/dotnet
dotnet --info
```
## Sub-tasks
- [x] phares3757
- [x] unity4
- [x] unity5

View File

@ -0,0 +1,24 @@
---
---
# install-ubuntu-frame
```bash
apt-get install links unzip net-tools -y
snap install dashkiosk
timedatectl set-timezone America/Phoenix
snap restart dashkiosk
snap install ubuntu-frame wpe-webkit-mir-kiosk
snap set wpe-webkit-mir-kiosk daemon=true
snap set wpe-webkit-mir-kiosk url=http://localhost:9400/receiver
wpe-webkit-mir-kiosk.cog http://localhost:9400/receiver
/snap/wpe-webkit-mir-kiosk/current/bin/setup.sh
wpe-webkit-mir-kiosk.cog http://localhost:9400/receiver
snap set ubuntu-frame daemon=true
```
## Sub-tasks
- [ ] phares3757
- [x] unity4
- [x] unity5

View File

@ -0,0 +1,15 @@
---
---
# install-vscode-extensions
- .NET Watch Attach (trottero.dotnetwatchattach)
- C# (ms-dotnettools.csharp)
- Git Graph (mhutchie.git-graph)
- Live Preview (ms-vscode.live-server)
## Sub-tasks
- [x] phares3757
- [x] unity4
- [x] unity5

60
.kanbn/tasks/netplan.md Normal file
View File

@ -0,0 +1,60 @@
---
---
# netplan
```bash
ip link
```
```echo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 10
link/ether 6c:0b:84:e3:94:11 brd ff:ff:ff:ff:ff:ff
altname enp0s31f6
```
```bash
https://ubuntu.com/server/docs/network-configuration
ip a
ip address show eno1
echo >/etc/netplan/99_config.yaml && nano /etc/netplan/99_config.yaml
```
```bash
network:
version: 2
renderer: networkd
ethernets:
eno1:
addresses:
- 192.168.0.204/24
routes:
- to: default
via: 192.168.0.1
nameservers:
addresses: [192.168.0.1, 8.8.8.8, 4.4.4.4]
```
```bash
netplan apply
ip addr flush eno1
# soft reset
```
```bash
network:
version: 2
renderer: networkd
ethernets:
eno1:
addresses:
- 10.95.154.54/24
routes:
- to: default
via: 10.95.154.1
nameservers:
addresses: [10.95.128.11, 10.64.152.171, 8.8.8.8, 4.4.4.4]
```
## Sub-tasks
- [ ] phares3757
- [x] unity4
- [x] unity5

35
.kanbn/tasks/publish.md Normal file
View File

@ -0,0 +1,35 @@
---
---
# publish
```bash
sudo -i
systemctl stop barcode-host.service
rm -r /var/www/Barcode-Host/Server
mkdir /var/www
mkdir /var/www/Barcode-Host
mkdir /var/www/Barcode-Host/Server
cd /home/unity4/Barcode-Host/Server
dotnet publish --configuration Release --output /var/www/Barcode-Host/Server
cd /var/www/Barcode-Host/Server
dotnet /var/www/Barcode-Host/Server/Barcode.Host.Server.dll
```
```conf
2023-06-03 16:02:25.011 -07:00 [Information] (Barcode.Host.Server.Program.) () () Starting Web Application
2023-06-03 16:02:25.062 -07:00 [Information] (Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.) () () User profile is available. Using '"/root/.aspnet/DataProtection-Keys"' as key repository; keys will not be encrypted at rest.
2023-06-03 16:02:25.093 -07:00 [Information] (Barcode.Host.Server.HostedService.TimedHostedService.StartAsync) () () Timed Hosted Service: 1234567:3070 running.
2023-06-03 16:02:25.175 -07:00 [Information] (Microsoft.Hosting.Lifetime.) () () Now listening on: "http://localhost:5003"
2023-06-03 16:02:25.175 -07:00 [Information] (Microsoft.Hosting.Lifetime.) () () Application started. Press Ctrl+C to shut down.
2023-06-03 16:02:25.176 -07:00 [Information] (Microsoft.Hosting.Lifetime.) () () Hosting environment: "Production"
2023-06-03 16:02:25.176 -07:00 [Information] (Microsoft.Hosting.Lifetime.) () () Content root path: "/var/www/Barcode-Host/Server"
```
```bash
links http://localhost:5003/api/lastScan
```
## Sub-tasks
- [ ] phares3757
- [x] unity4
- [x] unity5

17
.kanbn/tasks/pull-repo.md Normal file
View File

@ -0,0 +1,17 @@
---
---
# Pull Repo
```bash
cd /home/unity4
git clone http://76df8eca4a6c11fe29a58c3be37543c11389ab93@192.168.0.73:3000/mikepharesjr/Barcode-Host.git
cd Barcode-Host
code .
```
## Sub-tasks
- [x] phares3757
- [x] unity4
- [x] unity5

View File

@ -0,0 +1,15 @@
---
---
# run-secrets-task
```bash
cd Server
dotnet user-secrets set RootPassword 4hink
```
## Sub-tasks
- [x] phares3757
- [x] unity4
- [x] unity5

View File

@ -0,0 +1,22 @@
---
---
# run-test-ports
```bash
ls -l /dev/ttyUSB*
```
```echo
# crw-rw---- 1 root dialout 188, 0 Jun 3 14:54 /dev/ttyUSB0
```
```bash
sudo -i
adduser unity4 dialout
reboot
```
## Sub-tasks
- [x] phares3757
- [x] unity4
- [x] unity5

113
.kanbn/tasks/setup-nginx.md Normal file
View File

@ -0,0 +1,113 @@
---
---
# setup-nginx
```bash
echo >/etc/nginx/sites-available/default && nano /etc/nginx/sites-available/default
```
```conf
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
}
```
```bash
systemctl restart nginx
lsof -i -P -n | grep LISTEN
links http://192.168.0.204/
nginx -t
nginx -s reload
echo >/etc/nginx/sites-available/Barcode-Host-Server && nano /etc/nginx/sites-available/Barcode-Host-Server
```
```conf
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
}
```
```bash
echo >/home/unity4/localhost.conf && nano /home/unity4/localhost.conf
```
```conf
[req]
default_bits = 2048
default_keyfile = localhost.key
distinguished_name = req_distinguished_name
req_extensions = req_ext
x509_extensions = v3_ca
[req_distinguished_name]
countryName = Country Name (2 letter code)
countryName_default = US
stateOrProvinceName = State or Province Name (full name)
stateOrProvinceName_default = Arizona
localityName = Locality Name (eg, city)
localityName_default = Mesa
organizationName = Organization Name (eg, company)
organizationName_default = Infineon Technologies Americas Corp.
organizationalUnitName = organizationalunit
organizationalUnitName_default = Development
commonName = Common Name (e.g. server FQDN or YOUR name)
commonName_default = unity4
commonName_max = 64
[req_ext]
subjectAltName = @alt_names
[v3_ca]
subjectAltName = @alt_names
[alt_names]
DNS.1 = unity4
DNS.2 = localhost
DNS.3 = 127.0.0.1
```
```bash
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/localhost.key -out /etc/nginx/localhost.crt -config /home/unity4/localhost.conf
ls /etc/nginx
echo >/etc/nginx/sites-available/Barcode-Host-Server && nano /etc/nginx/sites-available/Barcode-Host-Server
```
```conf
server {
server_name _;
ssl_certificate 'localhost.crt';
listen 443 default_server ssl http2;
ssl_certificate_key 'localhost.key';
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
error_page 500 502 503 504 /50x.html;
listen [::]:443 default_server ssl http2;
location / {
proxy_pass http://localhost:5003;
}
}
```
```bash
ln -s /etc/nginx/sites-available/Barcode-Host-Server /etc/nginx/sites-enabled/Barcode-Host-Server
nginx -t
nginx -s reload
links https://localhost/api/lastscan
links https://unity4/api/lastscan
```
```conf
# C:\Windows\System32\drivers\etc\hosts
192.168.0.204 unity4
```
## Sub-tasks
- [x] phares3757
- [x] unity4
- [x] unity5

17
.kanbn/tasks/update-os.md Normal file
View File

@ -0,0 +1,17 @@
---
---
# update-os
```bash
apt update
apt upgrade -y
apt install update-manager-core
do-release-upgrade
```
## Sub-tasks
- [x] phares3757
- [x] unity4
- [x] unity5