Total Pageviews

Sunday 15 May 2016

一个基于nodejs+mysql的建站程序

How to build

$ gulp clean
$ gulp {action} [--environment {environments}]
  • {action}: [build | deploy].
    • build: builds release package in app.
    • deploy: deploy to GAE.
  • {environments}: [local | dev | prod]. Default: local
    • local: local development version.
    • dev: developement version deployed on GAE.
    • prod: production version on GAE.

How to run locally

  1. Add the following line to your /etc/hosts (for Windows, it's %systemroot%\system32\drivers\etc\hosts)
    127.0.0.1 www-local.brithon.com
  2. Install MySQL 5.5+ and make sure the password of root on localhost is empty. It's easy to install MySQL in local box, while installation in virtual machine is recommended, which is also very easy. And you only need to forward port 3306 of guest to 3306 of host. Actually, it would be much simpler with docker like this:
    # install msyql docker image, and create a local container `mysql-5.6`, with empty root password.
    # local data volume /var/lib/mysql is created for data persistence.
    $ docker run --name mysql-5.6 -p 3306:3306 -v /var/lib/mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d mysql:5.6
    
    # use this after
    $ docker start mysql-5.6
    
    # (optional for mac only), forward port vm `3306` to host `3306`. 
    
    # remove the container
    $ docker rm -v mysql-5.6
  3. Create a database named brithon_www.
    $ echo 'CREATE DATABASE brithon_www;' | mysql -u root
  4. Download and install Google App Engine SDK for PHP.
  5. Clone this repo and cd into the working dir.
  6. Run npm install.
  7. Run gulp build and the app dir will be created.
  8. Start the service with npm start.
  9. Visit http://www-local.brithon.com:8080 to go through the wp installation.
from https://github.com/llorien/website