Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test #87

Merged
merged 43 commits into from
May 27, 2024
Merged

Test #87

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b841753
fix deletion bug
gregordr Dec 17, 2021
d492730
autoImport
gregordr Dec 17, 2021
5931137
buildscript
gregordr Dec 17, 2021
1482cbf
m time instead of c time!
gregordr Dec 17, 2021
d910262
Merge branch 'main' into test
gregordr Jan 3, 2022
d10064d
Gitignore
gregordr Jan 8, 2022
0f3dc26
animation
gregordr Jan 8, 2022
8b076fc
zoomable, better animation
gregordr Jan 9, 2022
9d06b39
zoom fixes, better scrolling to picture
gregordr Jan 9, 2022
d558362
Open in album feature
gregordr Jan 12, 2022
82001e3
fix
gregordr Jan 12, 2022
21d0480
Fix scroll resize
gregordr Jan 20, 2022
5034daf
Fix scrollbar, font
gregordr Jan 20, 2022
9fed3ce
Patch face download (#79)
gregordr Mar 31, 2022
8f80207
newest pic in album as default?
Apr 1, 2022
bf19b88
Show newest picture as album cover
Apr 1, 2022
169952b
Merge branch 'test' of https://github.com/gregordr/ImageStore into test
Apr 1, 2022
5d702ca
properly select album picture
gregordr Apr 15, 2022
83d00eb
Search features (#82)
gregordr Apr 15, 2022
5b53126
better label fetching
gregordr Apr 15, 2022
5c47182
fix dockerfile
gregordr Apr 15, 2022
d0e2b77
fix dockerfile
gregordr Apr 15, 2022
87b8fc7
navigation changes
gregordr Apr 17, 2022
067163e
fix detectron
gregordr Apr 17, 2022
8e5ebc5
fix detectron dockerfile
gregordr Apr 17, 2022
b5cd529
keyboard navigation
gregordr Apr 30, 2022
19c40de
Make the CLI installation more platform agnostic (#88)
mjholub May 3, 2022
81d705f
Updated readme with information about using OpenRC
gregordr May 3, 2022
6540f57
make photo search work with new photos
gregordr Oct 13, 2022
98f77f9
Merge branch 'test' of https://github.com/gregordr/ImageStore into test
gregordr Oct 13, 2022
2d02752
enable legacy deps
gregordr Oct 13, 2022
ad3be6c
Added map
gregordr Oct 18, 2022
be398c9
clear searchbar on navigation via menubar
gregordr Oct 21, 2022
f5c0188
Folders (#98)
gregordr Oct 26, 2022
d801054
do not fetch so much
gregordr Oct 26, 2022
35458b6
performance fix
gregordr May 26, 2024
813f445
Merge branch 'main' of https://github.com/gregordr/ImageStore into test
gregordr May 26, 2024
8cf9c3d
fix build
gregordr May 26, 2024
cb63dbd
fix build 2
gregordr May 26, 2024
86c269d
revert package-lock.json
gregordr May 26, 2024
27854da
fix build 3
gregordr May 26, 2024
b416202
fix face
gregordr May 26, 2024
c782a54
search fixes
gregordr May 27, 2024
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ frontend/.eslintcache

# macOS
.DS_Store

faceFeatures/*
imageFeatures/*
autoImport/node_modules/*
import/*
analysis/*
media/*
frontend/cordova/*
24 changes: 24 additions & 0 deletions CLI-Install/ImageStoreBACK
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/sbin/openrc-run

description="ImageStore Backend"
#extra_commands="checkconfig"
#need to implement a function to check configuration for errors
extra_started_commands="reload"
depend() {
need net
after postgresql nginx
}

command="/usr/bin/npm start --prefix /etc/imagestore/backend"
command_background="yes"
start_stop_daemon_args="--quiet"
cfgfile=${cfgfile:-/etc/imagestore/backend/tsconfig.json}

pidfile="/run/$RC_SVCNAME/npm.pid"
retry="SIGTERM/20"

reload() {
ebegin "Reloading $description"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $?
}
30 changes: 30 additions & 0 deletions CLI-Install/ImageStoreFRONT
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/sbin/openrc-run

description="ImageStore Frontend"
#extra_commands="checkconfig"
extra_started_commands="reload"

depend() {
need net
after postgresql nginx
want ImageStoreBACK
}

command="/usr/bin/npx serve -w /etc/imagestore/frontend -s build -l tcp://localhost:3000"
#Not sure if npx is supposed to run in background here, if yes, please uncomment these lines:
#command_background="yes"
#start_stop_daemon_args="--quiet"
pidfile="/run/$RC_SVCNAME/npm.pid"
retry="SIGTERM/20"
cfgfile=${cfgfile:=/etc/imagestore/frontend/tsconfig.json}

reload() {
ebegin "Reloading $description"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $?
}

#need to implement a function to check configuration for errors
#checkconfig() {
#}

96 changes: 96 additions & 0 deletions CLI-Install/install-openrc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@

#!/bin/bash

#Check for the package manager used by the system
if [[ $(which apk) != "apk not found" ]]; then
pkgman="apk"
install="add"
update="update"
elif [[ $(which apt) != "apt not found" ]]; then
pkgman="apt"
install="install"
update="update"
elif [[ $(which yum) != "yum not found" ]]; then
pkgman="yum"
install="install"
update="update"
elif [[ $(which pacman) != "pacman not found" ]]; then
pkgman="pacman"
install="-S"
update="-Syy"
fi

#Install the required programs

$pkgman $update

##On Debian/Ubuntu based distros gotta do a little extra for Node
if [[ "$pkgman" == "apt" ]]; then
apt install curl -y
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
apt install nodejs -y
fi

case $pkgman in

yum | apt)
$pkgman $install postgresql npm build-essential nginx -y
;;

pacman | apk)
$pkgman $install postgresql npm build-essential nginx
;;

esac

#Make an Config folder
mkdir /etc/imagestore
cp -r ../frontend /etc/imagestore/
cp -r ../backend /etc/imagestore/

#Load up the system with the proper configurations

if (ss -ln | grep ":8080")
then
loopcheck=1
read -p "Port conflict detected. Select new port to host ImageStore: " port
while [ $loopcheck -eq 1 ]
do
if [[ "$port" =~ [a-zA-Z] ]]
then
echo "Invalid input detected"
read -p "Port conflict detected. Select new port to host ImageStore: " port
else
sed -i "s/8080/$port/" default.conf
loopcheck=0
fi
done
fi

#Check if sites-enabled is present and enabled in nginx.conf
cd /etc/nginx
if [[ ! -d "sites-enabled" ]]; then
mkdir -p sites-enabled
fi

if ! grep -q '^include /etc/nginx/sites-enabled/' nginx.conf; then
sed -ir '/^http {*/a \\tinclude /etc/nginx/sites-enabled/*.conf' nginx.conf
fi

cp default.conf /etc/nginx/sites-enabled/imagestore.conf
cp ImageStoreFRONT /etc/init.d/ImageStoreFRONT
cp ImageStoreBACK /etc/init.d/ImageStoreBACK

#Init an user and the database
ranpass=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)

su postgres -c "./postgresql.sh $ranpass"
echo "PGSTRING=postgres://imagestore:$ranpass@localhost:5432/imagestore" > /etc/imagestore/backend/.env

#Install node modules
cd /etc/imagestore/frontend
/usr/bin/npm i
/usr/bin/npm run-script build
cd /etc/imagestore/backend
/usr/bin/npm i
/usr/bin/npm install ts-node
56 changes: 44 additions & 12 deletions CLI-Install/imagestore-build.sh → CLI-Install/install-systemd.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,25 +1,46 @@
#!/bin/bash

#Need this for scriptery
apt install curl gpg -y
#Check for the package manager used by the system
if [[ $(which apk) != "apk not found" ]]; then
pkgman="apk"
install="add"
update="update"
elif [[ $(which apt) != "apt not found" ]]; then
pkgman="apt"
install="install"
update="update"
elif [[ $(which yum) != "yum not found" ]]; then
pkgman="yum"
install="install"
update="update"
elif [[ $(which pacman) != "pacman not found" ]]; then
pkgman="pacman"
install="-S"
update="-Syy"
fi

#Install the required programs
##First is Postgresql - This requires importing their repo key and repo
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
RELEASE=$(lsb_release -cs)
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${RELEASE}"-pgdg main | sudo tee /etc/apt/sources.list.d/pgdg.list
apt update
apt install -y postgresql-11

$pkgman $update

##Gotta do a little extra for Node too
##On Debian/Ubuntu based distros gotta do a little extra for Node
if [[ $pkgman == apt ]]; then
apt install curl -y
curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -
apt install nodejs -y
fi

case $pkgman in

yum | apt)
$pkgman $install postgresql npm build-essential nginx -y
;;

##Do the rest, no extras required
apt install npm build-essential -y
pacman | apk)
$pkgman $install postgresql npm build-essential nginx
;;

apt install nginx -y
esac

#Make an Config folder
mkdir /etc/imagestore
Expand All @@ -44,6 +65,17 @@ then
fi
done
fi

#Check if sites-enabled is present and enabled in nginx.conf
cd /etc/nginx
if [[ ! -d "sites-enabled" ]]; then
mkdir -p sites-enabled
fi

if ! grep -q '^include /etc/nginx/sites-enabled/' nginx.conf; then
sed -ir '/^http {*/a \\tinclude /etc/nginx/sites-enabled/*.conf' nginx.conf
fi

cp default.conf /etc/nginx/sites-enabled/imagestore.conf
cp ImageStoreFRONT.service /etc/systemd/system/ImageStoreFRONT.service
cp ImageStoreBACK.service /etc/systemd/system/ImageStoreBACK.service
Expand Down
Empty file modified CLI-Install/postgresql.sh
100755 → 100644
Empty file.
23 changes: 19 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,37 @@ Requirements:
If you want to build yourself, then clone this repo and run ```docker-compose -f docker-compose-build.yml up```. Again, you can use ```--profile``` to add features.

### Without docker
Requires Ubuntu 18.04/20.04.
Requires a distribution with any of the four following packaging systems: pacman, yum, apt, apk and either systemd or OpenRC.

```
git clone https://github.com/gregordr/ImageStore
cd CLI-Install
sudo ./imagestore-build.sh
```
This will install and configure everything as needed in order to host ImageStore. PostgreSQL 11, Nodejs and nginx will be installed.
If you're using systemd (most distros):

`sudo ./install-systemd.sh`

If you're using OpenRC (e.g. Artix, Void, Alpine; Gentoo is not supported – see above):

`sudo ./install-openrc.sh`
If you are using `doas`, please use `su -c` instead.

This will install and configure everything as needed in order to host ImageStore. PostgreSQL 13 (most Debian/Ubuntu based distros), on other distros it'll most likely be PostgreSQL 14, Nodejs and nginx will be installed.
By default it hosts over port 8080. If it is already in use, it will ask for an alternate port. The created database user is seeded with a random 16 character string, so there is no default password to worry about.

The Imagestore service by default will start on boot. To stop Imagestore, run
The Imagestore service by default will start on boot. To stop Imagestore, on systemd run
```sudo systemctl stop ImageStoreFRONT.service; sudo systemctl stop ImageStoreBACK.service;```

on OpenRC run:
```sudo rc-service ImageStoreFRONT stop && sudo rc-service ImageStoreBACK stop```

To prevent the service from starting on boot, run
```sudo systemctl disable ImageStoreFRONT.service; sudo systemctl disable ImageStoreBACK.service;```

on OpenRC run:

```sudo rc-update disable ImageStoreFRONT && sudo rc-update disable ImageStoreBACK```

### Notes for raspberry Pi:

Incase you get an error with the backend saying unreachable code, you might have to run the following commands:
Expand Down
2 changes: 1 addition & 1 deletion backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ubuntu:latest
ENV DEBIAN_FRONTEND=noninteractive
RUN apt update
RUN apt install ffmpeg python3 ca-certificates curl make g++ -y
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash -
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
RUN apt-get install -y nodejs
RUN update-ca-certificates --fresh
WORKDIR /code
Expand Down
Loading
Loading