Small picture gallery that highlight rare links between pictures. Each picture is tagged and two pictures are linked if and only if only few pictures contains the same common tags (basically). The software uses Vue for the frontend with VisJS-network to display the network, Rust WASM for frontend computations and Django for the backend.
- Static image hosting with SFTP access (see How to Setup a SFTP user)
- Python Django for the backend
- Mysql Database or any other database supported by Django
- VueJS for the frontend
Install Rust and wasm-pack
curl https://sh.rustup.rs -sSf | sh
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- Install and build the application
npm install
npm build
- Create a symbolic link to serve the application
sudo ln -s dist /var/www/<your domain>
- Clone the source code
git clone https://github.com/Marc-AntoineA/NP.git
- Install
virtual env
and the Python requirements
cd backend
sudo apt-get install python3-venv
python3 -m venv python_env
- Activate the virtual environment
source python_env/bin/activate
deactivate # to deactivate the environent
- Install the requirements
pip install requirements.txt
- Edit the
backend/settings.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'phographebase',
'USER': 'phographeuser',
'PASSWORD': '',
'HOST': 'localhost',
'PORT': '1433'
}
}
- Make migrations
python manage.py makemigrations
python manage.py migrate
- Create a superuser
python manage.py createsuperuser
- Start the server (testing purpose)
python manage.py runserver 0.0.0.0:8000
The 0.0.0.0:8000
allows access to the server from outside.
-
Install
mod_wsgi
-
Install
mod_xsendfile
sudo apt-get install libapache2-mod-xsendfile
sudo e2enmod xsendfile
- Create the directory into your
/var/www
repository.
mkdir <url>
- Install and login into Mysql
- Create the dabase and setup the user with read and write and only local access (if deployed on the same server than the backend)
CREATE DATABASE phographebase;
CREATE USER 'phouser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON prographebase. * TO 'phographeuser'@'localhost';
FLUSH PRIVILEGES;
- Setup the connection with Django
To create the user <username>
from the group <user-group>
to have access only to /var/www/<domain>
with the password you wants.
- Setup the user
sudo apt-get install openssh-server
sudo groupadd <user-group>
sudo useradd -g <user-group> -d /var/www/<domain>/ -s /sbin/nologin <username>
Warning If
-s /sbin/nologin
doesn't exist, use/usr/sbin/nologin
- Setup your password
sudo passwd <username>
- Test if everything is fine
cat /etc/passwd | grep <username>
You should see something like
<username>:x:1002:1002::/var/www/<domain>/:/sbin/nologin
- uae
Nope Add permisions chown -R sftpuser: /data/dirstatinfo/csvfiles
Configure ssh protocole $ vim /etc/ssh/sshd_config
Subsystem sftp internal-sftp Match Group ChrootDirectory /path/to/files ForceCommand internal-sftp
Enable Chroot setsebool -P ssh_chroot_rw_homedirs=1
Restart the ssh service /etc/init.d/sshd restart
Be careful, the Chroot is on the main folder and the chown to the local user in the subfolders