Deployment is related to the content of content
directory.
Below list some common deployment mode/method, which support basic command tool, or based on fabfile
Self-Managed Server
Use rsync
or scp
command, transfer the content of output directory to the root path of your server, configured with Web Server(Such as Nginx, Apache, etc.)
If use Fabric, you need to add deploy
settings in _config.yml
:
deploy: - type: rsync user: <login username> host: <remote host ip or domain> dir: <path to store files/dirs under output>
This will transfer the sub-file/sub-directory under output to the remote server, with configured directory path, base on Rsync with SSH.
If you don't want to enter password every time, you can configure SSH Private/Public Key
Run deploy command:
$ fab deploy
FTP Server
Use sftp
or ftp
command, upload the content of output directory to the root path of your server, configured from the background of server service provider.
If use Fabric, you need to add deploy
settings in _config.yml
:
deploy: - type: ftp host: <remote host ip or domain> port: <remote host port, default is 21> user: <login username> password: <login password> dir: <path to store files/dirs under output>
This will upload the sub-file/sub-directory under output to the remote server, with configured directory path, base on FTP.
About password
field:
- If password field not exists, the password is empty string.
- If password field exists but without value, script will enter into interactive mode and prompt you to enter the password.
- If password field exists and has value, script will use this password directly to authenticate with the ftp server.
NOTE: If configured password, DO NOT to put this config file to public server, such as Github public repository!
Advice: Configure password with empty value, this will let you enter password every time:
deploy: - type: ftp host: 1.1.1.1 user: bob password: # Leave this value be empty dir: /
Run deploy command:
$ fab deploy
Github Pages
Github Pages helps you build your own site, without to buy VPS/Virtual Host.
If use Fabric, you need to add deploy
settings in _config.yml
:
deploy: - type: git remote: <remote repo name, default is 'origin'> branch: <branch, default is 'gh-pages'>
This will push the sub-file/sub-directory under output to the remote repository, with configured branch, based on Git.
NOTE:
- Make sure you have set remote-tracking reposistory/branch, use
git remote -v
to list the remote reposistory. - Make sure you have installed ghp-import, a github-pages tool base on Python. More details see issue 23
Run deploy command:
$ fab deploy
For Github Pages, with default settings,
ghp-import
actually executesghp-import -p -m "Update output documentation" -r origin -b gh-pages output
. ghp-import is a open-source tool, it can commit the changes of specific directory (e.g. output directory) to gh-pages branch and push to Github. ghp-import will traverse all the files under specific directory, and use the backend commandgit fast-import
, add or modify the file to git repository one by one.
(The End ...)
Note: Below procedures are another way to deploy for Github Pages, not the same as above way using ghp-import
, and this need to manually configure, very complicated. At present, this method is deprecated, and is no longer maintained.
More details are give in Github Pages Documentation
User Pages
Create User Pages
.
-
Create a repository named
<username>.github.io
.<username>
is your Github's username. -
Into your local site, setup a
master
branch in output directory:cd output git init git add . git commit -m 'your comment' # These steps will be shown when you create a repo in Github: git remote add origin https://github.com/<username>/<username>.github.io.git git push -u origin master
-
Back to the parent directory, and create a
.gitignore
file:cd ../ echo -e '*.pyc\noutput' > .gitignore
-
Setup a
source
branch:git init git checkout -b source git add . git commit -m 'your comment' # These steps will be shown when you create a repo in Github: git remote add origin https://github.com/<username>/<username>.github.io.git git push -u origin source
Wait for a while and visit http://<username>.github.io/
.
The way to bind domain on User Pages can refer to the Project Pages.
Project Pages
Project Pages have two types:
- With custom domain
- Without custom domain
With Custom Domain
-
Create a repository with any name
<projectname>
. -
Into your local site, setup a
gh-pages
branch in output directory:cd output git init git checkout -b gh-pages git add . git commit -m 'your comment' # These steps will be shown when you create a repo in Github: git remote add origin git@github.com:<username>/<projectname>.git git push -u origin gh-pages
-
Back to the parent directory, and create a
.gitignore
file:cd ../ echo -e '*.pyc\noutput' > .gitignore
-
Setup a
master
branch:git init # Write your domain to file named CNAME, locate under root of site echo "<yourdomain.com>" > CNAME git add . git commit -m 'your comment' # These steps will be shown when you create a repo in Github: git remote add origin git@github.com:<username>/<projectname>.git git push -u origin master
Wait for a while and visit http://<yourdomain.com>
Note:
- DO NOT change
root
settings in_config.yml
. - If you set project page with domain, visit your wiki with setted domain, not github domain.
More Reference:
An example:
Without Custom Domain
The project pages url is http://<username>.github.io/<projectname>
, so you should set root
to your projectname in _config.yml
:
root: /<projectname>
The others are the same as Project Pages with Custom Doamin above.
An example: