Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions README.MD
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
[![Full CI](https://github.com/h4570/armnas/actions/workflows/ci.yml/badge.svg)](https://github.com/h4570/armnas/actions/workflows/ci.yml)

# Work in progress!

### Roadmap
- Installation
- Test Armbian
- Test Raspbian
- Documentation
- How to add message (with example)
- How to check logs
- How to develop
- Add info: Devices must have partitions, partitions must have UUID (create partition with parted and format `mkfs.ntfs -f /dev/sdb1`)
- How to install Armbian
- If running on Armbian
`add-apt-repository ppa:transmissionbt/ppa -y`
- Create cool readme with test/lint/quality badges
- Test Raspbian
- Test/lint/quality badges
- Docs
- Video
- Readme
7 changes: 7 additions & 0 deletions dev-scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Ignore everything
*

# Except these
!.gitignore
!deploy-dbg-example.ps1
!deploy-prd-example.ps1
28 changes: 18 additions & 10 deletions deploy-dbg.ps1 → dev-scripts/deploy-dbg-example.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@
param (
[switch]$skip_backend = $false,
[switch]$skip_frontend = $false
)
)

$TARGET = "[email protected]"
$TARGET = "[email protected]"

# --- README!
# Please duplicate this file, change the name of it, and put your password here.
# For your safety, the new file will NOT be tracked by git.

# ---
# You can remove passwords from these commands, via installing your ssh key on target machine.
# -> cat id_rsa.pub | ssh root@$TARGET_IP 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys'
$SSH = 'plink.exe'
$SSH_DEFAULT_ARGS = '-batch', '-pw', 'raspberry'
$SSH_DEFAULT_ARGS = '-batch', '-pw', 'PUT_ARMNAS_PASSWORD_HERE'
$SCP = 'pscp.exe'
$SCP_DEFAULT_ARGS = '-r', '-P', '22', '-pw', 'raspberry'
# ----
$SCP_DEFAULT_ARGS = '-r', '-P', '22', '-pw', 'PUT_ARMNAS_PASSWORD_HERE'
# ---

Set-Location ..

# ===--- Deploy frontend ---===
if(!$skip_frontend) {
if (!$skip_frontend) {
Write-Host "Building Angular (frontend)" -ForegroundColor DarkGreen
Set-Location frontend/web-app
ng build --configuration=debug --output-hashing=all --output-path=./dist > $null
Expand All @@ -32,7 +35,7 @@ if(!$skip_frontend) {
}

# ===--- Deploy backend ---===
if(!$skip_backend) {
if (!$skip_backend) {
Write-Host "Building Web API (backend)" -ForegroundColor DarkGreen
Set-Location backend/WebApi
$GIT_TAG = git describe --tags
Expand All @@ -43,9 +46,13 @@ if(!$skip_backend) {

Write-Host "Deploying Web API (backend)" -ForegroundColor Magenta
& $SSH $SSH_DEFAULT_ARGS $TARGET '. /var/www/armnas/backend/WebApi/stop.sh' > $null # stop backend
& $SSH $SSH_DEFAULT_ARGS $TARGET 'mv /var/www/armnas/backend/WebApi/armnas.db /var/www/armnas/' > $null # backup armnas.db
& $SSH $SSH_DEFAULT_ARGS $TARGET 'mv /var/www/armnas/backend/WebApi/appsettings.json /var/www/armnas/' > $null # backup appsettings.json
& $SSH $SSH_DEFAULT_ARGS $TARGET 'rm -rf /var/www/armnas/backend/WebApi/*' > $null
& $SCP $SCP_DEFAULT_ARGS './backend/WebApi/publish/\*' $TARGET':/var/www/armnas/backend/WebApi' > $null
Remove-Item -LiteralPath "./backend/WebApi/publish" -Force -Recurse
& $SSH $SSH_DEFAULT_ARGS $TARGET 'mv /var/www/armnas/armnas.db /var/www/armnas/backend/WebApi/' > $null # restore armnas.db
& $SSH $SSH_DEFAULT_ARGS $TARGET 'mv /var/www/armnas/appsettings.json /var/www/armnas/backend/WebApi/' > $null # restore appsettings.json
& $SSH $SSH_DEFAULT_ARGS $TARGET 'chmod +x /var/www/armnas/backend/WebApi/start.sh' > $null
& $SSH $SSH_DEFAULT_ARGS $TARGET 'chmod +x /var/www/armnas/backend/WebApi/stop.sh' > $null

Expand All @@ -55,3 +62,4 @@ if(!$skip_backend) {
# ===--- Finish ---===

Write-Host "Done!" -ForegroundColor DarkGreen
Set-Location dev-scripts
22 changes: 15 additions & 7 deletions deploy-prd.ps1 → dev-scripts/deploy-prd-example.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@

# ===--- Variables ---===

$TARGET = "[email protected]"
$TARGET = "[email protected]"

# --- README!
# Please duplicate this file, change the name of it, and put your password here.
# For your safety, the new file will NOT be tracked by git.

# ---
# You can remove passwords from these commands, via installing your ssh key on target machine.
# -> cat id_rsa.pub | ssh root@$TARGET_IP 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys'
$SSH = 'plink.exe'
$SSH_DEFAULT_ARGS = '-batch', '-pw', 'raspberry'
$SSH_DEFAULT_ARGS = '-batch', '-pw', 'Sandrox1'
$SCP = 'pscp.exe'
$SCP_DEFAULT_ARGS = '-r', '-P', '22', '-pw', 'raspberry'
# ----
$SCP_DEFAULT_ARGS = '-r', '-P', '22', '-pw', 'Sandrox1'
# ---

Set-Location ..

# ===--- Deploy frontend ---===

Expand All @@ -37,9 +40,13 @@ Set-Location ..

Write-Host "Deploying Web API (backend)" -ForegroundColor Magenta
& $SSH $SSH_DEFAULT_ARGS $TARGET '. /var/www/armnas/backend/WebApi/stop.sh' > $null # stop backend
& $SSH $SSH_DEFAULT_ARGS $TARGET 'mv /var/www/armnas/backend/WebApi/armnas.db /var/www/armnas/' > $null # backup armnas.db
& $SSH $SSH_DEFAULT_ARGS $TARGET 'mv /var/www/armnas/backend/WebApi/appsettings.json /var/www/armnas/' > $null # backup appsettings.json
& $SSH $SSH_DEFAULT_ARGS $TARGET 'rm -rf /var/www/armnas/backend/WebApi/*' > $null
& $SCP $SCP_DEFAULT_ARGS './backend/WebApi/publish/\*' $TARGET':/var/www/armnas/backend/WebApi' > $null
Remove-Item -LiteralPath "./backend/WebApi/publish" -Force -Recurse
& $SSH $SSH_DEFAULT_ARGS $TARGET 'mv /var/www/armnas/armnas.db /var/www/armnas/backend/WebApi/' > $null # restore armnas.db
& $SSH $SSH_DEFAULT_ARGS $TARGET 'mv /var/www/armnas/appsettings.json /var/www/armnas/backend/WebApi/' > $null # restore appsettings.json
& $SSH $SSH_DEFAULT_ARGS $TARGET 'chmod +x /var/www/armnas/backend/WebApi/start.sh' > $null
& $SSH $SSH_DEFAULT_ARGS $TARGET 'chmod +x /var/www/armnas/backend/WebApi/stop.sh' > $null

Expand All @@ -48,3 +55,4 @@ Remove-Item -LiteralPath "./backend/WebApi/publish" -Force -Recurse
# ===--- Finish ---===

Write-Host "Done!" -ForegroundColor DarkGreen
Set-Location dev-scripts
1 change: 1 addition & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO: SSH connection + dev scripts
18 changes: 18 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# TODO: Install, uninstall, update

## Install
**For Armbian users**, please add transmission repo (only once):
`add-apt-repository ppa:transmissionbt/ppa -y`

1. Download install script
`sudo wget https://raw.githubusercontent.com/h4570/armnas/main/install.sh`
2. Run script
`sudo chmod +x install.sh && sudo ./install.sh`

## Update

## Uninstall
1. Download uninstall script
`sudo wget https://raw.githubusercontent.com/h4570/armnas/main/uninstall.sh`
2. Run script
`sudo chmod +x uninstall.sh && sudo ./uninstall.sh`
1 change: 1 addition & 0 deletions docs/logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO: How to check logs
1 change: 1 addition & 0 deletions docs/messages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO: How to add message (with example)
2 changes: 2 additions & 0 deletions docs/q&a.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- .NET Crashing on Hardkernel's Ubuntu
- Add info: Devices must have partitions, partitions must have UUID (create partition with parted and format `mkfs.ntfs -f /dev/sdb1`)
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ export class PartitionsComponent implements OnInit, OnDestroy {
// remove mount/auto mount with old name!
const weShouldDisableAutoMount = partition.isAutoMountEnabled;
const weShouldUnmount = partition.mountingPoint; // is mounted

if ((weShouldDisableAutoMount || weShouldUnmount) && !this.isPartitionSavedInDb(partition)) {
this.snackbar.open(this.translate.instant('home.armnasCanUnmountItsOwn'), '😶', { duration: 3000 });
partition.isFreezed = false;
return;
}
if (weShouldDisableAutoMount)
await this.partitionService.disableAutoMount(partition.uuid);
if (weShouldUnmount)
Expand Down Expand Up @@ -176,7 +180,7 @@ export class PartitionsComponent implements OnInit, OnDestroy {
}

private isPartitionSavedInDb(partition: LsblkPartitionInfoView): boolean {
if (!partition.displayName) return false;
if (!partition.cachedDisplayName) return false;
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion frontend/web-app/src/assets/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"mount": "Mount",
"unmount": "Unmount",
"loading": "Loading...",
"armnasCanUnmountItsOwn": "Armnas can umount its own mounts only!",
"armnasCanUnmountItsOwn": "Armnas can umount its own mounts only! Umount manually and restart the webpage.",
"setDisplayName": "Please set display name first!",
"goodbye": "Goodbye!",
"seeYou": "See you in few minutes!",
Expand Down
2 changes: 1 addition & 1 deletion frontend/web-app/src/assets/i18n/pl-PL.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"mount": "Zamontuj",
"unmount": "Odmontuj",
"loading": "Ładowanie...",
"armnasCanUnmountItsOwn": "Armnas może odmontować tylko własne partycje.",
"armnasCanUnmountItsOwn": "Armnas może odmontować tylko własne partycje. Odmontuj manualnie i zrestartuj stronę.",
"setDisplayName": "Najpierw ustaw nazwę własną!",
"goodbye": "Do zobaczenia!",
"seeYou": "Widzimy się za kilka minut!",
Expand Down
8 changes: 4 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ step_2() {
}

step_3() {
apt-get install debian-keyring unzip jq curl debian-archive-keyring ntfs-3g ufw apt-transport-https -y
apt-get install debian-keyring acl unzip jq curl debian-archive-keyring ntfs-3g ufw apt-transport-https -y
# Check if caddy repo was already added. Add if not
if [ ! -f /etc/apt/sources.list.d/caddy-stable.list ]; then
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo apt-key add -
Expand Down Expand Up @@ -241,7 +241,7 @@ http://$web_api_ip_domain {

step_7() {
# Give a chance to caddy and .NET to wake up
sleep 5s
sleep 10s

# Add main user to armnas
curl --header "Content-Type: application/json" \
Expand Down Expand Up @@ -289,7 +289,7 @@ step_10() {

# Check if script is running with root privileges
if [ `id -u` -ne 0 ] ; then echo "Please run as root" ; exit 1 ; fi
myip="$(hostname -I | xargs)"
myip="$(hostname -I | xargs | awk '{gsub(/ /,", ")}1')"

color_green
echo "=========================="
Expand Down Expand Up @@ -370,7 +370,7 @@ while true; do
done

while true; do
read -p "Install .NET SDK/Runtime which is needed for armnas development? (y/N): " yn
read -p "Install .NET SDK/Runtime? Not needed by Armnas. (y/N): " yn
case $yn in
[Yy]* ) install_sdk_runtime=true; break;;
[Nn]* ) install_sdk_runtime=false; break;;
Expand Down