using docker and vagrant for blogging environment
also added cookiecutter for easier blog post creation.
This commit is contained in:
parent
193e98a8e2
commit
1426c4b732
1
.gitignore
vendored
1
.gitignore
vendored
@ -47,3 +47,4 @@ nosetests.xml
|
|||||||
|
|
||||||
# OWN STUFF
|
# OWN STUFF
|
||||||
.ftp_pass.txt
|
.ftp_pass.txt
|
||||||
|
.vagrant/*
|
||||||
|
4
Makefile
4
Makefile
@ -51,6 +51,7 @@ help:
|
|||||||
@echo ' make s3_upload upload the web site via S3 '
|
@echo ' make s3_upload upload the web site via S3 '
|
||||||
@echo ' make cf_upload upload the web site via Cloud Files'
|
@echo ' make cf_upload upload the web site via Cloud Files'
|
||||||
@echo ' make github upload the web site via gh-pages '
|
@echo ' make github upload the web site via gh-pages '
|
||||||
|
@echo ' make newpost create new post '
|
||||||
@echo ' '
|
@echo ' '
|
||||||
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
|
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html'
|
||||||
@echo ' '
|
@echo ' '
|
||||||
@ -108,4 +109,7 @@ github: publish
|
|||||||
ghp-import -b $(GITHUB_PAGES_BRANCH) $(OUTPUTDIR)
|
ghp-import -b $(GITHUB_PAGES_BRANCH) $(OUTPUTDIR)
|
||||||
git push origin $(GITHUB_PAGES_BRANCH)
|
git push origin $(GITHUB_PAGES_BRANCH)
|
||||||
|
|
||||||
|
newpost:
|
||||||
|
python $(BASEDIR)/newpost.py
|
||||||
|
|
||||||
.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github
|
.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github
|
||||||
|
17
README.md
17
README.md
@ -1,17 +1,12 @@
|
|||||||
blog
|
blog
|
||||||
====
|
====
|
||||||
|
|
||||||
|
## create environment ##
|
||||||
## install ##
|
|
||||||
1. `git clone git@github.com:xsteadfastx/blog.git`
|
1. `git clone git@github.com:xsteadfastx/blog.git`
|
||||||
2. `cd blog && virtualenv -p /usr/bin/python3 venv`
|
2. build the environment with `cd blog && vagrant up`
|
||||||
3. `source venv/bin/activate`
|
3. login in the environment with `vagrant ssh`
|
||||||
4. `pip install -r requirements.txt`
|
|
||||||
|
|
||||||
## upgrade ##
|
|
||||||
`pip install --upgrade pelican markdown ghp-import shovel`
|
|
||||||
|
|
||||||
## write ##
|
## write ##
|
||||||
1. put the markdown files in "content/posts"
|
1. create new post with `make newpost`
|
||||||
2. test it with `make html && make serve`
|
2. write the post with`vim content/posts/new-blog-post.md`
|
||||||
3. upload it to github with `make github`
|
3. upload with `make ftp_upload`
|
||||||
|
24
Vagrantfile
vendored
Normal file
24
Vagrantfile
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
# -*- mode: ruby -*-
|
||||||
|
# vi: set ft=ruby :
|
||||||
|
|
||||||
|
Vagrant.configure(2) do |config|
|
||||||
|
config.vm.network "forwarded_port", guest: 8888, host: 8888
|
||||||
|
config.ssh.forward_agent = true
|
||||||
|
|
||||||
|
config.vm.provider "docker" do |d|
|
||||||
|
d.build_dir = "./vagrant"
|
||||||
|
d.has_ssh = true
|
||||||
|
end
|
||||||
|
|
||||||
|
# provisioning
|
||||||
|
require 'rbconfig'
|
||||||
|
|
||||||
|
config.vm.provision "ansible" do |ansible|
|
||||||
|
ansible.playbook = "ansible/vagrant.yml"
|
||||||
|
ansible.limit = "all"
|
||||||
|
ansible.verbose = "v"
|
||||||
|
#ansible.vault_password_file = "ansible/.vault_pass.txt"
|
||||||
|
ansible.host_key_checking = false
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
1576
_nb_header.html
1576
_nb_header.html
File diff suppressed because one or more lines are too long
42
ansible/vagrant.yml
Normal file
42
ansible/vagrant.yml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
|
||||||
|
- name: install deps
|
||||||
|
apt:
|
||||||
|
name={{ item }}
|
||||||
|
state=present
|
||||||
|
with_items:
|
||||||
|
- git
|
||||||
|
- ansible
|
||||||
|
- python-dev
|
||||||
|
- python-virtualenv
|
||||||
|
- libxml2-dev
|
||||||
|
- libxslt1-dev
|
||||||
|
- zlib1g-dev
|
||||||
|
- lftp
|
||||||
|
- pandoc
|
||||||
|
- nodejs
|
||||||
|
sudo: yes
|
||||||
|
|
||||||
|
- name: clone batcave
|
||||||
|
git:
|
||||||
|
repo=https://github.com/xsteadfastx/batcave.git
|
||||||
|
dest=~/batcave
|
||||||
|
|
||||||
|
- name: run batcave
|
||||||
|
command:
|
||||||
|
ansible-playbook -i hosts site.yml --skip-tags "x11" -c local
|
||||||
|
chdir=~/batcave
|
||||||
|
|
||||||
|
- name: create python environment
|
||||||
|
pip:
|
||||||
|
requirements=/vagrant/requirements.txt
|
||||||
|
virtualenv=~/env
|
||||||
|
virtualenv_command=virtualenv -p /usr/bin/python3
|
||||||
|
|
||||||
|
- name: clone pelican plugins
|
||||||
|
git:
|
||||||
|
repo=https://github.com/getpelican/pelican-plugins.git
|
||||||
|
dest=/vagrant/pelican-plugins
|
7
cookiecutter-new-post/cookiecutter.json
Normal file
7
cookiecutter-new-post/cookiecutter.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"repo_name": "content",
|
||||||
|
"title": "Title",
|
||||||
|
"slug": "slug-used-for-url-and-filename",
|
||||||
|
"tags": "tags, goes, here",
|
||||||
|
"description": "used for twitter cards"
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
Title: {{cookiecutter.title}}
|
||||||
|
Date: {{cookiecutter.date}}
|
||||||
|
Slug: {{cookiecutter.slug}}
|
||||||
|
Tags: {{cookiecutter.tags}}
|
||||||
|
Description: {{cookiecutter.description}}
|
7
newpost.py
Normal file
7
newpost.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
from cookiecutter.main import cookiecutter
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
|
||||||
|
cookiecutter(
|
||||||
|
'cookiecutter-new-post',
|
||||||
|
extra_context={'date': datetime.utcnow().strftime('%Y-%m-%d %H:%M')})
|
@ -1 +1 @@
|
|||||||
Subproject commit 5b794ea11b272a74981877a9d8b64dc3d4a2254d
|
Subproject commit fda474fb90473874f5a0f04b6dda2d4db7c4503e
|
@ -68,7 +68,7 @@ PLUGIN_PATHS = ['pelican-plugins']
|
|||||||
PLUGINS = ['liquid_tags.youtube', 'liquid_tags.vimeo', 'liquid_tags.notebook']
|
PLUGINS = ['liquid_tags.youtube', 'liquid_tags.vimeo', 'liquid_tags.notebook']
|
||||||
|
|
||||||
NOTEBOOK_DIR = 'notebooks'
|
NOTEBOOK_DIR = 'notebooks'
|
||||||
EXTRA_HEADER = open('_nb_header.html').read().decode('utf-8').replace(
|
EXTRA_HEADER = open('_nb_header.html').read().replace(
|
||||||
'highlight', 'highlight-ipynb')
|
'highlight', 'highlight-ipynb')
|
||||||
|
|
||||||
CACHE_CONTENT = True
|
CACHE_CONTENT = True
|
||||||
|
@ -1,29 +1,50 @@
|
|||||||
BeautifulSoup==3.2.1
|
BeautifulSoup==3.2.1
|
||||||
Jinja2==2.7.3
|
Jinja2==2.8
|
||||||
Markdown==2.4
|
Markdown==2.4
|
||||||
MarkupSafe==0.23
|
MarkupSafe==0.23
|
||||||
|
PyYAML==3.11
|
||||||
Pygments==2.0.2
|
Pygments==2.0.2
|
||||||
Unidecode==0.04.18
|
Unidecode==0.04.18
|
||||||
argparse==1.2.1
|
argparse==1.2.1
|
||||||
backports.ssl-match-hostname==3.4.0.2
|
backports.ssl-match-hostname==3.4.0.2
|
||||||
beautifulsoup4==4.3.2
|
beautifulsoup4==4.3.2
|
||||||
|
binaryornot==0.4.0
|
||||||
blinker==1.3
|
blinker==1.3
|
||||||
certifi==14.05.14
|
certifi==2015.04.28
|
||||||
|
chardet==2.3.0
|
||||||
|
click==3.3
|
||||||
|
cookiecutter==1.0.0
|
||||||
|
decorator==4.0.2
|
||||||
docutils==0.12
|
docutils==0.12
|
||||||
feedgenerator==1.7
|
feedgenerator==1.7
|
||||||
|
funcsigs==0.4
|
||||||
functools32==3.2.3-1
|
functools32==3.2.3-1
|
||||||
ghp-import==0.4.1
|
ghp-import==0.4.1
|
||||||
ipython==3.1.0
|
ipykernel==4.0.3
|
||||||
|
ipython==4.0.0
|
||||||
|
ipython-genutils==0.1.0
|
||||||
jsonschema==2.5.1
|
jsonschema==2.5.1
|
||||||
|
jupyter-client==4.0.0
|
||||||
|
jupyter-core==4.0.4
|
||||||
lxml==3.4.2
|
lxml==3.4.2
|
||||||
mistune==0.5.1
|
mistune==0.7
|
||||||
|
mock==1.3.0
|
||||||
|
nbconvert==4.0.0
|
||||||
|
nbformat==4.0.0
|
||||||
|
notebook==4.0.4
|
||||||
|
path.py==7.6.1
|
||||||
|
pbr==1.5.0
|
||||||
pelican==3.6.0
|
pelican==3.6.0
|
||||||
|
pexpect==3.3
|
||||||
|
pickleshare==0.5
|
||||||
ptyprocess==0.5
|
ptyprocess==0.5
|
||||||
python-dateutil==2.4.2
|
python-dateutil==2.4.2
|
||||||
pytz==2015.4
|
pytz==2015.4
|
||||||
pyzmq==14.4.1
|
pyzmq==14.7.0
|
||||||
requests==2.6.0
|
requests==2.6.0
|
||||||
|
simplegeneric==0.8.1
|
||||||
six==1.9.0
|
six==1.9.0
|
||||||
terminado==0.5
|
terminado==0.5
|
||||||
tornado==4.0.2
|
tornado==4.2.1
|
||||||
|
traitlets==4.0.0
|
||||||
wsgiref==0.1.2
|
wsgiref==0.1.2
|
||||||
|
36
vagrant/Dockerfile
Normal file
36
vagrant/Dockerfile
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
FROM 32bit/ubuntu:14.04
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y \
|
||||||
|
software-properties-common \
|
||||||
|
python-software-properties \
|
||||||
|
|
||||||
|
&& add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty universe" \
|
||||||
|
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y \
|
||||||
|
openssh-server \
|
||||||
|
supervisor
|
||||||
|
|
||||||
|
RUN mkdir -p /var/run/sshd
|
||||||
|
RUN chmod 0755 /var/run/sshd
|
||||||
|
|
||||||
|
# Create and configure vagrant user
|
||||||
|
RUN useradd --create-home -s /bin/bash vagrant
|
||||||
|
WORKDIR /home/vagrant
|
||||||
|
|
||||||
|
# Configure SSH access
|
||||||
|
RUN mkdir -p /home/vagrant/.ssh
|
||||||
|
RUN echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > /home/vagrant/.ssh/authorized_keys
|
||||||
|
RUN chown -R vagrant: /home/vagrant/.ssh
|
||||||
|
RUN echo -n 'vagrant:vagrant' | chpasswd
|
||||||
|
|
||||||
|
# Enable passwordless sudo for the "vagrant" user
|
||||||
|
RUN echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant
|
||||||
|
RUN chmod 0440 /etc/sudoers.d/vagrant
|
||||||
|
|
||||||
|
# Supervisor
|
||||||
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||||
|
|
||||||
|
EXPOSE 22
|
||||||
|
CMD ["/usr/bin/supervisord"]
|
6
vagrant/supervisord.conf
Normal file
6
vagrant/supervisord.conf
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[supervisord]
|
||||||
|
nodaemon=true
|
||||||
|
|
||||||
|
[program:sshd]
|
||||||
|
command=/usr/sbin/sshd -D -o UseDNS=no -o UsePAM=no
|
||||||
|
autostart=true
|
Loading…
Reference in New Issue
Block a user