gists | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
This is a quick guide on how to install Alf.io manually on a fresh machine.
- Ubuntu 22.04.1 LTS
- Point your Domain to the Server
sudo adduser alfio
Add sudo permissions to the user we created alfio
sudo usermod -aG sudo alfio
su alfio
To run Alf.io we need to install the Java Developement Kit
sudo apt update
sudo apt install openjdk-17-jdk
sudo apt install openjdk-17-jre
java --version
Next we are going to set the database for Alf.io up. Enter this to install PostgreSQL.
sudo apt-get install postgresql postgresql-contrib -y
When finished, we will access the CLI.
sudo -u postgres psql
Once accessed, we will create a new user, and grant him all privileges on the alfiodb databse.
CREATE USER alfio WITH ENCRYPTED PASSWORD '<YOUR_POSTGRESQL_PASSWORD_HERE>';
CREATE DATABASE alfiodb;
GRANT ALL PRIVILEGES ON DATABASE "alfiodb" to alfio;
To make the application accessible from the internet, we will need to reverse proxy it with nginx. Install nginx with this command and edit the configuration.
sudo apt-get install nginx -y
- Point your domian to IP address
sudo vi /etc/nginx/sites-available/default
- Remove the default settings and replace them with the following.
server {
listen 80;
server_name <YOUR_DOMAIN_NAME>;
location / {
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Install snapd and update
sudo apt install snapd
sudo snap install core; sudo snap refresh core
Remove existing installations of certbot & Install certbot
sudo apt-get remove certbot
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
For one step automatic ssl installation & fill the details based command displayed on the screen
sudo certbot --nginx
Lets restart nginx
sudo systemctl restart nginx
cd /home/alfio/
To get the link to the latest version of Alf.io on the release page, go to https://github.com/exteso/alf.io/releases. From there, you can download the .war file by clicking on the "Assets" button next to the latest release.
wget https://github.com/alfio-event/alf.io/releases/download/2.0-M4-2301/alfio-2.0-M4-2301-boot.war
To create a config file named "application.properties" with specific content, you can use the following command in a terminal:
vi application.properties
And add following code and use same database name and password which you added on PostgreSQL
datasource.dialect=PGSQL
datasource.driver=org.postgresql.Driver
datasource.url=jdbc:postgresql://localhost:5432/alfiodb
datasource.username=alfio
datasource.password=<YOUR_POSTGRESQL_PASSWORD_HERE>
datasource.validationQuery=SELECT 1
spring.profiles.active=jdbc-session
To save vim file Press the Esc
key to exit insert mode, if you are in it. You can save and exit the editor in one command by typing :wq
and then pressing Enter
.
We can create systemd script for starting at boot and running in background. A systemd script is a script or configuration file that is used to control the behavior of a service managed by the systemd init system. These scripts, also known as unit files, specify how the service should be started, stopped, and restarted, as well as other options such as dependencies and resource limits. They are typically stored in the /etc/systemd/system directory, and can be controlled using the systemctl command.
cd /home/alfio
ls
copy the .war file name and create start.sh
sudo vi start.sh
add following code and replace the .war file name and path of java if it if required
#!/bin/sh
/usr/bin/java -jar /home/alfio/alfio-2.0-M4-2301-boot.war -Xms100M -Xmx256M > startup.log 2>&1
sudo chmod 744 start.sh
cd /etc/systemd/system/
sudo vi alfio.service
- add following code in this perticular file
[Unit]
Description=alfio
After=postgresql.service
Requires=postgresql.service
[Service]
User=alfio
WorkingDirectory=/home/alfio
ExecStart=/home/alfio/start.sh
ExecStop=/bin/kill -TERM $MAINPID
Restart=always
[Install]
WantedBy=multi-user.target
sudo chmod 644 alfio.service
cd /home/alfio
sudo systemctl enable alfio.service
sudo systemctl start alfio.service
cd logs/
vi alfio.log
Copy the administrator password from alfio.log file Note: admin password cannot be reset without accessing the application.
If in case you can't find log details on startup.log and alfio.log and restart the mechine and see
You can access your admin panel @ yourdomain.com/admin username is admin and password is the one copied from alfio.log file
- [Alf.io Manual Installation by @flexwie] https://gist.github.com/flexwie/a8572e8e7ef06ae844925ec857fa3b5b#file-alfio_manual_install-md
- [How to run a script as a background process?]https://medium.com/@saketshukla/how-to-run-a-script-as-a-background-process-e110c6dc946e
- systemd service: permission denied
- [admin password reset]alfio-event/alf.io#1003
- https://github.com/alfio-event/alf.io
A special thank you to the Alf.io team for making this amazing ticket reservation system for conferences, trade shows, workshops, and meetups open source. We appreciate all the hard work and dedication that went into creating this project.
Hope this tutorial is helpful and let me know you feedback
Hey,
first of all many many thanks for this detailed tutorial!
Nevertheless, I can't get alf.io to work. I wish I knew what I'm doing wrong.
Do you think you can help me? I would be very grateful.
Your tutorial is already very detailed, but probably missing something somewhere that I do not understand as a beginner.
A video would not be feasible for you, right?
Many thanks
Emircan