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

Setup Server & Website Fixes #47

Merged
merged 40 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9935d59
add scripts to start server
kalebphipps Sep 30, 2024
aa0da2e
check if repository exists before cloning
kalebphipps Sep 30, 2024
7ed6492
check if repository exists before cloning
kalebphipps Sep 30, 2024
2f62eac
update cd commands
kalebphipps Sep 30, 2024
0d9e10c
Make executable
kalebphipps Sep 30, 2024
965d0c5
install venv
kalebphipps Sep 30, 2024
8caf2e7
include upgrade for pip command
kalebphipps Sep 30, 2024
48485eb
add waitress dependency
kalebphipps Sep 30, 2024
91968ec
switch start to waitress
kalebphipps Sep 30, 2024
03dc017
fix start of flast application
kalebphipps Sep 30, 2024
a2ff4f1
include apache and enable modules
kalebphipps Sep 30, 2024
7c425ef
include server restart
kalebphipps Sep 30, 2024
6f837c2
Merge branch 'main' into maintenance/server_setup
kalebphipps Oct 2, 2024
afe1219
Merge branch 'bugfix/mobile_website' into maintenance/server_setup
kalebphipps Oct 2, 2024
645ac4b
quick commit to save progress
kalebphipps Oct 2, 2024
81ea44a
Merge branch 'bugfix/mobile_website' into maintenance/server_setup
kalebphipps Oct 2, 2024
be3abc2
fix run script
kalebphipps Oct 2, 2024
75420d2
include sudo rights
kalebphipps Oct 2, 2024
b728071
Merge branch 'main' into maintenance/server_setup
kalebphipps Oct 7, 2024
222767a
include icon alias
kalebphipps Oct 7, 2024
7e07e28
include kill command for script
kalebphipps Oct 7, 2024
4891b35
fix icon alias
kalebphipps Oct 7, 2024
b225e4c
includ spinner when loading data
kalebphipps Oct 7, 2024
c86f98a
fix spinner activation when navigating back
kalebphipps Oct 7, 2024
5880cbd
include favicon link in header
kalebphipps Oct 14, 2024
23703b0
Merge branch 'main' into maintenance/server_setup
kalebphipps Oct 14, 2024
9d8c682
include custom navbar width
kalebphipps Oct 14, 2024
8e9a790
move contact to footer and ensure navbar avoids line breaks
kalebphipps Oct 14, 2024
6ac5a2f
add script to generate certificate
kalebphipps Oct 14, 2024
8e68505
include vm set up and installation
kalebphipps Oct 14, 2024
31d4d69
remove certain install commands
kalebphipps Oct 14, 2024
8c25835
include document root
kalebphipps Oct 14, 2024
4779282
fix document root location
kalebphipps Oct 14, 2024
a44019a
fix install script
kalebphipps Oct 14, 2024
8863b20
add alias to document root
kalebphipps Oct 14, 2024
88e9ea1
set document root
kalebphipps Oct 14, 2024
d233a15
insert alias for favicon
kalebphipps Oct 14, 2024
d0eda8e
use proxy pass match to display favicon
kalebphipps Oct 14, 2024
2ded637
include favicon in head
kalebphipps Oct 14, 2024
fda7cd9
favicon as new resource in head
kalebphipps Oct 15, 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
10 changes: 10 additions & 0 deletions html/create_certificate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

# Secure with Lets Encrypt
sudo apt install certbot python3-certbot-apache
sudo ufw allow 'WWW Full'
sudo ufw delete allow 'WWW'
sudo ufw status
certbot --apache -d paint-database.org
ls /etc/letsencrypt/live/
echo "You can test the website by navigating to https://paint-database.org"
91 changes: 91 additions & 0 deletions html/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/bash
PAINT_ROOT=/home/paint/PAINT
ENV_PATH=/home/paint/venv
AVAILABLE_PATH=/etc/apache2/sites-available
ENABLED_PATH=/etc/apache2/sites-enabled

echo "Assuming that you are logged in as a user with sudo rights"

# Initial Server Setup with Debian 11.
echo "Setting Up a Basic Firewall"
sudo apt update
sudo apt install ufw
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status

# Installing Apache
sudo apt update
sudo apt install apache2
sudo ufw app list
echo "Your output will be a list of the application profiles"
sudo ufw allow 'WWW'
sudo ufw status
echo "The output will provide a list of allowed HTTP traffic"
echo "Make sure the service is active by running the command for the systemd init system"
sudo systemctl status apache2
hostname -I
sudo apt install curl
curl -4 icanhazip.com
IP_ADDRESS=$(hostname -I | awk '{print $1}')
echo "Enter http://$IP_ADDRESS in the browser"
sudo mkdir -p /var/www/paint_domain
sudo chown -R $USER:$USER /var/www/paint_domain
sudo chmod -R 755 /var/www/paint_domain

# Install git.
sudo apt-get update
sudo apt-get -y install apache2 git python3-venv

# Enable apache proxy.
sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod alias
sudo a2enmod cache

# Check if repository exists, if not clone, if it exists pull.
if [ ! -d "$PAINT_ROOT" ]; then
git clone https://github.com/ARTIST-Association/PAINT.git $PAINT_ROOT
else
cd "${PAINT_ROOT}" || exit 1
git pull
fi

# Navigate to repository and create virtual environment if it doesn't exist yet.
cd "${PAINT_ROOT}" || exit 1
if [ ! -d "$ENV_PATH" ]; then
python3 -m venv $ENV_PATH
fi

# Navigate to html directory.
cd ${PAINT_ROOT}/html || exit 1

# Copy configuration files to correct folder.
sudo cp paint_domain.conf $AVAILABLE_PATH/paint_domain.conf
sudo cp paint_domain-le-ssl.conf $AVAILABLE_PATH/paint_domain-le-ssl.conf

# Create symlinks in enabled folder.
sudo ln -sf $AVAILABLE_PATH/paint_domain.conf $ENABLED_PATH/paint_domain.conf
sudo ln -sf $AVAILABLE_PATH/paint_domain-le-ssl.conf $ENABLED_PATH/paint_domain-le-ssl.conf

# Navigate back to repository root.
cd "${PAINT_ROOT}" || exit 1

sudo a2ensite paint_domain.conf
sudo a2dissite 000-default.conf
sudo apache2ctl configtest
echo "You should recieve: Syntax OK"
sudo systemctl restart apache2

# Activate virtual environment and upgrade pip.
source $ENV_PATH/bin/activate
pip install --upgrade pip

# Install dependencies.
pip install --upgrade .

# Mount to the LSDF
echo "Mount to the LSDF"
sudo sshfs -o umask=0,uid=0,gid=0,allow_other [email protected]:/lsdf/kit/scc/projects/paint /mnt/lsdf

echo "Installation and setup complete."
30 changes: 30 additions & 0 deletions html/paint_domain-le-ssl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<IfModule mod_ssl.c>
<VirtualHost *:443>
ServerAdmin [email protected]
ServerName paint-database.org
DocumentRoot "/var/www/html/"
ProxyPassMatch ^/favicon.ico !
Alias /icons/ "/usr/share/apache2/icons/"
<Directory "/usr/share/apache2/icons">
Options Indexes MultiViews
AllowOverride None
Require all granted
Allow from all
</Directory>
ProxyPass /WRI1030197 !
Alias /WRI1030197 "/mnt/lsdf/WRI1030197/"
<Directory "/mnt/lsdf/WRI1030197">
Options Indexes FollowSymLinks
Require all granted
AddDefaultCharset UTF-8
IndexOptions FancyIndexing IconsAreLinks
</Directory>
ProxyPass / http://127.0.0.1:8000/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ServerAlias paint-database.org
Include /etc/letsencrypt/options-ssl-apache.conf
SSLCertificateFile /etc/letsencrypt/live/paint-database.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/paint-database.org/privkey.pem
</VirtualHost>
</IfModule>
30 changes: 30 additions & 0 deletions html/paint_domain.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName paint-database.org
ServerAlias paint-database.org
DocumentRoot "/var/www/html/"
ProxyPassMatch ^/favicon.ico !
Alias /icons/ "/usr/share/apache2/icons/"
<Directory "/usr/share/apache2/icons">
Options Indexes MultiViews
AllowOverride None
Require all granted
Allow from all
</Directory>
ProxyPass /WRI1030197 !
Alias /WRI1030197 "/mnt/lsdf/WRI1030197/"
<Directory "/mnt/lsdf/WRI1030197">
Options Indexes FollowSymLinks
Require all granted
AddDefaultCharset UTF-8
IndexOptions FancyIndexing IconsAreLinks
</Directory>
ProxyPass / http://127.0.0.1:8000/
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =paint.datamanager.kit.edu [OR]
RewriteCond %{SERVER_NAME} =www.paint-database.org [OR]
RewriteCond %{SERVER_NAME} =paint-database.org
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
</VirtualHost>
18 changes: 18 additions & 0 deletions html/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
PAINT_ROOT=/home/paint/PAINT
ENV_PATH=/home/paint/venv

# Activate virtual environment.
source $ENV_PATH/bin/activate

# Navigate to html directory.
cd ${PAINT_ROOT}/html || exit 1

# Kill flask application.
kill $(ps aux | grep '[p]ython wsgi.py' | awk '{print $2}')

# Start flask application.
python wsgi.py &

# Restart apache.
sudo systemctl restart apache2
28 changes: 28 additions & 0 deletions html/static/css/paint.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,34 @@
font-weight: 400;
}

@media (min-width: 1300px){
.navbar-expand-custom {
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
}
.navbar-expand-custom .navbar-nav {
flex-direction: row;
}
.navbar-expand-custom .dropdown-menu {
position: absolute;
}
.navbar-expand-custom .nav-link {
padding-right: .5rem;
padding-left: .5rem;
}
.navbar-expand-custom > .container {
flex-wrap: nowrap;
}
.navbar-expand-custom .navbar-collapse {
display: flex!important;
flex-basis: auto;
}
.navbar-expand-custom .navbar-toggler {
display: none;
}
}

:root {
--bs-primary: #002864;
--bs-primary-rgb: 0, 40, 100;
Expand Down
Loading