зеркало из https://github.com/mozilla/bedrock.git
Remove Cloud9, Vagrant and legacy PHP docs and associated files (closes #3944)
This commit is contained in:
Родитель
e11b7d0ecf
Коммит
824523d3b8
|
@ -1,4 +0,0 @@
|
|||
# Ignore everything in this directory
|
||||
*
|
||||
# Except this file
|
||||
!.gitignore
|
|
@ -1,42 +0,0 @@
|
|||
{
|
||||
"run": {
|
||||
"@path": "/.c9/runners",
|
||||
"configs": {
|
||||
"json()": {
|
||||
"Run Server": {
|
||||
"debug": true,
|
||||
"name": "Run Server",
|
||||
"command": "bin/runserver-c9",
|
||||
"runner": "Shell script",
|
||||
"default": true
|
||||
}
|
||||
},
|
||||
"@inited": "true"
|
||||
}
|
||||
},
|
||||
"share": {
|
||||
"@preview": false,
|
||||
"@app": false,
|
||||
"@useOwnerSettings": false
|
||||
},
|
||||
"ace": {
|
||||
"@newLineMode": "unix",
|
||||
"@tabSize": "4",
|
||||
"@useSoftTabs": "true",
|
||||
"@guessTabSize": "true"
|
||||
},
|
||||
"find.nak": {
|
||||
"@searchLimit": 100
|
||||
},
|
||||
"language": {
|
||||
"@warnLevel": "info",
|
||||
"@instanceHighlight": "true",
|
||||
"@undeclaredVars": "true",
|
||||
"@unusedFunctionArgs": "false"
|
||||
},
|
||||
"build": {
|
||||
"@path": "/.c9/builders",
|
||||
"@saveall": true,
|
||||
"@builder": "auto"
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@ settings/local.py
|
|||
*/settings/local.py
|
||||
*.py[co]
|
||||
*.sw[po]
|
||||
.c9
|
||||
.coverage
|
||||
.jshintrc
|
||||
pip-log.txt
|
||||
|
@ -25,7 +24,6 @@ db.sql
|
|||
Thumbs.db
|
||||
Desktop.ini
|
||||
venv
|
||||
.vagrant
|
||||
*.db
|
||||
*.mmdb
|
||||
james.ini
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
# -*- mode: ruby -*-
|
||||
# vi: set ft=ruby :
|
||||
|
||||
Vagrant.require_version ">= 1.4.0"
|
||||
|
||||
Vagrant.configure("2") do |config|
|
||||
|
||||
config.vm.box = "precise32"
|
||||
config.vm.box_url = "http://people.mozilla.com/~bsternthal/vagrant/precise32.box"
|
||||
|
||||
# Add to /etc/hosts: 192.168.10.55 mozilla.local
|
||||
config.vm.network :private_network, ip: "192.168.10.55"
|
||||
|
||||
# Not sure if really needed but leaving in
|
||||
config.vm.network :forwarded_port, guest: 8000, host: 8000
|
||||
|
||||
# Manually set permissions for to allow writing
|
||||
config.vm.synced_folder ".", "/vagrant", :owner => "www-data", :mount_options => ['dmode=775','fmode=664']
|
||||
config.vm.synced_folder "../mozilla.com", "/srv/legacy", :owner => "www-data", :mount_options => ['dmode=775','fmode=664']
|
||||
|
||||
config.vm.provision :puppet do |puppet|
|
||||
puppet.manifests_path = "puppet/manifests"
|
||||
puppet.manifest_file = "vagrant.pp"
|
||||
end
|
||||
|
||||
end
|
|
@ -1,20 +0,0 @@
|
|||
#!/bin/bash
|
||||
cd $(readlink --canonicalize --no-newline ${0%/*})/..
|
||||
git submodule update --init --recursive
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libmysqlclient-dev libxml2-dev libxslt1-dev python-dev
|
||||
# keep pip updated
|
||||
sudo python bin/pipstrap.py
|
||||
sudo pip install -r requirements/dev.txt
|
||||
# mysql in the prod requirements
|
||||
sudo pip install -r requirements/prod.txt
|
||||
sudo pip install ipython # highly recommended, but not required so not in requirements/dev.txt
|
||||
# default npm install -g destination in c9 is in /home/ubuntu/.nvm/v0.10.28/
|
||||
npm install -g less
|
||||
npm install -g grunt-cli
|
||||
npm install -g jshint
|
||||
npm install
|
||||
cp bedrock/settings/local.py-dist bedrock/settings/local.py
|
||||
mysql-ctl start
|
||||
svn checkout https://svn.mozilla.org/projects/mozilla.com/trunk/locales/ locale
|
||||
bin/sync_all
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
cd /home/ubuntu/workspace
|
||||
echo Public URL: http://$C9_HOSTNAME
|
||||
./manage.py runserver $C9_IP:$C9_PORT
|
|
@ -22,10 +22,7 @@ Contents
|
|||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
quickstart
|
||||
install
|
||||
vagrant
|
||||
php
|
||||
l10n
|
||||
coding
|
||||
contribute
|
||||
|
|
114
docs/install.rst
114
docs/install.rst
|
@ -109,120 +109,6 @@ If you are not inside a virtualenv, you can activate it by doing::
|
|||
|
||||
If you get the error "NoneType is not iterable", you didn't check out the latest product-details. See the above section for that.
|
||||
|
||||
.. _with php:
|
||||
|
||||
Run it with the whole site
|
||||
--------------------------
|
||||
|
||||
If you need to run the whole site locally, you'll need to **first** set up the
|
||||
:ref:`PHP side<php>`, and then **also** set up to serve Bedrock from the
|
||||
same Apache
|
||||
server at ``/b/``. That's because the rewrite rules in the
|
||||
PHP and Apache config assume they can serve requests from Bedrock by
|
||||
rewriting them internally to have a ``/b/`` on the front of their URLs.
|
||||
|
||||
.. IMPORTANT::
|
||||
|
||||
Before continuing, go get the :ref:`PHP side<php>` working. Then come
|
||||
back here.
|
||||
|
||||
One way to add Bedrock to your local site, once you have the
|
||||
:ref:`PHP side<php>` working, is to use runserver to serve Bedrock at port 8000 as
|
||||
above, then proxy to it from Apache. The whole virtual server config
|
||||
might end up looking like this::
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName mozilla.local
|
||||
VirtualDocumentRoot "/path/to/mozilla.com"
|
||||
RewriteEngine On
|
||||
RewriteOptions Inherit
|
||||
ProxyPass /b http://localhost:8000
|
||||
ProxyPassReverse /b http://localhost:8000
|
||||
ProxyPass /media http://localhost:8000/media
|
||||
ProxyPassReverse /media http://localhost:8000/media
|
||||
Include /path/to/bedrock/etc/httpd/global.conf
|
||||
</VirtualHost>
|
||||
|
||||
But you might have better success using a real WSGI setup that is closer to
|
||||
what the real servers use. The following configuration is simplified
|
||||
from what the bedrock staging server uses.
|
||||
|
||||
Assumptions:
|
||||
|
||||
* A Red Hat or Debian-based Linux distribution. (Other distributions might not
|
||||
have Apache HTTP Server installed and configured the same way.)
|
||||
* Apache HTTP Server with php and mod_wsgi
|
||||
* Subversion mozilla.com checkout at `/path/to/mozilla/mozilla.com`
|
||||
* Subversion mozilla.org checkout at `/path/to/mozilla/mozilla.com/org` (ideally
|
||||
as an SVN external)
|
||||
* Bedrock checkout at `/path/to/mozilla/bedrock`
|
||||
|
||||
Create a local config files for mozilla.com and mozilla.org::
|
||||
|
||||
$ cp /path/to/mozilla.com/includes/config.inc.php-dist /path/to/mozilla.com/includes/config.inc.php
|
||||
$ cp /path/to/mozilla.com/org/includes/config.inc.php-dist /path/to/mozilla.com/org/includes/config.inc.php`
|
||||
|
||||
Edit ``/etc/hosts`` and add::
|
||||
|
||||
127.0.0.1 mozilla.local
|
||||
|
||||
Apache config - create file ``/etc/apache2/sites-available/mozilla.com``::
|
||||
|
||||
# Main site at /, django-bedrock at /b
|
||||
<VirtualHost *:80 *:81>
|
||||
ServerName mozilla.local
|
||||
ServerAdmin user@example.com
|
||||
DocumentRoot "/path/to/mozilla/mozilla.com"
|
||||
AddType application/x-httpd-php .php .html
|
||||
DirectoryIndex index.php index.html
|
||||
RewriteEngine On
|
||||
|
||||
<Directory "/path/to/mozilla.com">
|
||||
Options MultiViews FollowSymLinks -Indexes
|
||||
AllowOverride All
|
||||
</Directory>
|
||||
|
||||
RewriteMap org-urls-410 txt:/path/to/mozilla.com/org-urls-410.txt
|
||||
RewriteMap org-urls-301 txt:/path/to/mozilla.com/org-urls-301.txt
|
||||
|
||||
WSGIDaemonProcess bedrock_local python-path=/path/to/bedrock:/path/to/venv-for-bedrock/lib/python2.7/site-packages
|
||||
WSGIProcessGroup bedrock_local
|
||||
WSGIScriptAlias /b /path/to/bedrock/wsgi/playdoh.wsgi process-group=bedrock_local application-group=bedrock_local
|
||||
|
||||
Alias /media /path/to/bedrock/media
|
||||
<Directory /path/to/bedrock/media>
|
||||
AllowOverride FileInfo Indexes
|
||||
</Directory>
|
||||
|
||||
Include /path/to/bedrock/etc/httpd/global.conf
|
||||
</VirtualHost>
|
||||
|
||||
Then enable the new site, build the css and js files, and finally
|
||||
restart apache:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sudo a2ensite mozilla.com
|
||||
sudo a2enmod expires headers actions
|
||||
python manage.py collectstatic
|
||||
sudo service apache2 restart
|
||||
|
||||
Troubleshooting
|
||||
...............
|
||||
|
||||
If you get Django error pages reporting I/O errors for .css files, it's because
|
||||
not all the .css files were compiled before starting Apache and Apache does not
|
||||
have write permissions in the media directories. Running
|
||||
`python manage.py collectstatic` should solve it. Remember to run that
|
||||
command again anytime the css or less files change.
|
||||
|
||||
If you change Python files, either restart Apache or touch playdoh.wsgi, so
|
||||
that the WSGI processes will be restarted and start running the new code.
|
||||
|
||||
If you're working on the rewrite rules in ``bedrock/etc/httpd/*.conf``, be
|
||||
sure to restart Apache after any change. Apache doesn't re-read those files
|
||||
after it has started.
|
||||
|
||||
Localization
|
||||
------------
|
||||
|
||||
|
|
368
docs/php.rst
368
docs/php.rst
|
@ -1,368 +0,0 @@
|
|||
.. This Source Code Form is subject to the terms of the Mozilla Public
|
||||
.. License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
.. file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
.. _php:
|
||||
|
||||
============================================
|
||||
Installing and Learning About the PHP Site
|
||||
============================================
|
||||
|
||||
The previous version of mozilla.org was written in PHP. The PHP
|
||||
codebase still serves some of the mozilla.org pages because we haven't
|
||||
migrated everything over. A request runs through the following stack:
|
||||
|
||||
* If the page exists in Bedrock, serve from Bedrock
|
||||
* If the page exists in the PHP site, serve from PHP
|
||||
* Else, serve a 404 page
|
||||
|
||||
History
|
||||
=======
|
||||
|
||||
The PHP site has a long history and as a result, is a little quirky.
|
||||
If you are looking to work on the site and/or set it up locally, this
|
||||
page will be helpful to you.
|
||||
|
||||
mozilla.org, mozilla.com, and thunderbird used to be completely
|
||||
separate sites with different PHP codebases. In 2011 these sites were
|
||||
merged into one site.
|
||||
|
||||
The merge is purely for aesthetics though. In the PHP side of
|
||||
mozilla.org, a few different PHP codebases coexist beside each other,
|
||||
and a combination of Apache and PHP magic bind them all together (one
|
||||
site to rule them all, or something like that).
|
||||
|
||||
Installing
|
||||
==========
|
||||
|
||||
.. _apache:
|
||||
|
||||
Apache
|
||||
------
|
||||
|
||||
Whether you're installing just `mozilla.com` or also `mozilla.org`, there's
|
||||
some common configuration required for Apache.
|
||||
|
||||
1. Install PHP. On Ubuntu, you can use these commands::
|
||||
|
||||
sudo apt-get install libapache2-mod-php5
|
||||
|
||||
2. Enable the required modules. On Ubuntu, this should get most of them::
|
||||
|
||||
sudo a2enmod actions expires headers php5 proxy proxy_http rewrite status vhost_alias
|
||||
|
||||
but if Apache fails to start with errors about unknown directives, that
|
||||
probably means some other module also needs to be enabled.
|
||||
|
||||
|
||||
Bedrock
|
||||
-------
|
||||
|
||||
The whole site now assumes Bedrock is also available. Even after following
|
||||
the instructions below, parts of the site will not work until/unless you also
|
||||
have :ref:`Bedrock running locally<with php>`. Or you might see an old version
|
||||
of a page from PHP, because the newer version is in Bedrock but the old
|
||||
version wasn't removed from PHP.
|
||||
|
||||
|
||||
.. _mozilla-com:
|
||||
|
||||
mozilla.com
|
||||
-----------
|
||||
|
||||
If you want to just work on the mozilla.com codebase (currently served
|
||||
at mozilla.org/firefox), follow these steps. You will only get the
|
||||
product pages. See :ref:`mozilla.org <mozilla-org>` for instructions
|
||||
on installing the org side of the site. For more details on why
|
||||
several codebases run the site, see :ref:`How a Request is Handled <merge>`.
|
||||
|
||||
.. note:: This assumes you are using Apache with Unix. Windows might have
|
||||
different steps, please contact us if you need help.
|
||||
|
||||
1. Install it with these commands:
|
||||
|
||||
::
|
||||
|
||||
svn co https://svn.mozilla.org/projects/mozilla.com/trunk mozilla.com
|
||||
cd mozilla.com/includes
|
||||
cp config.inc.php-dist config.inc.php
|
||||
|
||||
2. Open /includes/config.inc.php and set the `server_name` to "mozilla.local" (or whatever you will use) and `file_root` to the site's path on the filesystem.
|
||||
3. Set up `mozilla.local` to resolve to localhost. This is different for each OS, but a quick way on Linux/OS X is to add an entry to /etc/hosts::
|
||||
|
||||
127.0.0.1 mozilla.local
|
||||
|
||||
4. Configure Apache to allow the site to run with a Directory and VirtualHost directive:
|
||||
This could go in the main Apache configuration file, or
|
||||
on Ubuntu, you might put this in ``/etc/apache2/sites-available/mozilla.com.conf``.
|
||||
|
||||
::
|
||||
|
||||
<Directory /path/to/mozilla.com>
|
||||
Options Includes FollowSymLinks MultiViews Indexes
|
||||
AllowOverride All
|
||||
Order Deny,Allow
|
||||
Allow from all
|
||||
</Directory>
|
||||
|
||||
<VirtualHost *:80>
|
||||
ServerName mozilla.local
|
||||
VirtualDocumentRoot "/path/to/mozilla.com"
|
||||
</VirtualHost>
|
||||
|
||||
Make sure to replace ServerName and /path/to/ to the correct values.
|
||||
|
||||
On Ubuntu, you would then enable the site with::
|
||||
|
||||
sudo a2ensite mozilla.com
|
||||
|
||||
5. You *might* need to set the DocumentRoot to the site if you can't load any CSS files. We are looking to fix this.
|
||||
|
||||
DocumentRoot "/path/to/mozilla/mozilla.com"
|
||||
|
||||
You shouldn't need anything else in the site config for mozilla.com. The `.htaccess` file
|
||||
at the root of mozilla.com contains the rest of the required configuration.
|
||||
|
||||
6. Restart Apache. On Ubuntu::
|
||||
|
||||
sudo service apache2 restart
|
||||
|
||||
If you go to http://mozilla.local/ you should see a page for downloading Firefox.
|
||||
|
||||
.. _mozilla-org:
|
||||
|
||||
mozilla.org
|
||||
-----------
|
||||
|
||||
If you need to work on mozilla.org, you need to install it as well.
|
||||
The installation process is identical to mozilla.com, with a few
|
||||
tweaks.
|
||||
|
||||
.. note:: htaccess files do not work on mozilla.org. If you need to
|
||||
add anything to htaccess files, you must commit them to the
|
||||
mozilla.com codebase. See the section below about the merge
|
||||
for more info.
|
||||
|
||||
1. Make sure you install it as a subdirectory underneath mozilla.com named *org*.
|
||||
|
||||
::
|
||||
|
||||
cd mozilla.com
|
||||
svn co https://svn.mozilla.org/projects/mozilla.org/trunk org
|
||||
cd org/includes
|
||||
cp config.inc.php-dist config.inc.php
|
||||
|
||||
2. Open /org/includes/config.inc.php and set the `server_name` to "mozilla.local" (or whatever you will use) and `file_root` to the site's path on the filesystem (including the org subdirectory).
|
||||
3. In addition, set the 'js_prefix', 'img_prefix', 'style_prefix' config values to '/org'. **That is necessary**.
|
||||
4. If you need the archive redirects to work, you need to add the RewriteMap directives to your Apache config for the site. Inside the VirtualHost section that you made while installing mozilla.com, add this:
|
||||
|
||||
::
|
||||
|
||||
RewriteMap org-urls-410 txt:/path/to/mozilla.com/org-urls-410.txt
|
||||
RewriteMap org-urls-301 txt:/path/to/mozilla.com/org-urls-301.txt
|
||||
|
||||
5. Depending on your system settings, you might see warnings about relying on the system's timezone settings. If you get this, add the following to the config.inc.php for mozilla.org:
|
||||
|
||||
::
|
||||
|
||||
date_default_timezone_set('America/New_York');
|
||||
|
||||
You can look up the correct timezone `here
|
||||
<http://www.php.net/manual/en/timezones.php>`_.
|
||||
|
||||
That should be it. If you go to http://mozilla.local/ (or whatever
|
||||
local server you set it to) you should see the org home page.
|
||||
|
||||
Thunderbird
|
||||
-----------
|
||||
|
||||
The thunderbird site has been completely merged in with mozilla.org,
|
||||
so you can install it by :ref:`installing mozilla.org <mozilla-org>`. It
|
||||
will be served at /thunderbird.
|
||||
|
||||
.. _merge:
|
||||
|
||||
Workflow
|
||||
========
|
||||
|
||||
If you are working on a bug, please follow these steps:
|
||||
|
||||
1. Commit your work to trunk
|
||||
2. Comment on the bug and add the revision in the whiteboard field in the form "r=10000". Multiple revisions should be comma-delimited, like "r=10000,10001". You can add the revision in the comment too if you want people to have a link to the changes.
|
||||
3. Add the keyword "qawanted" when finished
|
||||
4. When all the work is done and has been QAed, mark as resolved.
|
||||
|
||||
We release a batch of resolved bugs every Tuesday. Other bugs can go
|
||||
out between releases, but by default resolved bugs tagged with the
|
||||
current milestone will go out the next Tuesday.
|
||||
|
||||
Stage isn't used for much, but it's useful for times when we are very
|
||||
careful about rolling out something. You typically don't need to worry
|
||||
about it. When bugs are pushed live, they are pushed to stage and
|
||||
production at the same time.
|
||||
|
||||
Rolling out code
|
||||
----------------
|
||||
|
||||
So you want to rollout a bug into production? If you look at our
|
||||
workflow, there should be some SVN revisions logged into the
|
||||
whiteboard of the bug. If not, you need to track down which revisions
|
||||
to push from the comments.
|
||||
|
||||
Once you have this list, you need to merge them to the branches
|
||||
`tags/stage` and `tags/production`. If the revisions are already
|
||||
pushed to stage, only do the latter. These are the commands:
|
||||
|
||||
::
|
||||
|
||||
cd tags/stage
|
||||
svn merge --ignore-ancestry -c<revs> ../../trunk
|
||||
svn commit -m 'merged <rev> from trunk for bug <id>'
|
||||
|
||||
`<revs>` is a single rev or comma-delimited like "10000,10001,10002".
|
||||
|
||||
Do the same for tags/production. Always format the log message like
|
||||
the above. You must use `--ignore-ancestry` also to avoid bad things.
|
||||
|
||||
We wrote a script to automate this if you are doing this a lot. You
|
||||
can find it it on trunk in `/bin/rollout
|
||||
<https://github.com/jlongster/mozilla.com/blob/master/bin/rollout>`_.
|
||||
The usage looks like this:
|
||||
|
||||
::
|
||||
|
||||
Usage: rollout <bug-id> <revs> <branch>
|
||||
<revs> and <branch> are optional
|
||||
|
||||
$ cd mozilla.com # must have trunk, tags/stage, and tags/production checked out here
|
||||
$ rollout 654321
|
||||
|
||||
Merging into tags/stage...
|
||||
--- Merging r654321 into '.':
|
||||
<svn output>
|
||||
|
||||
Continue? y/n [n]y
|
||||
|
||||
Committing tags/stage...
|
||||
|
||||
Merging into tags/production...
|
||||
--- Merging r654321 into '.':
|
||||
<svn output>
|
||||
|
||||
Continue? y/n [n]y
|
||||
Committing tags/production...
|
||||
|
||||
The script parses the revisions and branch from the whiteboard data in
|
||||
bugzilla, and merges it from trunk to stage and production. If the
|
||||
branch is already stage (b=stage in the whiteboard) it just merges it
|
||||
to production.
|
||||
|
||||
After it does the merges, it asks you if you want to continue. If you
|
||||
saw conflicts, you shouldn't continue and you should fix the conflicts
|
||||
and either finish the rollout by hand or update the bugzilla
|
||||
whiteboard and run the command again.
|
||||
|
||||
How a Request is Handled
|
||||
========================
|
||||
|
||||
Magic should always be documented, so let's look at exactly how all
|
||||
the PHP sites work together to handle a mozilla.org request.
|
||||
|
||||
mozilla.org is made up of three sites:
|
||||
|
||||
* mozilla.com (the product pages)
|
||||
* mozilla.org (mofo)
|
||||
* mozillamessaging.com (thunderbird)
|
||||
|
||||
These three sites are now all merged into http://mozilla.org/.
|
||||
However, on the server a request can be handled by three different
|
||||
codebases. We'll refer to the mozilla.com codebase as `moco`,
|
||||
mozilla.org codebase as `mofo`, and messaging as `thunderbird`.
|
||||
|
||||
moco is the primary codebase. A request goes through the following steps:
|
||||
|
||||
* If the URL exists in the mofo codebase, load the page from there
|
||||
* If the URL exists in the thunderbird codebase, load from there
|
||||
* Else, let moco handle the URL like normal
|
||||
|
||||
The merge magic is installed into moco's htaccess and PHP files. We
|
||||
let moco become the primary codebase because if there's any error in
|
||||
the merge code, we can't afford to break the main Firefox product
|
||||
pages. There's also more developer attention on moco.
|
||||
|
||||
**Special Note**: Only mozilla.com's .htaccess files are processed by
|
||||
Apache. All the others have been merged in so you shouldn't add
|
||||
anything to them. Please add all htaccess rules inthe mozilla.com
|
||||
codebase.
|
||||
|
||||
Merge Magic
|
||||
-----------
|
||||
|
||||
How we implement the merge is really important. Performance, site
|
||||
breakage, and amount of work to move things around are all serious
|
||||
considerations. The merge is meant to be temporary as the site is
|
||||
moving to Python, so it's not worth the effort to literally merge all
|
||||
the PHP code together.
|
||||
|
||||
It's also important to still allow the mofo and moco codebases to be
|
||||
run individually. We don't want to suddenly break it for people who
|
||||
have it locally checked out (short-term wise). Finally, the code of
|
||||
each site also dictated possible solutions. There's a lot of edge
|
||||
cases in each site so need to make sure we don't break anything.
|
||||
|
||||
Here's how the merge magic was implemented:
|
||||
|
||||
**Short version:**
|
||||
|
||||
* Check out the mofo codebase under moco as the subdirectory *org*.
|
||||
* Redirect all mofo URLs to a PHP handler which loads those pages, do
|
||||
the same for thunderbird
|
||||
* Fix loading of images, css, and js by setting prefix config values and more rewrites
|
||||
* Merge .htaccess files into the moco codebase
|
||||
|
||||
**Long version:**
|
||||
|
||||
* Check out the mofo codebase under moco as the subdirectory *org*.
|
||||
|
||||
* Thunderbird is a folder under org, at /org/thunderbird
|
||||
|
||||
* Generate a list of top-level folders in the org site and use Apache
|
||||
rewrites to `redirect all those URLs to a special php handler <https://github.com/jlongster/mozilla.com/blob/813aa578d7850f79d9f6b5274051f0f2175dd957/.htaccess#L805>`_
|
||||
* Write the `special php handler
|
||||
<https://github.com/jlongster/mozilla.com/blob/813aa578d7850f79d9f6b5274051f0f2175dd957/includes/org-handler.php>`_
|
||||
to load mofo pages. This is basically a port of mofo's prefetch.php
|
||||
* Write a `similar handler
|
||||
<https://github.com/jlongster/mozilla.com/blob/813aa578d7850f79d9f6b5274051f0f2175dd957/includes/thunderbird-handler.php>`_
|
||||
for the thunderbird pages and `redirect all /thunderbird URLs to it <https://github.com/jlongster/mozilla.com/blob/813aa578d7850f79d9f6b5274051f0f2175dd957/.htaccess#L616>`_
|
||||
* Fix loading of assets
|
||||
|
||||
* `Set config values
|
||||
<https://github.com/jlongster/mozilla.org/blob/master/includes/config.inc.php-dist#L96>`_
|
||||
to load assets with the "/org" prefix
|
||||
* For bad code that doesn't use the config, use `apache rewrites
|
||||
<https://github.com/jlongster/mozilla.com/blob/813aa578d7850f79d9f6b5274051f0f2175dd957/.htaccess#L579>`_
|
||||
to redirect `images` and `script` to the respective folder in
|
||||
"/org". These two folders don't conflict with the moco codebase.
|
||||
The `style` directory conflicts, so make sure all code uses the
|
||||
config prefix value.
|
||||
* `Redirect any other asset directory
|
||||
<https://github.com/jlongster/mozilla.com/blob/813aa578d7850f79d9f6b5274051f0f2175dd957/.htaccess#L590>`_
|
||||
to use the "/org" prefix (/thunderbird/img/, etc)
|
||||
|
||||
* Merge .htacess files
|
||||
|
||||
* The biggest side effect of this is that only moco htaccess files
|
||||
are processed, but we should consolidate things anyway
|
||||
* `Move the redirects
|
||||
<https://github.com/jlongster/mozilla.com/blob/813aa578d7850f79d9f6b5274051f0f2175dd957/.htaccess#L619>`_
|
||||
and other appropriate rules from mofo's htaccess to moco's
|
||||
* `Optimize the crazy amount of 301 and 410 redirects
|
||||
<https://github.com/jlongster/mozilla.com/blob/813aa578d7850f79d9f6b5274051f0f2175dd957/.htaccess#L602>`_
|
||||
from mofo, mostly archive redirects, using RewriteMap
|
||||
* Test to make sure everything's working, implement special rewrites
|
||||
or org-handler.php hacks to fix any breakage
|
||||
|
||||
* Check file extensions for any leftover static types and `rewrite them <https://github.com/jlongster/mozilla.com/blob/master/.htaccess#L582>`_ to be served by Apache
|
||||
|
||||
The final result is the moco codebase which dispatches a lot of URLs
|
||||
to the mofo and thunderbird codebases.
|
|
@ -110,7 +110,8 @@ Test runs can be added by creating new `properties files`_ with the parameters o
|
|||
test run. For example, if you wanted to run tests in Firefox on both Windows 10 and
|
||||
OS X, you could create the following files
|
||||
|
||||
``win10-firefox.properties``:
|
||||
win10-firefox.properties
|
||||
........................
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
|
@ -119,7 +120,8 @@ OS X, you could create the following files
|
|||
PLATFORM=Windows 10
|
||||
MARK_EXPRESSION=not headless
|
||||
|
||||
``osx-firefox.properties``:
|
||||
osx-firefox.properties
|
||||
......................
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
.. This Source Code Form is subject to the terms of the Mozilla Public
|
||||
.. License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
.. file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
.. _quickstart:
|
||||
|
||||
==================
|
||||
Quickstart
|
||||
==================
|
||||
|
||||
You can develop and test bedrock without installing anything locally by using
|
||||
Cloud9_, which provides a complete development environment via your browser,
|
||||
including unlimited free public workspaces [#]_, which is great for open source
|
||||
projects. Each workspace includes root_ access to an Ubuntu_ Docker_ container,
|
||||
which you can install bedrock and all its dependencies into with the following
|
||||
steps:
|
||||
|
||||
1. Fork `bedrock <https://github.com/mozilla/bedrock/>`_ on github
|
||||
2. Sign up or sign in to Cloud9_ with your github account [#]_
|
||||
3. Create a new workspace from your fork using the "Clone from URL"
|
||||
option with a URL in the format ``git@github.com:mozilla/bedrock.git`` but
|
||||
with your username instead of ``mozilla``
|
||||
4. Once your workspace is ready, click the "Start Editing" button
|
||||
5. In the bash shell, run the command ``bin/install-c9``
|
||||
|
||||
Once the ``install-c9`` script completes, you can click the Run Project button to launch the django development server, which will be accessible on a
|
||||
public URL similar to ``http://bedrock-c9-username.c9.io``
|
||||
|
||||
|
||||
.. _Cloud9: https://c9.io
|
||||
.. _root: https://help.ubuntu.com/community/RootSudo
|
||||
.. _Ubuntu: http://www.ubuntu.com/
|
||||
.. _Docker: https://www.docker.com/
|
||||
.. [#] Public means everything in the workspace is world readable; you can also
|
||||
grant write access to specific cloud9 users and collaboratively edit code
|
||||
in your workspace in real time.
|
||||
.. [#] Github account integration is optional; if you do not wish to give cloud9
|
||||
access to push to any repo your github account has access, you may wish
|
||||
to use a `deploy key
|
||||
<https://developer.github.com/guides/managing-deploy-keys/#deploy-keys>`_
|
||||
or a `machine user account
|
||||
<https://developer.github.com/guides/managing-deploy-keys/#machine-users>`_.
|
|
@ -9,118 +9,16 @@
|
|||
Tabzilla
|
||||
========
|
||||
|
||||
*Tabzilla* is the universal tab displayed on Mozilla websites.
|
||||
The latest version of Tabzilla is no longer part of the bedrock repository, and can now
|
||||
be included directly as part of any Mozilla site. Please see the Tabzilla repository for
|
||||
more information:
|
||||
|
||||
Adding the universal tab to a site requires:
|
||||
https://github.com/mozilla/tabzilla/
|
||||
|
||||
1. Add the static tab link (example below) to the top of your template::
|
||||
Translation and Update bar
|
||||
--------------------------
|
||||
|
||||
<a href="https://www.mozilla.org/" id="tabzilla">mozilla</a>
|
||||
The Translation and Update Bar functionality that used to be part of Tabzilla can now
|
||||
also be found in its own repository:
|
||||
|
||||
2. Include the tabzilla CSS by adding the following tag inside the ``<head>`` of your template::
|
||||
|
||||
<link href="https://mozorg.cdn.mozilla.net/media/css/tabzilla-min.css" rel="stylesheet" />
|
||||
|
||||
3. Include the tabzilla.js file in your template (preferably just before the ``</body>``)::
|
||||
|
||||
<script src="https://mozorg.cdn.mozilla.net/tabzilla/tabzilla.js"></script>
|
||||
|
||||
This will choose the best locale for your visitor. If you prefer to force the locale, you can use::
|
||||
|
||||
<script src="https://mozorg.cdn.mozilla.net/{locale}/tabzilla/tabzilla.js"></script>
|
||||
|
||||
Where ``{locale}`` is the language in which you'd like Tabzilla to be loaded (e.g. fr or de).
|
||||
If Tabzilla is not yet translated into said locale the user will get the en-US version.
|
||||
|
||||
.. note:: Tabzilla uses jQuery. If your site already includes jQuery be sure to
|
||||
place the Tabzilla script tag **after** the one for jQuery. Tabzilla will
|
||||
use the existing jQuery if available and a supported version, otherwise
|
||||
it will load its own version of jQuery.
|
||||
|
||||
That the source file URLs begin with ``//`` is not a typo. This is a
|
||||
protocol-relative URL which allows the resource to be loaded via
|
||||
whichever protocol (http or https) the page itself is loaded. This
|
||||
removes the need to add any logic to support loading Tabzilla over
|
||||
both secure and insecure connections, thereby avoiding mixed-content
|
||||
warnings from the browser.
|
||||
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
As the universal tab does inject HTML/CSS into the DOM, some there are some requirements that you must meet.
|
||||
|
||||
- Background images must not be attached to the ``<body>`` element.
|
||||
- Absolutely positioned elements must not be positioned relative to the ``<body>`` element.
|
||||
- An element other than the ``<body>`` should add a 2 pixel white border to the top of the page (``border-top: 2px solid #fff;``)
|
||||
|
||||
Any background image or absolutely positioned element attached to the ``body`` element would not move with the rest of the contents when the tab slides open. Instead, any such background or element should be attached to anoter HTML element in the page (a wrapper div, for example). Note that this issue does not apply to solid background colors, or backgrounds that do not vary vertically (solid vertical stripes, for example).
|
||||
|
||||
If jQuery is already included on the page, it will be used by Tabzilla. If jQuery is not already on the page, it will automatically be included after the page has loaded.
|
||||
|
||||
|
||||
Translation Bar
|
||||
---------------
|
||||
|
||||
Tabzilla has an opt-in extension called *Translation Bar* that automatically offers a link to a localized page, if available, based on the user's locale. It is intended to improve international user experience.
|
||||
|
||||
Adding the Translation Bar extension to Tabzilla requires:
|
||||
|
||||
1. Include `alternate URLs <https://support.google.com/webmasters/answer/189077>`_ in the ``<head>`` element. For example::
|
||||
|
||||
<link rel="alternate" hreflang="en-US" href="http://www.mozilla.org/en-US/firefox/new/" title="English (US)">
|
||||
<link rel="alternate" hreflang="fr" href="http://www.mozilla.org/fr/firefox/new/" title="Français">
|
||||
|
||||
The Translation Bar alternatively detects available translations by looking for a language switcher like below, but implementation of alternate URLs is recommended also from the SEO perspective::
|
||||
|
||||
<select id="language"><option value="en-US">English (US)</option></select>
|
||||
|
||||
2. Add the ``data-infobar`` attribute to the tab link, with the ``translation`` option::
|
||||
|
||||
<a href="https://www.mozilla.org/" id="tabzilla" data-infobar="translation">mozilla</a>
|
||||
|
||||
.. note:: Though the Translation Bar is currently implemented as an extension of Tabzilla, it might be moved to a standalone language utility in the future.
|
||||
|
||||
|
||||
Update Bar
|
||||
---------------
|
||||
|
||||
This is another information bar intended to improve user security. It checks if the user is using the latest Firefox version, and if not, prompts the user to update the browser.
|
||||
|
||||
Adding the Update Bar extension to Tabzilla requires:
|
||||
|
||||
1. Add the ``data-infobar`` attribute to the tab link, with the ``update`` option::
|
||||
|
||||
<a href="https://www.mozilla.org/" id="tabzilla" data-infobar="update translation">mozilla</a>
|
||||
|
||||
The value of the ``data-infobar`` attribute is the order of priority. You can enable both the Update Bar and Translation Bar as the example above, but one information bar will be shown at a time.
|
||||
|
||||
|
||||
Tabzilla Static
|
||||
---------------
|
||||
|
||||
There is also a static (non-opening) version of Tabzilla available for use in bedrock.
|
||||
Just add the following file to your CSS bundle::
|
||||
|
||||
'css/tabzilla/tabzilla-static.less'
|
||||
|
||||
To use the static Tabzilla tab in your page, add the following markup to your template::
|
||||
|
||||
{% block tabzilla_tab %}
|
||||
<div id="tabzilla">
|
||||
<a href="{{ url('mozorg.home') }}">Mozilla</a>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
To customize the Mozilla wordmark color to suite the page design, you can use the
|
||||
following CSS selector:
|
||||
|
||||
#tabzilla:before {
|
||||
background-color: purple;
|
||||
}
|
||||
|
||||
Finally, don't forget to override the regular Tabzilla asset blocks when using the
|
||||
static version, as they are no longer needed::
|
||||
|
||||
{% block tabzilla_css %}{% endblock %}
|
||||
{% block tabzilla_js %}{% endblock %}
|
||||
https://github.com/mozilla/mozilla-infobar/
|
||||
|
|
|
@ -429,7 +429,7 @@ Passing ``defaultBrowser`` will set Firefox as the default web browser.
|
|||
``setConfiguration('defaultBrowser')`` is only available in Firefox 40 onward.
|
||||
|
||||
showFirefoxAccounts(extraURLCampaignParams);
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
Allows a web page to navigate directly to
|
||||
``about:accounts?action=signup&entrypoint=uitour``. In Firefox 47 and beyond,
|
||||
|
|
270
docs/vagrant.rst
270
docs/vagrant.rst
|
@ -1,270 +0,0 @@
|
|||
.. This Source Code Form is subject to the terms of the Mozilla Public
|
||||
.. License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
.. file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
.. _vagrant:
|
||||
|
||||
|
||||
========================
|
||||
Vagrant Installation
|
||||
========================
|
||||
|
||||
.. warning::
|
||||
July 16, 2015 - The Vagrant installation is not currently working or maintained and
|
||||
is being replaced with a Docker installation. Please use the virtualenv install until
|
||||
the Docker method is ready.
|
||||
|
||||
The Vagrant installation will help you work on the Python bedrock codebase
|
||||
and the PHP legacy codebase with a minimum amount of effort (hopefully).
|
||||
|
||||
This entire process will take between 30-50 minutes. For most of this time you will
|
||||
not be doing anything, Vagrant will be automagically downloading and configuring.
|
||||
This is a good time to have a cup of tea and/or coffee, possibly walk the dog.
|
||||
|
||||
Preparing Your System
|
||||
---------------------
|
||||
|
||||
#. **Install Vagrant.**
|
||||
|
||||
Vagrant is a manager of VMs for development.
|
||||
|
||||
Based on a configuration file, Vagrant will create a Virtual Machine, downloading
|
||||
and configuring everything you need to have a local environment running.
|
||||
|
||||
This installation is tested using version: v1.4.3
|
||||
|
||||
Visit `Vagrant's download page <http://downloads.vagrantup.com/>`_.
|
||||
|
||||
Do not install via apt-get, the version (at the time of writing) installed
|
||||
in debian wheezy appears broken.
|
||||
|
||||
#. **Install Virtualbox.**
|
||||
|
||||
You are required to have virtualbox installed.
|
||||
|
||||
This installation is tested with version 4.2.18 and can be downloaded
|
||||
|
||||
at the `virtualbox download page <https://www.virtualbox.org/>`_.
|
||||
|
||||
- For Debian based systems::
|
||||
|
||||
~$ sudo apt-get install virtualbox
|
||||
|
||||
|
||||
#. **Install git.**
|
||||
|
||||
The bedrock code is revisioned using `git <http://git-scm.org>`.
|
||||
|
||||
- For Debian based systems::
|
||||
|
||||
~$ sudo apt-get install git
|
||||
|
||||
For other Linux distributions or operating systems visit `Git's
|
||||
download page <http://git-scm.com/downloads>`_.
|
||||
|
||||
#. **Install svn.**
|
||||
|
||||
The legacy php code is revisioned using SVN.
|
||||
|
||||
- For Debian based systems::
|
||||
|
||||
~$ sudo apt-get install subversion
|
||||
|
||||
For other Linux distributions or operating systems visit `SVN's
|
||||
download page <http://subversion.apache.org/packages.html>`_.
|
||||
|
||||
|
||||
|
||||
Build The Environment
|
||||
---------------------
|
||||
|
||||
#. **Directory Setup.**
|
||||
|
||||
Create a top level directory to hold both bedrock and the legacy file system.
|
||||
You could call this directory 'bedrock-legacy'. The following steps take
|
||||
place under that directory.
|
||||
|
||||
#. **Using Git Clone Bedrock Repository.**
|
||||
|
||||
Bedrock is hosted at `<http://github.com/mozilla/bedrock>`_.
|
||||
|
||||
Clone the repository locally::
|
||||
|
||||
~bedrock-legacy$ git clone --recursive http://github.com/mozilla/bedrock
|
||||
|
||||
.. note::
|
||||
|
||||
Make sure you use ``--recursive`` when checking the repo out!
|
||||
If you didn't, you can load all the submodules with ``git
|
||||
submodule update --init --recursive``.
|
||||
|
||||
#. **Using Git Clone The www.mozilla.org l10n Repository. (Optional)**
|
||||
|
||||
If you would like to see localized versions of the site you will need to
|
||||
clone the repository containing our translations in a ``locale`` directory::
|
||||
|
||||
Clone the repository locally::
|
||||
|
||||
~$ cd bedrock
|
||||
~bedrock-legacy/bedrock$ git clone https://github.com/mozilla-l10n/www.mozilla.org locale
|
||||
|
||||
.. note::
|
||||
|
||||
You can read more details about how to localize content :ref:`here<l10n>`.
|
||||
|
||||
#. **Using SVN Checkout Mozilla.com PHP Repository.**
|
||||
|
||||
Mozilla.com PHP is hosted on `<https://svn.mozilla.org/projects/mozilla.com/trunk>`_.
|
||||
|
||||
Clone the repository locally::
|
||||
|
||||
~bedrock-legacy$ svn co https://svn.mozilla.org/projects/mozilla.com/trunk mozilla.com
|
||||
|
||||
.. note::
|
||||
|
||||
At this stage you should have two directories side-by-side. `bedrock` and `mozilla.com`.
|
||||
|
||||
|
||||
Configure The Environment
|
||||
-------------------------
|
||||
|
||||
#. **Configure Bedrock.**
|
||||
|
||||
Configure Bedrock by creating and editing the local settings file::
|
||||
|
||||
~bedrock-legacy$ cp bedrock/bedrock/settings/local.py-dist bedrock/bedrock/settings/local.py
|
||||
|
||||
Add this line below LESS_PREPROCESS::
|
||||
|
||||
LESS_BIN = '/usr/local/bin/lessc'
|
||||
|
||||
#. **Configure Mozilla PHP.**
|
||||
|
||||
Configure the legacy site by creating and editing the local settings file::
|
||||
|
||||
cd mozilla.com/includes
|
||||
cp config.inc.php-dist config.inc.php
|
||||
|
||||
Set the following values::
|
||||
|
||||
$config['server_name'] = 'mozilla.local';
|
||||
|
||||
$config['file_root'] = '/srv/legacy';
|
||||
|
||||
#. **Set A Host Name.**
|
||||
|
||||
We need to set a host name that you will use to access vagrant from a web-browser.
|
||||
You will need to add the following to your hosts file (note you may need
|
||||
sudo permissions). ::
|
||||
|
||||
192.168.10.55 mozilla.local
|
||||
|
||||
The hosts file can be found in the following directories.
|
||||
|
||||
- For Debian & OS X based systems::
|
||||
|
||||
/etc/hosts
|
||||
|
||||
- For Windows based systems ::
|
||||
|
||||
c:\windows\system32\drivers\etc\hosts
|
||||
|
||||
|
||||
Start Your Machine
|
||||
---------------------
|
||||
|
||||
#. **Fire up vagrant.**
|
||||
|
||||
Now you need to build the virtual machine where Mozilla will live. Change into the
|
||||
cloned git directory and run vagrant. Note you must run this command in the
|
||||
directory that contains the Vagrantfile. ::
|
||||
|
||||
~$ cd bedrock
|
||||
~bedrock-legacy/bedrock$ vagrant up --provision
|
||||
|
||||
.. note::
|
||||
The first time you run vagrant a VM image will be downloaded
|
||||
and the guest machine will be configured. You will be
|
||||
downloading more than 300Mb for the linux image and a bunch of additional
|
||||
downloading and configuration is going to happen. The total install can
|
||||
take 20 minutes on a fast machine. A decent internet connection is
|
||||
recommended.
|
||||
|
||||
.. note::
|
||||
Often the initial installation will time out while
|
||||
compiling node.
|
||||
|
||||
If this happens just run the following command to re-sume the install: ::
|
||||
|
||||
~bedrock-legacy/bedrock$ vagrant provision
|
||||
|
||||
|
||||
#. **Update Product Details**
|
||||
Bedrock needs to grab some information about Mozilla products to run. This is a
|
||||
one time update. To run the update you need to SSH into your Vagrant install
|
||||
and run the update script.
|
||||
|
||||
SSH into your vagrant install ::
|
||||
|
||||
~bedrock-legacy/bedrock$ vagrant ssh
|
||||
|
||||
CD Into The Top Level Bedrock Directory::
|
||||
|
||||
~$ cd /vagrant/
|
||||
|
||||
Update Product Details::
|
||||
|
||||
/vagrant$ python manage.py update_product_details
|
||||
|
||||
Exit ::
|
||||
|
||||
/vagrant$ exit
|
||||
|
||||
|
||||
#. **Confirm Everything Is Setup.**
|
||||
|
||||
Confirm both bedrock and the legacy PHP site are working by visiting
|
||||
these urls. If everything looks right you are good to go!
|
||||
|
||||
http://mozilla.local
|
||||
The mozilla homepage loading from bedrock.
|
||||
|
||||
|
||||
http://mozilla.local/en-US/about/legal.html
|
||||
A legacy page loading from PHP
|
||||
|
||||
.. note::
|
||||
The first time you load a page the CSS may not load. This is likely
|
||||
due to the CSS not being compiled. Doing a refresh will solve this problem.
|
||||
|
||||
Working & Workflow
|
||||
---------------------
|
||||
|
||||
At this stage you should have a fully functional dev environment. You can work
|
||||
on files in your regular manner and follow the normal git workflow.
|
||||
|
||||
|
||||
|
||||
Tips & Tricks
|
||||
---------------------
|
||||
|
||||
#. **Connect to your vagrant machine.**
|
||||
|
||||
You can connect to your vagrant machine, when it's running, using: ::
|
||||
|
||||
bedrock-legacy/bedrock$ vagrant ssh
|
||||
|
||||
#. **Starting & Stopping Vagrant.**
|
||||
|
||||
Start ::
|
||||
|
||||
~$ vagrant up --provision
|
||||
|
||||
Stop (vagrant is memory intensive - so if you are not using it best to stop it)::
|
||||
|
||||
~$ vagrant halt
|
||||
|
||||
|
||||
Troubleshooting
|
||||
---------------------
|
||||
Find us on irc in #webprod
|
Загрузка…
Ссылка в новой задаче