Compare commits
10 Commits
16f09bebca
...
main
Author | SHA1 | Date | |
---|---|---|---|
81645ebf0b | |||
04a9664bee | |||
91ea3430f2 | |||
630e5eefbc | |||
a23510203c | |||
35c892187b | |||
ef59275a72 | |||
e26fe96217 | |||
a5e8c49da5 | |||
4f42fa82ac |
79
setup_ente_web.sh
Executable file
79
setup_ente_web.sh
Executable file
@ -0,0 +1,79 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Exit immediately if a command exits with a non-zero status.
|
||||
set -e
|
||||
|
||||
# This script assumes you have already configured the .env.local file in the photos app directory
|
||||
|
||||
# set the local repo location
|
||||
LOCAL_REPO="/home/mason/src/ente"
|
||||
|
||||
cd $LOCAL_REPO/web
|
||||
|
||||
# make sure that all the previous build steps have been completed
|
||||
# the following steps are required to build the photos app
|
||||
|
||||
#git submodule update --init --recursive
|
||||
#yarn install
|
||||
#yarn build:photos # puts the built files in the web/apps/photos/out directory
|
||||
|
||||
echo "$LOCAL_REPO/web/apps/photos/out"
|
||||
|
||||
# make sure the photos app is built
|
||||
if [ ! -d "$LOCAL_REPO/web/apps/photos/out" ]; then
|
||||
echo "The photos app has not been built. Please build the app and rerun the script."
|
||||
|
||||
# print the steps to build the photos app
|
||||
echo "To build the photos app, run the following commands:"
|
||||
echo "cd $LOCAL_REPO/web"
|
||||
echo "git submodule update --init --recursive"
|
||||
echo "yarn install"
|
||||
echo "yarn build:photos"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# make sure the destination directory exists
|
||||
sudo mkdir -p /var/www/ente
|
||||
|
||||
sudo cp -r $LOCAL_REPO/web/apps/photos/out /var/www/ente/photos
|
||||
|
||||
# configure nginx to serve the photos app on ente.sa.vin
|
||||
sudo tee /etc/nginx/sites-available/ente.sa.vin.conf > /dev/null <<EOL
|
||||
server {
|
||||
listen 80;
|
||||
server_name ente.sa.vin;
|
||||
|
||||
location / {
|
||||
root /var/www/ente/photos;
|
||||
index index.html;
|
||||
try_files \$uri /index.html;
|
||||
}
|
||||
}
|
||||
EOL
|
||||
|
||||
# create a symbolic link to enable the site
|
||||
sudo ln -s /etc/nginx/sites-available/ente.sa.vin.conf /etc/nginx/sites-enabled/
|
||||
|
||||
# Also configure nginx to serve the same photos app on entep.sa.vin
|
||||
sudo tee /etc/nginx/sites-available/entep.sa.vin.conf > /dev/null <<EOL
|
||||
server {
|
||||
listen 80;
|
||||
server_name entep.sa.vin;
|
||||
|
||||
location / {
|
||||
root /var/www/ente/photos;
|
||||
index index.html;
|
||||
try_files \$uri /index.html;
|
||||
}
|
||||
}
|
||||
EOL
|
||||
|
||||
sudo ln -s /etc/nginx/sites-available/entep.sa.vin.conf /etc/nginx/sites-enabled/
|
||||
|
||||
# reload nginx to apply changes
|
||||
sudo systemctl reload nginx
|
||||
|
||||
# use certbot to add SSL certificate for the photos app
|
||||
sudo certbot --nginx -d ente.sa.vin -d entep.sa.vin
|
||||
|
||||
echo "Ente web app has been set up successfully. Access the app at https://ente.sa.vin or https://entep.sa.vin"
|
@ -35,12 +35,13 @@ Group=minio
|
||||
ProtectSystem=full
|
||||
|
||||
# Set environment variables for MinIO configuration
|
||||
Environment=MINIO_BROWSER_REDIRECT_URL=https://minio.sa.vin
|
||||
Environment=MINIO_SERVER_URL=https://minio.sa.vin/
|
||||
Environment=MINIO_BROWSER_REDIRECT_URL=https://minio.sa.vin/minio/ui
|
||||
Environment=MINIO_ROOT_USER=minio_root_user_60c4cbcd
|
||||
Environment=MINIO_ROOT_PASSWORD=74fcd51acc7bfeca02223ce516324a
|
||||
|
||||
EnvironmentFile=-/etc/default/minio
|
||||
ExecStart=/usr/local/bin/minio server /mnt/md0/minio/
|
||||
ExecStart=/usr/local/bin/minio server --console-address ":45855" /mnt/md0/minio/
|
||||
# Let systemd restart this service always
|
||||
Restart=always
|
||||
# Specifies the maximum file descriptor number that can be opened by this process
|
||||
|
@ -3,8 +3,8 @@
|
||||
# Exit immediately if a command exits with a non-zero status.
|
||||
set -e
|
||||
|
||||
# MinIO server should be running on port 9000
|
||||
MINIO_PORT=9000
|
||||
# MinIO server should be running on port 45855
|
||||
MINIO_PORT=45855
|
||||
|
||||
# Configure nginx to proxy requests to the MinIO server
|
||||
sudo tee /etc/nginx/sites-available/minio.sa.vin.conf > /dev/null <<EOL
|
||||
@ -13,7 +13,7 @@ server {
|
||||
server_name minio.sa.vin;
|
||||
|
||||
location / {
|
||||
proxy_pass http://
|
||||
proxy_pass http://127.0.0.1:$MINIO_PORT;
|
||||
proxy_set_header Host \$host;
|
||||
proxy_set_header X-Real-IP \$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
||||
@ -22,8 +22,66 @@ server {
|
||||
}
|
||||
EOL
|
||||
|
||||
sudo tee /etc/nginx/sites-available/minio.sa.vin.conf > /dev/null <<EOL
|
||||
upstream minio_s3 {
|
||||
server 10.0.0.190:9000;
|
||||
}
|
||||
|
||||
upstream minio_console {
|
||||
server 10.0.0.190:$MINIO_PORT;
|
||||
}
|
||||
|
||||
server {
|
||||
server_name minio.sa.vin;
|
||||
|
||||
location / {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
proxy_connect_timeout 300;
|
||||
# Default is HTTP/1, keepalive is only enabled in HTTP/1.1
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Connection "";
|
||||
chunked_transfer_encoding off;
|
||||
|
||||
proxy_pass http://minio_s3; # This uses the upstream directive definition to load balance
|
||||
}
|
||||
|
||||
location /minio/ui/ {
|
||||
rewrite ^/minio/ui/(.*) /$1 break;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-NginX-Proxy true;
|
||||
|
||||
# This is necessary to pass the correct IP to be hashed
|
||||
real_ip_header X-Real-IP;
|
||||
|
||||
proxy_connect_timeout 300;
|
||||
|
||||
# To support websockets in MinIO versions released after January 2023
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
# Some environments may encounter CORS errors (Kubernetes + Nginx Ingress)
|
||||
# Uncomment the following line to set the Origin request to an empty string
|
||||
# proxy_set_header Origin '';
|
||||
|
||||
chunked_transfer_encoding off;
|
||||
|
||||
proxy_pass http://minio_console; # This uses the upstream directive definition to load balance
|
||||
}
|
||||
|
||||
listen 80;
|
||||
|
||||
}
|
||||
EOL
|
||||
|
||||
# Create a symbolic link to enable the site
|
||||
sudo ln -s /etc/nginx/sites-available/minio.sa.vin /etc/nginx/sites-enabled/
|
||||
sudo ln -s /etc/nginx/sites-available/minio.sa.vin.conf /etc/nginx/sites-enabled/
|
||||
|
||||
# Reload nginx to apply changes
|
||||
sudo systemctl reload nginx
|
||||
|
@ -4,7 +4,7 @@
|
||||
set -e
|
||||
|
||||
# set the local repo location
|
||||
LOCAL_REPO="~/src/ente"
|
||||
LOCAL_REPO="/home/mason/src/ente"
|
||||
INSTALL_DIR="/usr/local/bin/"
|
||||
LIB_DIR="/var/lib/museum/"
|
||||
PORT=1098
|
||||
@ -14,13 +14,13 @@ cd $LOCAL_REPO/server
|
||||
# sed command to replace `server.Run(":8080")` with `server.Run(":$PORT")`
|
||||
sed -i "s/server.Run(\":8080\")/server.Run(\":$PORT\")/g" cmd/museum/main.go
|
||||
|
||||
go build -o museum cmd/museum/main.go
|
||||
/usr/local/go/bin/go build -o museum cmd/museum/main.go
|
||||
|
||||
sudo cp museum $INSTALL_DIR
|
||||
|
||||
# Create a new user and group named 'museum'
|
||||
sudo groupadd -r museum
|
||||
sudo useradd -r -g museum -d $LIB_DIR -s /sbin/nologin -c "museum user" museum
|
||||
sudo groupadd -r museum || true
|
||||
sudo useradd -r -g museum -d $LIB_DIR -s /sbin/nologin -c "museum user" museum || true
|
||||
|
||||
|
||||
sudo mkdir -p $LIB_DIR
|
||||
|
@ -19,7 +19,7 @@ server {
|
||||
EOL
|
||||
|
||||
# Create a symbolic link to enable the site
|
||||
sudo ln -s /etc/nginx/sites-available/museum /etc/nginx/sites-enabled/
|
||||
sudo ln -s /etc/nginx/sites-available/museum.sa.vin.conf /etc/nginx/sites-enabled/
|
||||
|
||||
# Reload nginx to apply changes
|
||||
sudo systemctl reload nginx
|
||||
|
15
update_minio.sh
Normal file
15
update_minio.sh
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Exit immediately if a command exits with a non-zero status.
|
||||
set -e
|
||||
|
||||
# Download and install MinIO server
|
||||
wget https://dl.min.io/server/minio/release/linux-amd64/minio -O /usr/local/bin/minio
|
||||
|
||||
# Make the MinIO binary executable
|
||||
chmod +x /usr/local/bin/minio
|
||||
|
||||
# Restart the MinIO service
|
||||
sudo systemctl restart minio
|
||||
|
||||
echo "MinIO server has been updated successfully."
|
Reference in New Issue
Block a user