[FIX] production installation documentation with proxy nginx

This commit is contained in:
Mathieu Benoit 2021-07-20 02:56:14 -04:00
parent a657de81f8
commit 9cdbeac9ba
7 changed files with 45 additions and 11 deletions

View file

@ -64,6 +64,11 @@ install_dev:
install_os:
./script/install_dev.sh
.PHONY: install_production
install_production:
./script/install_dev.sh
./script/install_production.sh
.PHONY: install_docker_debian
install_docker_debian:
./script/ install_debian_10_prod_docker.sh

View file

@ -10,14 +10,31 @@ cd ERPLibre
### 2. Modify the parameters
Modify the file env_var.sh for production installation.
Enable nginx if you need a proxy with `EL_INSTALL_NGINX`.
Redirect your DNS to the proxy's ip and add your A and AAAA into `WL_WEBSITE_NAME` with space between.
### 3. Execute the script:
#### With proxy nginx production, install certbot before for SSL
```bash
# Snap installation
# https://snapcraft.io/docs/installing-snap-on-debian
sudo apt install -y snapd
sudo snap install core
sudo snap refresh core
# https://certbot.eff.org/lets-encrypt/debianbuster-nginx
# Cerbot
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
```
#### Ubuntu 18.04 server
```bash
./script/install_dev.sh
./script/install_production.sh
```
A service is running by systemd. You can access it with the DNS name found in env_var.sh
A service is running by SystemD. You can access it with the DNS name found in env_var.sh
#### Ubuntu 20.04 server
Apply fix libpng12-0: https://www.linuxuprising.com/2018/05/fix-libpng12-0-missing-in-ubuntu-1804.html
@ -26,7 +43,7 @@ Apply fix libpng12-0: https://www.linuxuprising.com/2018/05/fix-libpng12-0-missi
./script/install_dev.sh
./script/install_production.sh
```
A service is running by systemd, you can access with the DNS name found in env_var.sh
A service is running by SystemD, you can access with the DNS name found in env_var.sh
### 4. SSL:
Generate a ssl certificate

View file

@ -36,6 +36,10 @@ Run `make image_db_create_all`, this will generate image in directory `./image_d
Run `make docker_build` to generate a docker.
### Test production Ubuntu environment
Follow instruction into [PRODUCTION.md](./PRODUCTION.md).
## Generate new prod and release
Generate production manifest and freeze all repos versions.

View file

@ -19,7 +19,7 @@ EL_MINIMAL_ADDONS="False"
# Set this to True if you want to install Nginx!
EL_INSTALL_NGINX="True"
# Set the website name
EL_WEBSITE_NAME=""
EL_WEBSITE_NAME="localhost"
EL_GITHUB_TOKEN=""
EL_MANIFEST_PROD="./default.xml"
EL_MANIFEST_DEV="./manifest/default.dev.xml"

View file

@ -68,9 +68,12 @@ echo "User service: ${EL_USER}"
echo "User PostgreSQL: ${EL_USER}"
echo "Code location: ${EL_USER}"
echo "Addons folder: ${EL_USER}/${EL_CONFIG}/addons/"
echo "SystemD file ERPLibre: /etc/systemd/system/${EL_CONFIG}.service"
echo "Start ERPLibre service: sudo systemctl start ${EL_CONFIG}"
echo "Stop ERPLibre service: sudo systemctl stop ${EL_CONFIG}"
echo "Restart ERPLibre service: sudo systemctl restart ${EL_CONFIG}"
echo "Status ERPLibre service: sudo systemctl status ${EL_CONFIG}"
echo "Logs ERPLibre service: sudo journalctl -feu ${EL_CONFIG}"
echo "-----------------------------------------------------------"
echo -e "* Starting ERPLibre Service"

View file

@ -2,8 +2,6 @@
. ./env_var.sh
./script/install_debian_dependency.sh
echo -e "\n---- Create ERPLIBRE system user ----"
sudo adduser --system --quiet --shell=/bin/bash --home=/${EL_USER} --gecos 'ERPLIBRE' --group ${EL_USER}
#The user should also be added to the sudo'ers group.

View file

@ -2,12 +2,19 @@
. ./env_var.sh
TEMP_FILENAME_NGINX_AVAILABLE="localhost"
NEW_EL_WEBSITE_NAME="${EL_WEBSITE_NAME}"
if [[ -z "${EL_WEBSITE_NAME}" ]]; then
NEW_EL_WEBSITE_NAME=${TEMP_FILENAME_NGINX_AVAILABLE}
fi
TEMP_FILE_NGINX_AVAILABLE="/tmp/${TEMP_FILENAME_NGINX_AVAILABLE}"
#--------------------------------------------------
# Install Nginx if needed
#--------------------------------------------------
if [ ${EL_INSTALL_NGINX} = "True" ]; then
echo -e "\n---- Installing and setting up Nginx ----"
cat <<EOF > /tmp/nginx${EL_USER}
echo -e "\n---- Installing and setting up Nginx into ${TEMP_FILE_NGINX_AVAILABLE} ----"
cat <<EOF >${TEMP_FILE_NGINX_AVAILABLE}
upstream erplibre${EL_USER} {
server 127.0.0.1:${EL_PORT};
}
@ -18,7 +25,7 @@ upstream erplibre${EL_USER}chat {
server {
listen 80;
server_name ${EL_WEBSITE_NAME};
server_name ${NEW_EL_WEBSITE_NAME};
# Add Headers for erplibre proxy mode
proxy_set_header X-Forwarded-Host \$host;
@ -80,11 +87,11 @@ server {
}
EOF
sudo mv -f /tmp/nginx${EL_USER} /etc/nginx/sites-available/${EL_WEBSITE_NAME}
sudo ln -fs /etc/nginx/sites-available/${EL_WEBSITE_NAME} /etc/nginx/sites-enabled/${EL_WEBSITE_NAME}
sudo mv -f ${TEMP_FILE_NGINX_AVAILABLE} /etc/nginx/sites-available/${NEW_EL_WEBSITE_NAME}
sudo ln -fs /etc/nginx/sites-available/${NEW_EL_WEBSITE_NAME} /etc/nginx/sites-enabled/${NEW_EL_WEBSITE_NAME}
sudo rm -f /etc/nginx/sites-enabled/default /etc/nginx/sites-available/default
sudo systemctl restart nginx
echo "Done! The Nginx server is up and running. Configuration can be found at /etc/nginx/sites-enabled/${EL_WEBSITE_NAME}"
echo "Done! The Nginx server is up and running. Configuration can be found at /etc/nginx/sites-enabled/${NEW_EL_WEBSITE_NAME}"
echo "Run manually certbot : sudo certbot --nginx"
else
echo "Nginx isn't installed due to choice of the user!"