-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
76 lines (63 loc) · 2.1 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
install_packages() {
echo
echo "Installing packages..."
echo
sudo apt-get update
sudo apt-get install -y curl nginx certbot python3-certbot-nginx
echo
echo "Packages have been installed."
}
download_docker_compose() {
echo
echo "Downloading docker-compose.yml..."
sudo curl -sSL https://raw.githubusercontent.com/Loudbooks/PasteBook/refs/heads/master/docker-compose.yml -o docker-compose.yml
echo "docker-compose.yml has been created."
}
create_env_file() {
echo
echo "Creating .env file..."
echo
read -p "Enter the title to be used for PasteBook (leave blank for default): " TITLE
read -p "Enter the description to be used for the home page of PasteBook (leave blank for default): " DESCRIPTION
read -p "Disable new paste creation? (yes/no): " DISABLE_NEW
cat <<EOL > .env
TITLE=${TITLE}
DESCRIPTION=${DESCRIPTION}
DISABLE_NEW=${DISABLE_NEW}
EOL
echo
echo ".env file has been created."
}
download_and_configure_nginx() {
echo
echo "Downloading default Nginx configuration..."
echo
sudo curl -sSL https://raw.githubusercontent.com/Loudbooks/PasteBook/refs/heads/master/pastebook.conf -o /etc/nginx/sites-available/pastebook.conf
read -p "Enter your domain name (e.g., pastebook.dev): " DOMAIN
sudo sed -i "s/<DOMAIN>/${DOMAIN}/g" /etc/nginx/sites-available/pastebook.conf
sudo ln -s /etc/nginx/sites-available/pastebook.conf /etc/nginx/sites-enabled/
echo
echo "Nginx configuration completed."
echo
echo
echo Have you added an A record for your domain pointing to this server\'s IP address, and an A record for api.\<your-domain\> pointing to the same IP address?
read -p "Press Enter to continue..."
echo "Setting up SSL with Certbot..."
sudo certbot --nginx -d ${DOMAIN} -d api.${DOMAIN}
echo
echo "SSL setup completed."
systemctl restart nginx
}
ready() {
echo
echo PasteBook is ready!
echo You can start PasteBook by running:
echo docker compose up -d
echo
}
install_packages
download_docker_compose
create_env_file
download_and_configure_nginx
ready