Skip to content

Commit a36ffcb

Browse files
authored
FF-98, FF-99 Feature/application (#5)
* Changed a lot. * Added OneTimeScript * small fixes * Implemented Request by @qvalentin (#5) * Finished Install Script. * Finished Install Script. * Added Status option. * fixed wrong rootDir. * fixed one edge case. * removed unnecessary db_port. * Added FrontendLink to start.sh * Added FrontendLink to start.sh * Can i stop pushing pws to the repo? * Added additional information for the user. * Updated README.md * Implemented Changes requested by @qvalentin
1 parent 34558df commit a36ffcb

17 files changed

+444
-271
lines changed

Install.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
# TODO: update readme.
3+
4+
# Read in base dir for Path.
5+
rootDir=$(realpath $0)
6+
rootDir=${rootDir/%Install.sh} # Very HACKY YES.
7+
newPATH="PATH=$PATH:$rootDir"
8+
9+
# Add main script to PATH.
10+
# Check files.
11+
profile="/home/$USER/.bash_profile"
12+
login="/home/$USER/.bash_login"
13+
rc="/home/$USER/.bashrc"
14+
15+
commandToRun=""
16+
# Checking command.
17+
ffighter >/dev/null 2>&1
18+
19+
if [ $? == 127 ]; then # command does not exist add it to path
20+
echo "Adding FileFighter Application to PATH..."
21+
if [[ -f "$profile" ]]; then
22+
echo "$newPATH" >>"$profile"
23+
commandToRun="source $profile"
24+
elif [[ -f "$login" ]]; then
25+
echo "$newPATH" >>"$login"
26+
commandToRun="source $login"
27+
elif [[ -f "$rc" ]]; then
28+
echo "$newPATH" >>"$rc"
29+
commandToRun="source $rc"
30+
else
31+
echo "Couldn't add FileFighter Application to PATH. Please contact us at [email protected]."
32+
echo "Or add following line to your PATH variable:"
33+
echo "$rootDir"
34+
exit 1
35+
fi
36+
37+
echo "Adding FileFighter Application to PATH was successful."
38+
echo "Please run the following command to finish the installation."
39+
echo ""
40+
echo $commandToRun
41+
else
42+
echo "FileFighter Application already available"
43+
echo "Use: ffighter <args>."
44+
fi

README.md

Lines changed: 64 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Currently, we support only Unix-like operating systems like [Ubuntu](https://ubu
99
For windows systems you could use [wsl](https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux). To set that up read more [here](https://docs.microsoft.com/en-us/windows/wsl/install-win10).
1010

1111
### Dependencies
12-
One of the of goals of FileFighter is, that the client, that's you, only needs to met only one single dependency.
12+
One of the of goals of FileFighter is, that the client, that's you, only needs to met one single dependency.
1313
You need [Docker](https://www.docker.com/).
1414
Docker is a way to organise and run multiple applications. You can imagine it like a virtual machine (technical it`s a bit different), with a small file- and operating system within your machine.
1515
Sounds more scary than it actually is. Different Applications run in different containers, these only contain the necessary software to run the application.
@@ -39,27 +39,76 @@ sudo snap install docker
3939
##### Install with Apt
4040
Installing with [apt](https://en.wikipedia.org/wiki/APT_(software)) is a bit more difficult you can read [here](https://www.digitalocean.com/community/tutorials/how-to-install-and-use-Docker-on-ubuntu-20-04) more about it.
4141

42-
## Usage
42+
## Installing FileFighter
4343
After successfully installing Docker you can start using FileFighter.
4444
Just download this repository as a zipfile [here](https://github.com/FileFighter/ClientSetup/releases/).
45-
This repository contains one <!-- three --> important script:
46-
The [initial start](./init_setup.sh) script starts downloading all the services and starts them in different containers. Run it with
45+
This repository contains the *Install.sh* installation script.
46+
```shell script
47+
dev@filefighter:~/Downloads/FileFighter-1.3 $ ls
48+
config.cfg ffighter Install.sh lib README.md
49+
```
50+
You can execute the script:
4751
```shell script
48-
sudo ./init_setup
52+
dev@filefighter:~/Downloads/FileFighter-1.3 $ ./Install.sh
4953
```
50-
After starting the script you should see something like the following:
54+
And you should see something like that:
5155
```shell script
52-
-------------------------< FileFighter >--------------------------
53-
| Version 1.0 Last updated at 14.10.20 |
54-
| Developed by Gimleux, Valentin, Open-Schnick. |
55-
| Development Blog: https://filefighter.github.io |
56-
| The code can be found at: https://www.github.com/filefighter |
57-
--------------------< Started Initial Setup >---------------------
56+
dev@filefighter:~/Downloads/FileFighter-1.3 $ ./Install.sh
57+
Adding FileFighter Application to PATH...
58+
Adding FileFighter Application to PATH was successful.
59+
Please run the following command to finish the installation.
60+
61+
source /home/dev/.bashrc
62+
```
63+
Running this command will add the FileFighter Application to your System.
64+
## Running FileFighter
65+
You can use the FileFighter Application with the command *ffighter*
66+
Running this command should show you something like that:
67+
```shell script
68+
dev@filefighter:~/Downloads/FileFighter-1.3 $ ffighter
69+
_____ _ _ _____ _ _ _
70+
| ___| (_) | | ___ | ___| (_) __ _ | |__ | |_ ___ _ __
71+
| |_ | | | | / _ \ | |_ | | / _` | | '_ \ | __| / _ \ | '__|
72+
| _| | | | | | __/ | _| | | | (_| | | | | | | |_ | __/ | |
73+
|_| |_| |_| \___| |_| |_| \__, | |_| |_| \__| \___| |_|
74+
|___/
75+
Version v1.3 Last updated: 08.11.20
76+
Developed by Gimleux, Valentin, Open-Schnick.
77+
Development Blog: https://filefighter.github.io
78+
The code can be found at: https://www.github.com/filefighter
79+
80+
-------------------------< Show Usage >---------------------------
81+
82+
usage: ffighter <args>
83+
84+
status - show status of the FileFighter application.
85+
install - install the FileFighter application.
86+
start - start the services.
87+
stop - stop the services.
88+
remove - remove all services.
89+
```
90+
You can see all the available options to run with *ffighter*.
91+
92+
| Option | Description |
93+
| :----: | :----: |
94+
| status | This command shows you information about the status of the application, like installation status, whether its running or not etc... |
95+
| install | Download and create all necessary services. |
96+
| start | Start the services if already downloaded. |
97+
| stop | Stop the services if running. |
98+
| remove | Remove all services. |
99+
100+
To start the Application just run:
101+
```shell script
102+
ffighter install
103+
```
104+
And after that
105+
```shell script
106+
ffighter start
58107
```
59108
After the script succeeds you should be able to see the FileFighter application in your browser.
60109
Depending on your configuration file (see below), you should see the application after running the script [here](http://localhost:80/).
61-
You should see a login page. For the first setup you can use the credentials
62-
`username=admin password=admin`
110+
You should see a login page. For the first setup you can use the credentials.
111+
`username=admin` and `password=admin`
63112
To be sure everything is setup correctly click [here](http://localhost:80/health). If everything is green you are good to go.
64113
65114
### Configuration
@@ -72,7 +121,6 @@ Valid keys to configure how FileFighter behaves are listed here:
72121
| frontend_port | 0-65535 | 80 | The port of the webapp (frontend) service. You can visit the FileFighter application over this port. |
73122
| db_user | any string | root | The name of the Database running in the background. |
74123
| db_password | any string | none (see below) | The password of the database. (The database won't be exposed to the internet, but passwords never hurt.) |
75-
| db_port | 0-65535 | 27017 | The port of the database. |
76124
| db_name | any string | filefighter | The name of the database. |
77125
| use_stable_versions | true / false | true | When set to true the latest stable versions will be used. When set to false always the latest (possible unstable) versions will be used. |
78126
@@ -83,7 +131,7 @@ If the `db_password` key is empty, a random password will be generated.
83131
Be carefully as the developers of FileFighter won't take responsibility when you are using the application or configuration options wrong or in a not intended way.
84132
85133
## Remaining Files
86-
All the remaining not explicitly explained files are important for the scripts to work.
134+
All the remaining not explicitly explained files are important for the scripts to work and should not be changed manually.
87135
88136
## Help
89137
For further help, feedback or questions write us an [email](mailto:[email protected]).

config.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
rest_port=8080
22
frontend_port=80
33
db_user=root
4-
db_port=27017
54
db_name=filefighter
65
use_stable_versions=true
76
db_password=

ffighter

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
# changing directory to be able to use relative paths.
4+
rootDir=$(dirname $0)
5+
cd $rootDir
6+
7+
# Import necessary functions.
8+
source lib/utils.sh
9+
source lib/remove.sh
10+
source lib/install.sh
11+
source lib/start.sh
12+
source lib/stop.sh
13+
source lib/status.sh
14+
15+
version="v1.3"
16+
date="08.11.20"
17+
18+
if [ -z "$1" ]; then
19+
echoLogo $version $date "Show Usage"
20+
printUsage
21+
exit 1
22+
fi
23+
24+
if [[ $1 == "status" ]]; then
25+
echoLogo $version $date "Show Status"
26+
ffstatus
27+
exit 0
28+
fi
29+
30+
if [[ $1 == "install" ]]; then
31+
echoLogo $version $date "Installing FileFighter"
32+
ffinstall
33+
exit 0
34+
fi
35+
36+
if [[ $1 == "start" ]]; then
37+
echoLogo $version $date "Starting FileFighter"
38+
ffstart
39+
exit 0
40+
fi
41+
42+
if [[ $1 == "stop" ]]; then
43+
echoLogo $version $date "Stopping FileFighter"
44+
ffstop
45+
exit 0
46+
fi
47+
48+
if [[ $1 == "remove" ]]; then
49+
echoLogo $version $date "Removing FileFighter"
50+
ffremove
51+
exit 0
52+
fi
53+
54+
echoLogo $version $date "Show Usage"
55+
printUsage
56+
exit 1

init_setup.sh

Lines changed: 0 additions & 168 deletions
This file was deleted.

0 commit comments

Comments
 (0)