Skip to content

Instantly share code, notes, and snippets.

@shraddhaag
Last active June 17, 2019 13:07
Show Gist options
  • Save shraddhaag/b072a7021a8b11cd8e1b5cfc8fca685f to your computer and use it in GitHub Desktop.
Save shraddhaag/b072a7021a8b11cd8e1b5cfc8fca685f to your computer and use it in GitHub Desktop.
Fedora Happiness Packets - Staging Server

Errors encountered and changes made:

  1. Warning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead.

    Solution:

    1. Updated psycopg2 to version >=2.8 in requirements/base.txt
    2. Updated the virtualenv to reflect these changes.
  2. Error: django.db.utils.OperationalError: FATAL: Peer authentication failed for user "admin"

    Solution: In /var/lib/pgsql/data/pg_hba.conf changed local all all peer to local all all md5 to facilitate password based authentication.

  3. Error: django.db.utils.ProgrammingError: must be owner of relation auth_user

    Solution: Accessing the PostgreSQL prompt and running \dt displayed the tables under databse happinesspackets are owned by user myprojectuser and not by the user admin with which we were loggin in. To solve this:

    1. Changed the password of the user myprojectuser to the same as admin's password.
    2. In start.sh changed DB_USERNAME to myprojectuser.

Doing the above resulted in the server running without any errors.

Steps taken while debugging:

  1. Nginx: Checked the configuration files for Nginx, etc/nginx/site-available/happinesspackets and ran the test command sudo nginx -t which returned no errors.

  2. Gunicorn: Service was failed when checked using systemctl. Restarted the service successfully.

The site is accessible.

To be resolved:

  1. The home page is not responsive.
  2. The login isn't working.

To verify the working of the above, I made fedora-happiness-packets/test.py to start a local server on the staging server. Using curl I tried to access the home page. It still isn't working. Which implies the code breaks in deployment and needs to be debugged. Henceforth, the staging server is configured correctly.

Misc Info

Log file for Django: /srv/logs/django.log

Log file for Nginx: /var/log/nginx/error.log

ENV Varibales:

  • ADMINS (under settings)
  • SERVER_EMAIL
  • DEFAULT_FROM_EMAIL

// client_secrets.json

  • OIDC_RP_CLIENT_ID
  • OIDC_RP_CLIENT_SERCRET

// production/staging instance for authentication with Ipsilon

  • OIDC_OP_AUTHORISATION_ENDPOINT
  • OIDC_OP_TOKEN_ENDPOINT
  • OIDC_OP_USER_ENDPOINT
  • logout URL to redirect to

// python-fedora auth

  • ADMIN_USERNAME
  • ADMIN_PASSWORD

// Email Configurations

  • EMAIL_HOST_USER
  • EMAIL_HOST_PASSWORD

// Database configurations

  • DB_NAME
  • DB_USERNAME
  • DB_PASSWORD

// Users/Groups to provide admin privileges

  • ADMINS (under auth)

  • DJANGO_SETTINGS_MODULE

  • FEDORA_MESSAGING_CONF

  • POSTGRES_PASSWORD

Information needed on:

  • Configuring SMTP email
  • staging/production instance for login using Ipsilon
    • for client secrets, we need to file an infrastructure ticket
    • for others, the instance needs to be changed from development to staging/production
  • For fedora-messaging:
    • AMQP Broker URL
    • mesage topic (might need to create a new topic)
    • New certificates

Misc:

  • step to generate client_secrets.json will need to be removed
  • Django will not start it's server but Nginx should start the server for Django
  • No conatiner for RabbitMQ
  • Volumes must not be included in the production/staging version of the containers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment