How to Install Wakapi on Debian Latest
In this tutorial, we will walk through the process of installing Wakapi, a self-hosted analytics tool for Wakatime, on Debian Latest.
Prerequisites
Before we begin, make sure you have the following:
- A server running Debian Latest
- A non-root user with sudo privilege
Step 1: Install Required Dependencies
The first step is to ensure that your system has all the necessary dependencies required to run Wakapi. You will need to update your system’s package list by running:
sudo apt update
Once the update is complete, install the following dependencies:
sudo apt install build-essential git mongodb nginx nodejs npm
After installing the dependencies, you can verify that Node.js and npm are properly installed by running:
nodejs -v
npm -v
Step 2: Clone Wakapi Repository
Next, clone the Wakapi repository using Git:
git clone https://github.com/muety/wakapi.git
Once the cloning is complete, navigate to the Wakapi directory:
cd wakapi
Step 3: Install Wakapi Dependencies
Install the required Node.js dependencies:
npm install
Step 4: Configure Wakapi
The Wakapi configuration file is located in the config directory. Use the following command to copy the default configuration file to a new file:
cp config.default.js config.js
Modify the new configuration file to include your Wakatime API key, MongoDB connection URL, and other settings. Refer to the Wakapi documentation for details on configuring the tool.
Step 5: Start MongoDB
Start the MongoDB database by running:
sudo systemctl start mongodb
You can check the status of the MongoDB service by running:
sudo systemctl status mongodb
Step 6: Start Wakapi
Start Wakapi by running:
npm start
You should see a message indicating that the server is running on port 3000.
Step 7: Configure Nginx as a Reverse Proxy
Finally, you can configure Nginx to act as a reverse proxy for Wakapi. Create a new Nginx configuration file in the /etc/nginx/sites-available/ directory:
sudo nano /etc/nginx/sites-available/wakapi.conf
Paste the following configuration into the file:
server {
listen 80;
server_name your_domain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
Replace your_domain.com with your domain name or IP address.
Create a symbolic link to the new configuration file in the /etc/nginx/sites-enabled/ directory:
sudo ln -s /etc/nginx/sites-available/wakapi.conf /etc/nginx/sites-enabled/
Finally, restart Nginx:
sudo systemctl restart nginx
Conclusion
Congratulations! You have successfully installed Wakapi on Debian Latest and configured it to run behind Nginx as a reverse proxy. Start tracking your Wakatime data and generate insightful analytics reports.