Deploying a Site with Shared Resources: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
==TODO Develop a workflow that incorporates GIT==
== TODO Develop a workflow that incorporates GIT ==
*Would require SSH access to the production server.  
 
**Sites hosted by NameCheap and GoDaddy have SSH access.  
* Would require SSH access to the production server.  
**Fall back on FTP uploads.
** Sites hosted by NameCheap and GoDaddy have SSH access.  
** Fall back on FTP uploads.
 
== Site-specific files ==


==Site-specific files==
*Make sure to upload <code>/_config/app_config.php </code> with development settings disabled.
*Make sure to upload <code>/_config/app_config.php </code> with development settings disabled.
:This should be as simple as:
:This should be as simple as:
Line 10: Line 12:
define ("IS_DEV", false);
define ("IS_DEV", false);
</syntaxhighlight>
</syntaxhighlight>
*Do a full backup of the existing site if making significant structural changes.
* Do a full backup of the existing site if making significant structural changes.
**Try to save the archive outside of the web directory on the server.
** Try to save the archive outside of the web directory on the server.
**With SSH access:
** With SSH access:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
tar -czvf [SITE_NAME]-[DATE_yymmdd].tar.gz file1 file2 dir1 dir2 ...
tar -czvf [SITE_NAME]-[DATE_yymmdd].tar.gz file1 file2 dir1 dir2 ...
</syntaxhighlight>
</syntaxhighlight>
::*Creates a gzipped archive named <code>[SITE_NAME]-[DATE_yymmdd].tar.gz</code> from the files <code>file1 file2 dir1 dir2 ...</code>
::* Creates a gzipped archive named <code>[SITE_NAME]-[DATE_yymmdd].tar.gz</code> from the files <code>file1 file2 dir1 dir2 ...</code>
::*<code>-c</code> create an archive
::* <code>-c</code> create an archive
::*<code>-z</code> compress the archive
::* <code>-z</code> compress the archive
::*<code>-v</code> verbose mode
::* <code>-v</code> verbose mode
::*<code>-f</code> specifies the name of the archive file
::* <code>-f</code> specifies the name of the archive file
:*Without SSH access:
:* Without SSH access:
:**Site cPanel > File Manager > select the files and directories to archive & compress
:** Site cPanel > File Manager > select the files and directories to archive & compress
:**Be aware that the cPanel File Manager usually imposes a size limit on the files being compressed and doesn't work well with a large amount of images.  
:** Be aware that the cPanel File Manager usually imposes a size limit on the files being compressed and doesn't work well with a large amount of images.  
:*Always download the archive after creating it.
:* Always download the archive after creating it.
*Copy local files to server.
* Copy local files to server.
**Collect files into a single archive and upload.
** Collect files into a single archive and upload.
**With SSH access use command line to extract the files.
** With SSH access use command line to extract the files.
**Without SSH access use cPanel File Manager.
** Without SSH access use cPanel File Manager.
* Permissions
** Until I research this more completely, I am settings permissions at `644` for files and `705` for directories.
** This is only an issue when uploading files and directories for the first time.
*** '''Netbeans''' has a setting in ''site'' > ''source files'' > ''right click'' > '''Properties''' > '''Categories: Run Configuration''' > '''Preserve Remote File Permissions'''
** Some adjustment may need to be made for directories:
*** Where images are uploaded (but `705` has worked fine for that so far).
*** And for directories where the PHP pages deposit cache files.
<syntaxhighlight lang="bash">
$ find ./ -type d -exec chmod 705 {} \;
$ find ./ -type f -exec chmod 644 {} \;
</syntaxhighlight>


*TODO: Git workflow
*TODO: Git workflow
Line 52: Line 65:
*Update production database using cPanel > phpMyAdmin
*Update production database using cPanel > phpMyAdmin


[[Category:CMS Documentation]] [[Category:Git]]
[[Category:Project Documentation]] [[Category:CMS Documentation]] [[Category:Git]][[Category:Web Hosting]][[Category:Web Development]]

Latest revision as of 12:41, 6 October 2018

TODO Develop a workflow that incorporates GIT[edit]

  • Would require SSH access to the production server.
    • Sites hosted by NameCheap and GoDaddy have SSH access.
    • Fall back on FTP uploads.

Site-specific files[edit]

  • Make sure to upload /_config/app_config.php with development settings disabled.
This should be as simple as:
define ("IS_DEV", false);
  • Do a full backup of the existing site if making significant structural changes.
    • Try to save the archive outside of the web directory on the server.
    • With SSH access:
tar -czvf [SITE_NAME]-[DATE_yymmdd].tar.gz file1 file2 dir1 dir2 ...
  • Creates a gzipped archive named [SITE_NAME]-[DATE_yymmdd].tar.gz from the files file1 file2 dir1 dir2 ...
  • -c create an archive
  • -z compress the archive
  • -v verbose mode
  • -f specifies the name of the archive file
  • Without SSH access:
    • Site cPanel > File Manager > select the files and directories to archive & compress
    • Be aware that the cPanel File Manager usually imposes a size limit on the files being compressed and doesn't work well with a large amount of images.
  • Always download the archive after creating it.
  • Copy local files to server.
    • Collect files into a single archive and upload.
    • With SSH access use command line to extract the files.
    • Without SSH access use cPanel File Manager.
  • Permissions
    • Until I research this more completely, I am settings permissions at 644 for files and 705 for directories.
    • This is only an issue when uploading files and directories for the first time.
      • Netbeans has a setting in site > source files > right click > Properties > Categories: Run Configuration > Preserve Remote File Permissions
    • Some adjustment may need to be made for directories:
      • Where images are uploaded (but 705 has worked fine for that so far).
      • And for directories where the PHP pages deposit cache files.
$ find ./ -type d -exec chmod 705 {} \;
$ find ./ -type f -exec chmod 644 {} \;
  • TODO: Git workflow

Shared files and libraries[edit]

  • [COMMON_LIB]_ajax/ >> /_hostmgr/_ajax/
  • [COMMON_LIB]_classes/ >> /_classes/
  • [COMMON_LIB]_lib/ >> /_lib/
    TODO This directory needs to be cleaned up. Possibly the subdirectory error/ is the only one that needs to be uploaded.
  • [COMMON_LIB]_templates/ >> /_hostmgr/_templates/
  • [COMMON_LIB]hostmgr/sections/ >> /_hostmgr/sections/
  • [COMMON_LIB]scripts/ >> /scripts/
    • jquery/
    • littled/
      • JavaScript code should be copied from the minified JS library file to its corresponding *-source.js file.
      • JavaScript code uploaded to server should be minified.
      • Do not upload *-source.js files.
  • TODO: Git workflow

Database[edit]

  • Do a complete backup of the existing database before making any structural changes.
    Naming convention [SITE_NAME]-[DATEYYMMDD].sql
  • Store all updates to database data and structure in local _dbo/ directory.
  • Update production database using cPanel > phpMyAdmin