Visual Arts Press Blog

The all knowing, ever present VAP knowledge base

Archive for the ‘web’ Category

In case of emergency, break glass…

without comments

Symptom: Website seems unresponsive or a known page is throwing a 500 Internal Server Error
Prescription: SSH into production and run $ top. If CPU is spiking (consistently greater than 85%) then something is wrong. The general culprits are either MySQL or Apache. Generally you can tell which is the problem from top by looking at CPU usage. Regardless you’ll probably want to do the following:

  • Verify MySql is operational and accessible by logging in: $ mysql -uroot -psvaW3bpr0ject
  • The site uses the sva_sf2 database, so in addition you can do: > use sva_sf2; select count(*) from pages; and you should get something greater than 7,000. In the off chance you should need to restore or compare against a previous database, daily backups are in /var/www/database_backups
  • If it seems that apache is borking (high CPU): $ sudo service httpd restart
  • If that still didn’t do it, then $ cd /var/www/html/sva/releases/release/ and run $ sudo ./clear_cache.sh, and restart Apache after that
  • If that fails and you think the problem is with mysql then first shutdown apache:
    • $ sudo service httpd stop
    • $ mysqladmin -uroot -psvaW3bpr0ject shutdown
    • $ sudo mysqld_safe
    • $ sudo service httpd start
  • If you cannot SSH into the box then there’s nothing you can do except get in touch with IT (Ian, Brian, Cosmin) and have them reach out to Rackspace to restart the server.
Symptom: CE course is not on the website/has the wrong info
Prescription: 90% of the time this is a problem with how the course was entered by the Registrar. The entire CE workflow is documented here (TL;DR) but the basic things you want to check are:
  • Make sure the course is in the Regbook database (connection details below)
  • All CE courses are stored in either one of two tables: regbook_sections_ft for full-time courses and regbook_sections_ce for regular non-credit CE courses (90% of courses are in here)
  • The first thing you’ll want to do is verify that the course is in the appropriate table. So in SequelPro, find the course (in whichever table it’s supposed to be in) by Section number (ADC-2020-A). If the course is found, make sure it exists for the correct term (15/CU, for example, is 2015 Summer. FA is Fall and CS is Spring–I’m pretty sure about those but not 100%)
  • If the course is is in regbook_sections_ce then the course should be imported into SVA.edu > course_pages table. All courses in regbook_sections_ce are imported into course_pages, no other requirements need to be met.
  • If the course is in regbook_sections_ft then you have to make sure the schedule_type field=D as only this type of course will be imported.
  • If the course is not in either of these tables, then the problem resides with either the Registrar or Colleague Computing. Either way you’ll want to send an email to Elena Blank and Celeste Barns asking them to investigate.
  • If the course is one of these tables but is not being imported into SVA.edu then try importing courses manually
    • SSH into production
    • $ cd /var/www/html/sva/releases/release/
    • $ ./app/console sva:ingest-regbook-import (no sudo) – this is for the regbook_sections_ce table
    • $ ./app/console/sva:set-undergraduate-credit-courses (no sudo) – this is for the regbook_sections_ft table
  • Either the command will run successfully, or more likely if it isn’t working, it will throw an error. If it gives a permissions error, see the fix to cron events below. Otherwise debug normally.
  • If you need to start debugging anything related to CE, first know whether you’re dealing with a regular ce course or full-time course. Then go into the appropriate ModelBundle/Command (either ingestRegbookImport or setUndergraduateCreditCourses) and from there you’ll most likely find yourself in ModelBundle/Service/SearchCourse…
Symptom: A cron event, such as ce courses are not importing or feeds/tweets are not updating
Prescription: Most of the time this is a permissions issue that running the clear-cache script will fix.
  • If clear_cache doesn’t fix it, run $ sudo chmod -R 777 /dev/shm/sva, then $ sudo ./clear_cache.sh again
  • Occasionally the update-feed-sources command will choke on a poorly formed feed url or feed response. This is pretty easy to diagnose, just run the command from the server ( $ cd /var/www/html/sva/releases/release/app/console sva:update-feed-sources ) and watch the output, then disable that feed from within the CMS

Written by ecorriel

June 8th, 2015 at 9:18 pm

Posted in web

Links from Symfony Live 2014

without comments

Written by ecorriel

October 10th, 2014 at 7:11 pm

Posted in web

Create SVA Homepage Slideshow from InDesign doc

without comments

Based on this InDesign contact sheet:

Create a new InDesign document (intent: web; size 980px by 380px):

Copy the image from the contact sheet

Paste it to the new InDesign file and scale it (usually 682%):

Repeat this for every image and export them as jpeg!

Written by web

August 27th, 2014 at 5:06 pm

Posted in web

PHP, MySQL, Apache on beta, prod, and sf2 servers

without comments

Settings for:

  • sva.edu (172.22.1.189)
  • beta.sva.edu (172.22.1.188)
  • symfony beta server (184.75.59.178)
  • symfony prod server (184.75.59.179)

Apache
/etc/httpd/conf/httpd.conf
/etc/httpd/logs
> apachectl restart

PHP
/etc/php.ini

MySQL for sva.edu & beta.sva.edu
/etc/init.d/mysqld start

MySQL for sf2 servers
host: database3.sva.edu
u/p: vap/svaW3bpr0ject

Web dir
/var/www/html

PHPMyAdmin (only for sf2 servers)
db3phpmyadmin.sva.edu

Written by ecorriel

February 24th, 2014 at 8:27 pm

Posted in admin,web

Creating a new git branch locally and remotely

without comments

Locally

> git  checkout -b <new-branch-name>
> git push origin <new-branch-name>

Remotely

> git fetch
> git checkout --track -b <new-branch-name> remotes/origin/<new-branch-name>

 

 

Written by ecorriel

November 4th, 2013 at 9:29 pm

Posted in git,web

Installing Symfony2

without comments

  1. In Terminal, navigate to the location of your current sva.local directory.  Backup one level and create a new directory for the new site (“sva_v2”).
  2. cd sva_v2
  3. git init
  4. git remote add origin https://funnygarbage.unfuddle.com/git/funnygarbage_sva2/
  5. git config remote.unfuddle.push refs/heads/master:refs/heads/master
  6. git pull origin master
  7. Follow Symfony2 Install Instructions
  8. curl -s https://getcomposer.org/installer | php
  9. php ./composer.phar update
  10. Update Apache httpd.conf
  11. <VirtualHost *>
        ServerName sva2.local
    
        DocumentRoot /Users/ec/Sites/sf/sva_v2/web
        <Directory /Users/ec/Sites/sf/sva_v2/web>
            # enable the .htaccess rewrites
            AllowOverride All
            Order allow,deny
            Allow from All
        </Directory>
    
        ErrorLog /opt/local/apache2/logs/sva2.log
        CustomLog /opt/local/apache2/logs/sva2.custom.log combined
    </VirtualHost>
  12. Update /etc/hosts
  13. from http://symfony.com/doc/current/book/installation.html
  14. 1
    2
    3
    4
    5
    6
    $ rm -rf app/cache/*
    $ rm -rf app/logs/*
    
    $ APACHEUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data' | grep -v root | head -1 | cut -d\  -f1`
    $ sudo chmod +a "$APACHEUSER allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
    $ sudo chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" app/cache app/logs
  15. from http://stackoverflow.com/questions/9931127/symfony-2-working-with-assets
  16. app/console assets:install web --symlink
  17. 10.103.0.4  sva2.local
  18. restart apache
  19. http://sva2.local/

Written by ecorriel

September 18th, 2013 at 4:04 pm

Posted in web

Setting up a git repo on svablogserver.sva.edu

without comments

> mkdir blog.sva.edu
> sudo chgrp -R vabriefs blog.sva.edu/
> sudo chmod -R g+swX blog.sva.edu/
> cd blog.sva.edu/
> git init
> git remote add origin https://visualartspress.unfuddle.com/git/XXXXXXXXXXXXXX
> git config remote.unfuddle.push refs/heads/master:refs/heads/master
> ssh-keygen -t rsa
> cat ~/.ssh/id_rsa.pub

Copy results and paste into unfuddle > account > SSH keys

>  sudo vi ~/.netrc

machine visualartspress.unfuddle.com
login username
password password

 

> git fetch

 

 

 

Written by ecorriel

June 28th, 2013 at 8:55 pm

Posted in admin,git,web

Things to test when migrating SVA.edu

without comments

add poster page w the works
- make sure all images/video work
- add a new download

CMS
- AD login
forms
- make sure emails are being sent out

cron
- make sure all cron jobs running
- ./symfony sva:update-feed-sources
 ./symfony sva:ingest-regbook-import

forms
- test form can write txt file to server and results being written to excel file
- http://166.78.75.182/form/accepted-students-day-am
- signup form adding to nuke db
	- (http://www.sva.edu/events)
	- mysql> select * from subscribe order by signupDate desc limit 1;
- catalog request form
database
- make sure migrated most recent version (calendar entries are up to date; check last modified time of most recent entry in pages table)
php
- ini settings resemble old server

apache
- makes sure apache user owns svamaps folder so can recreate cache folder when necess; also write files to server
- eblasts upload to public

test briefs
- both upload to server and download

homepage
- rotator

Written by ecorriel

May 6th, 2013 at 5:11 pm

Posted in admin,web

Restoring CE course categories manually

with 3 comments

If all CE courses should be deleted from RegBook and hence, wiped off the site, then once they are restored into RegBook, reimport them into Symfony:

> ./symfony sva:ingest-regbook-import



While this will reimport all courses, unfortunately it will not reassign courses to their proper categories (course_category_map table will be empty).  These will have to be restored by hand (a db restore will not work because all page_ids and foreign keys will be different after the import).

Restoring Course Categories

  1. Drop sva db on beta and replace with sva db from production
  2. Open up two browser windows side by side: beta.sva.edu/cms.php and sva.edu/cms.php
  3. Navigate to CE > Course Categories on both browsers > select a concentration > select a category > click Show All Courses
  4. Open up a JavaScript console on both browsers
  5. In the beta console, paste the following:
    var str='';
    $('input:checked').each(function(){
    if(typeof $(this).val() != 'undefined') str+=$(this).val()+','});
    str=str.substr(0,str.length-1);
    str;
  6. Copy the output, including the open and closed quotes
  7. In the production window console, paste the following:
    var str=<paste the output from beta here>
    var arr=str.split(',');
    for(var i=0; i<arr.length; i++){$('input[value=' + arr[i] +']').prop('checked',true)}
  8. Save Changes
  9. Repeat for all categories (and UG courses).  Don’t forget to click Show All Courses each time.

Written by ecorriel

April 2nd, 2013 at 10:11 pm

Posted in admin,web

If you totally bork the git repo…

without comments

# delete entire directory and recreate git repo
> rm -r svamaps
> git init
> git remote add unfuddle git@visualartspress.unfuddle.com:visualartspress/sva.git
> git config remote.unfuddle.push refs/heads/master:refs/heads/master
> git clone git@visualartspress.unfuddle.com:visualartspress/sva.git

# for some reason, the directory comes down as ‘sva’ but it needs to be ‘svamaps’ on beta and production
> mv sva svamaps

# create and connect local branches to remotes
> git checkout --track -b develop_prime remotes/origin/develop_prime
> git checkout --track -b master_prime remotes/origin/master_prime

# get rid of default master branch; not used
> git branch -D master

# create cache and log dirs
> cd svamaps
> mkdir cache
> mkdir log
> chmod 777 cache
> chmod 777 log

# upload files not in the repo
– web/frontend_dev.php (you may have to alter these to add your IP to the list of allowed IPs)
– web/cms_dev.php
– config/databases.yml (copy from beta/production)

# i think that’s it…

 

2/27/13 : UPDATE : according to (new?) unfuddle requirements, all push/pull requests require unfuddle u/p authentication.  To get around this, create ~/.netrc and add:

machine visualartspress.unfuddle.com
login <unfuddle username>
password <unfuddle password>

Note: you’ll have to do this on local, beta and production.

 

3/5/15: UPDATE: to delete branches in the repo:

> git push origin :master_old

Written by ecorriel

November 30th, 2012 at 12:00 am

Posted in admin,web