Closed Bug 549729 Opened 14 years ago Closed 14 years ago

Preview.AMO showing different host for PREVIEW_FULL_URL and PREVIEW_THUMBNAIL_URL

Categories

(mozilla.org Graveyard :: Server Operations, task)

All
Other
task
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: davedash, Assigned: fox2mike)

References

()

Details

by default (in settings.py) we have:

PREVIEW_THUMBNAIL_URL = (STATIC_URL +
        '/img/uploads/previews/thumbs/%s/%d.png?modified=%d')
PREVIEW_FULL_URL = (STATIC_URL +
        '/img/uploads/previews/full/%s/%d.png?modified=%d')

Which build off STATIC_URL

for some reason though:
https://preview.addons.mozilla.org/z/en-US/firefox/api/1.5/addon/1865

shows two different hostname for full previews and thumbnails.

Without seeing the settings_local.py my guess is their either one of these values has been overridden somehow.

I can help figure this out if I know the values for SITE_URL, and PREVIEW_THUMBNAIL_URL and PREVIEW_FULL_URL
Both PREVIEW_* settings should derive from a common ancestor (e.g. SITE_URL) - I'd un-override these in settings_local.py.
I don't see this even defined in the settings for zamboni? 

[root@mradm02 addons.mozilla.org-zamboni]# find . -name "settings*"
./settings_local.py
./settings.py
[root@mradm02 addons.mozilla.org-zamboni]# grep PREVIEW settings*
[root@mradm02 addons.mozilla.org-zamboni]#

Are we missing something? Or am I looking in the wrong place?

And the only SITE I see is :

[root@mradm02 addons.mozilla.org-zamboni]# grep SITE settings*
settings.py:SITE_ID = 1
odd.

cat the settings.py and paste it here.
# Django settings for zamboni project.

import os
import logging


# Make filepaths relative to settings.
ROOT = os.path.dirname(os.path.abspath(__file__))
path = lambda *a: os.path.join(ROOT, *a)

DEBUG = True
TEMPLATE_DEBUG = DEBUG
DEBUG_PROPAGATE_EXCEPTIONS = True

ADMINS = (
    # ('Your Name', 'your_email@domain.com'),
)

MANAGERS = ADMINS

DATABASES = {
    'default': {
        'NAME': 'zamboni',
        'ENGINE': 'django.db.backends.mysql',
        'HOST': '',
        'PORT': '',
        'USER': '',
        'PASSWORD': '',
        'OPTIONS': {'init_command': 'SET storage_engine=InnoDB'},
    },
}

# Put the aliases for your slave databases in this list.
SLAVE_DATABASES = []


# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems.
# If running in a Windows environment this must be set to the same as your
# system time zone.
TIME_ZONE = 'America/Los_Angeles'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-US'

# Accepted locales and apps
LANGUAGES = {'en-US': 'English (US)', 'ja': 'Japanese'}

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = path('media')

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/media/'

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/admin-media/'

# Make this unique, and don't share it with anybody.
SECRET_KEY = 'r#%9w^o_80)7f%!_ir5zx$tu3mupw9u%&s!)-_q%gy7i+fhx#)'

# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.load_template_source',
    'django.template.loaders.app_directories.load_template_source',
)

MIDDLEWARE_CLASSES = (
    # AMO URL middleware comes first so everyone else sees nice URLs.
    'amo.middleware.LocaleAndAppURLMiddleware',

    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.locale.LocaleMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',

    'cake.middleware.CakeCookieMiddleware',

)

AUTHENTICATION_BACKENDS = ('cake.backends.SessionBackend',)

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.core.context_processors.auth',
    'django.core.context_processors.debug',
    'django.core.context_processors.media',
    'django.core.context_processors.request',
    'django.core.context_processors.csrf',

    'amo.context_processors.i18n',
    'amo.context_processors.links',
)

ROOT_URLCONF = 'zamboni.urls'

TEMPLATE_DIRS = (
    path('templates'),
)

INSTALLED_APPS = (
    'amo',
    'access',
    'addons',
    'admin',
    'approvals',
    'applications',
    'devhub',
    'editors',
    'reviews',
    'tags',
    'translations',
    'users',
    'versions',

    'cake',
    'south',
    'django_nose',

    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.sites',
)

TEST_RUNNER = 'django_nose.run_tests'

LOG_LEVEL = logging.DEBUG

# AMO Specific details
SUPPORTED_APPS = ('firefox', 'thunderbird', 'mobile', 'seamonkey',
'sunbird', )

# paths that don't require an app prefix
SUPPORTED_NONAPPS = ('admin', 'developers', 'editors', 'localizers',
    'statistics',)
DEFAULT_APP = 'firefox'

CACHE_DURATION = 60  # seconds

AUTH_PROFILE_MODULE = 'users.UserProfile'

Restricting the bug just in case this has info that shouldn't be public because I was lazy to read through it all before pasting :)
Group: infra
Please unrestrict.

settings.py is what we have on our public repo.

But this looks like it's grossly out of date.  ... are you sure this is where preview is serving from?
Unrestricted and found another location, which seems more like the real zamboni. Boo oremj :p
Assignee: server-ops → shyam
Group: infra
Okay, so:

settings_local.py has :

SITE_URL = 'https://preview.addons.mozilla.org'
STATIC_URL = SITE_URL
ADDON_ICON_URL = "%s/%s/%s/images/addon_icon/%%d/%%s" % (
        STATIC_URL, LANGUAGE_CODE, DEFAULT_APP)
PREVIEW_THUMBNAIL_URL = (STATIC_URL +
        '/img/uploads/previews/thumbs/%s/%d.png?modified=%d')

And settings.py has :

HOSTNAME = socket.gethostname()
SITE_URL = 'http://%s' % HOSTNAME
PREVIEW_THUMBNAIL_URL = (STATIC_URL +
        '/img/uploads/previews/thumbs/%s/%d.png?modified=%d')
PREVIEW_FULL_URL = (STATIC_URL +
        '/img/uploads/previews/full/%s/%d.png?modified=%d')

What changes do you need?
cat "PREVIEW_FULL_URL = (STATIC_URL +
        '/img/uploads/previews/full/%s/%d.png?modified=%d')" >> settings_local.py
Done.
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
(In reply to comment #7)
> Unrestricted and found another location, which seems more like the real
> zamboni. Boo oremj :p

This is documented under websites.
Jeremy, couldn't find it on https://intranet.mozilla.org/WebSites, anywhere else I should be looking?
Click addons.mozilla.org on https://intranet.mozilla.org/WebSites.
Product: mozilla.org → mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.