/

Places to Check for Issues

Learn how to Find Why Donation Store May not be Running Properly on Your Server

Introduction


Sometimes things break, but that's okay! As you are running Donation Store on your server, you have control over how it runs, meaning that we unfortunately cannot control every aspect of it remotely. That's why there can be errors that present themselves based on certain configuration issues or other problems. This doc is aimed at trying to cover the top most faced problems by our customers and explain the reason why the issue may have arisen.

As you are running Donation Store on your server, it is beneficial to be able to understand how it works and what to do if things go wrong. That's why before reaching out with a Support Ticket, it is worth reading this doc. We have also created a Concepts and How Donation Store works doc which goes through information on the technologies used by Donation Store and how they work. It is also worth reading.

If your issue isn't here, please do Open a Support Ticket and we will get back to you as soon as possible

502 Bad Gateway (Nginx)


Sometimes if you visit the web application you may get this error. This is an error from Nginx which means that Nginx is up and running and is accepting requests, so it's not an Nginx issue. When you receive a 502 error, it means that the Donation Store application isn't started. To check the status of Donation Store you can run the following:

systemctl status donationstore-app

Most of the time you will see a reason why Donation Store cannot start from the log if it is failing to start. If you fix the issue and you want to restart Donation Store, just run

service donationstore restart

If your issue can't be solved by using the status command, there could be other issues. In any case, do the following checks to see if you can find the issue:

  • Make sure that the IP address of your server is provided in the following file beside the Gunicorn run command on the line that starts with ExecStart /etc/systemd/system/donationstore-app.service It should look something like this (beside the bind flag):

    ExecStart=/home/donationstore/env/bin/gunicorn DonationStoreV2.wsgi:application --bind 123.123.123:8000 --error-logfile /var/log/donationstore/error.log --access-logfile /var/log/donationstore/access.log

  • Make sure that Donation Store dependencies have been installed. If you run the setup and you don't choose a database or you exit the setup script, it might fail to install dependencies. This means that Gunicorn isn't installed and Donation Store cannot start because of this. To check dependencies, activate your virtual environment and run pip freeze. A full list of dependencies will be outputted. If they have not be installed there will only be a couple listed, whereas if they have there should be about 25 (including Gunicorn)

    source /home/donationstore/env/bin/activate
    pip freeze

  • Make sure that your Nginx configuration is pointing to the right IP and port that Donation Store should be running on. If Donation Store is running but Nginx is trying to pass the request to an incorrect IP address or port, you will more than likely get this error. Open the /etc/nginx/sites-available/DonationStore configuration file and make sure that the following line has the IP of your server and port 8000. You cannot use your sub domain here, it has to be the IP address of the current server.

    proxy_pass http://123.123.123:8000;

  • Like mentioned before, Donation Store won't be able to start if it's dependencies are not installed properly installed. If you find that your dependencies aren't installed, it might be because when you ran the initial script you didn't run it as root. If you don't run it as root or with root privileges then some of the install steps may fail. The database portion of the install requires access to certain files (like MySQL files), that are necessary to build certain dependencies.


  • If when you run the installer you get a "File not found exception", where it lists one of the files it can't find, it is more than likely the case that you are not running the setup script in the home directory. It must be run in the home directory.


  • If the dependencies are installed and the reason why Donation Store isn't starting is because Gunicorn (the web server that runs Donation Store) is facing some sort of problem. You can check the logs to see why that might be. Error logs for starting Donation Store can be found in /var/log/donationstore/error.log

400 Bad Request


You'll probably notice that this HTTP status error looks slightly different to the Nginx one that you may have seen above. This is because this error code isn't coming from Nginx. When Debug mode is turned off on Donation Store this will show up.

This error code is associated with how Donation Store blocks requests from non whitelisted hosts to stop HTTP Host header attacks. To solve this, simply navigate to the following file /home/donationstore/env/DonationStoreV2/settings.py and on the line where it mentions "ALLOWED_HOSTS", provide your sub domain. The complete line should look like

ALLOWED_HOSTS = ['store.donationstore.io']

This change will require a restart of Donation Store, so run

service donationstore restart

Programming Error, Table Doesn't Exist


This error message means that Donation Store cannot start because the tables that are required to run it don't exist. This can be solved by activating your virtual environment and running the "migrate" command which will instruct Donation Store to create the tables

source /home/donationstore/env/bin/activate
python3 /home/donationstore/env/manage.py migrate

Have you installed MySQL-python


As mentioned in the Database Doc, Donation Store requires a database driver to be able to interact with the database you choose. This error means that it isn't installed. Follow the information in the Database Doc to find out how to install the correct driver.

Dependent Services Not Running


Donation Store has a single service start|restart|stop command. However this is made up of multiple different services. The 3 services are the main app (which is covered above), Celery and RabbitMQ. To see the status of each of these services individually, run

systemctl

You can scroll down this list and see why any of the services might not be running. If they aren't running they will be red and you'll see their status as not active. The next couple of sections explains why each service might not be running and what you can do to fix it

RabbitMQ Not Running


RabbitMQ can start up and stop pretty easily, as long as it is setup properly. It has been found that if you change the IP address of the server that is running Donation Store, after you installed Donation Store, RabbitMQ can fail to start. This will also lead to issues on the Control Panel where emails may not be sending properly. To see the status of this you can try restart RabbitMQ and check the logs that were displayed when attempting to start using

systemctl restart rabbitmq-server
journalctl -xe

Sometimes, RabbitMQ will try to use a node name that has an IP or address that it cannot resolve. It is known that it might try to use something like rabbit@store as the nodename, but it cannot start because the store portion cannot be resolved. To fix this, you can either make it so store resolves, or you can change the nodename to a hostname that resolves, by editing the following file: /etc/rabbitmq/rabbitmq.conf. Once changed restart it like above and restart Donation Store.

systemctl restart rabbitmq-server
service donationstore restart

Check the Logs & Service Statuses


The logs present invaluable information that can give you a better insight as to what went wrong. There are two log files linked to Donation Store:

  • /var/log/donationstore/error.log
  • /var/log/donationstore/access.log

It is also very useful to check the status of all of the Donation Store services/sub services. The main Donation Store services are:

  • service donationstore status
  • systemctl status donationstore-app
  • systemctl status donationstore-celery

Still Have Issues?


If you still have issues and the information on this doc hasn't really helped, please reach out to us. Please provide as much information as you can. For example if you provide a one sentence question, chances are we will ask you to send more information meaning the time to solve your issue will be longer. So please, when sending a ticket, give as much information as you can, using the information provided here.

Click here to submit a support ticket


Have Questions? Open a Support Ticket

View Common Issues on the Knowledgebase

Video Guides on YouTube

Other clients and Donation Store developers hang out on our Discord server, where you can ask for support in #ds-chat, or if you are a Client and you don't uet have your Client role on Discord, let us know and we can add it. Once added you get access to our private Client's support channel.