From bff1571b4ea8896dc4f1eb30809940aea8ee406b Mon Sep 17 00:00:00 2001 From: Marvin Steadfast Date: Mon, 13 Mar 2017 10:19:01 +0000 Subject: [PATCH] got rid of vagrant. using docker itself for writingenv --- .gitignore | 2 -- .gitmodules | 3 ++ Makefile | 6 +++- _nb_header.html | 4 +++ docker-compose.yml | 15 ++++++++++ pelican-plugins | 1 + vagrant/Dockerfile | 29 ------------------- vagrant/supervisord.conf | 6 ---- writing_env/Dockerfile | 28 ++++++++++++++++++ .../blog/playbooks}/files/flickr2markdown | 0 .../root/home/blog/playbooks/writing_env.yml | 27 ++--------------- 11 files changed, 58 insertions(+), 63 deletions(-) create mode 100644 .gitmodules create mode 100644 docker-compose.yml create mode 160000 pelican-plugins delete mode 100644 vagrant/Dockerfile delete mode 100644 vagrant/supervisord.conf create mode 100644 writing_env/Dockerfile rename {ansible => writing_env/root/home/blog/playbooks}/files/flickr2markdown (100%) rename ansible/vagrant.yml => writing_env/root/home/blog/playbooks/writing_env.yml (82%) diff --git a/.gitignore b/.gitignore index f9435f8..d3838e2 100644 --- a/.gitignore +++ b/.gitignore @@ -46,8 +46,6 @@ nosetests.xml # OWN STUFF .ftp_pass.txt -.vagrant/* -pelican-plugins .DS_Store node_modules *.retry diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..14fe141 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "pelican-plugins"] + path = pelican-plugins + url = git@github.com:xsteadfastx/pelican-plugins.git diff --git a/Makefile b/Makefile index fcb5e7b..5481196 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,7 @@ help: @echo ' make cf_upload upload the web site via Cloud Files' @echo ' make github upload the web site via gh-pages ' @echo ' make newpost create new post ' + @echo ' make writingenv start writing environment ' @echo ' ' @echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html' @echo ' ' @@ -116,4 +117,7 @@ github: publish newpost: $(PY) $(BASEDIR)/newpost.py -.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github +writingenv: + docker-compose run --rm blog /bin/zsh + +.PHONY: html help clean regenerate serve devserver publish ssh_upload rsync_upload dropbox_upload ftp_upload s3_upload cf_upload github newpost writingenv diff --git a/_nb_header.html b/_nb_header.html index e663f22..f3aad65 100644 --- a/_nb_header.html +++ b/_nb_header.html @@ -1593,8 +1593,10 @@ span#checkpoint_status,span#autosave_status{font-size:small} .highlight .mh { color: #666666 } /* Literal.Number.Hex */ .highlight .mi { color: #666666 } /* Literal.Number.Integer */ .highlight .mo { color: #666666 } /* Literal.Number.Oct */ +.highlight .sa { color: #BA2121 } /* Literal.String.Affix */ .highlight .sb { color: #BA2121 } /* Literal.String.Backtick */ .highlight .sc { color: #BA2121 } /* Literal.String.Char */ +.highlight .dl { color: #BA2121 } /* Literal.String.Delimiter */ .highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */ .highlight .s2 { color: #BA2121 } /* Literal.String.Double */ .highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ @@ -1605,9 +1607,11 @@ span#checkpoint_status,span#autosave_status{font-size:small} .highlight .s1 { color: #BA2121 } /* Literal.String.Single */ .highlight .ss { color: #19177C } /* Literal.String.Symbol */ .highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */ +.highlight .fm { color: #0000FF } /* Name.Function.Magic */ .highlight .vc { color: #19177C } /* Name.Variable.Class */ .highlight .vg { color: #19177C } /* Name.Variable.Global */ .highlight .vi { color: #19177C } /* Name.Variable.Instance */ +.highlight .vm { color: #19177C } /* Name.Variable.Magic */ .highlight .il { color: #666666 } /* Literal.Number.Integer.Long */ diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..f96fc08 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3' +services: + blog: + build: + context: writing_env/ + container_name: blog + environment: + - BLOG_UID=1000 + - BLOG_GID=1000 + volumes: + - $PWD:/blog + - $HOME/.ssh:/home/blog/.ssh + stdin_open: true + tty: true + command: /bin/true diff --git a/pelican-plugins b/pelican-plugins new file mode 160000 index 0000000..6dbc683 --- /dev/null +++ b/pelican-plugins @@ -0,0 +1 @@ +Subproject commit 6dbc6833bcb6e53f4af04e46848c860bf467e77e diff --git a/vagrant/Dockerfile b/vagrant/Dockerfile deleted file mode 100644 index ebd8801..0000000 --- a/vagrant/Dockerfile +++ /dev/null @@ -1,29 +0,0 @@ -FROM alpine:3.5 - -ENV SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt - -RUN apk add --update \ - bash \ - openssh \ - python \ - sudo \ - && rm -rf /var/cache/apk/* - -# create ssh keys -RUN ssh-keygen -A - -# add vagrant user -RUN adduser -h /home/vagrant -s /bin/sh -D vagrant - -# configure SSH access -RUN mkdir -p /home/vagrant/.ssh \ - && echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > /home/vagrant/.ssh/authorized_keys \ - && chown -R vagrant: /home/vagrant/.ssh \ - && echo -n 'vagrant:vagrant' | chpasswd - -# enable passwordless sudo for the "vagrant" user -RUN echo 'vagrant ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/vagrant \ - && chmod 0440 /etc/sudoers.d/vagrant - -EXPOSE 22 -CMD ["/usr/sbin/sshd", "-D", "-o", "UseDNS=no", "-o", "UsePAM=no"] diff --git a/vagrant/supervisord.conf b/vagrant/supervisord.conf deleted file mode 100644 index 0b1f2bf..0000000 --- a/vagrant/supervisord.conf +++ /dev/null @@ -1,6 +0,0 @@ -[supervisord] -nodaemon=true - -[program:sshd] -command=/usr/sbin/sshd -D -o UseDNS=no -o UsePAM=no -autostart=true diff --git a/writing_env/Dockerfile b/writing_env/Dockerfile new file mode 100644 index 0000000..39d2b61 --- /dev/null +++ b/writing_env/Dockerfile @@ -0,0 +1,28 @@ +FROM alpine:3.5 + +ENV SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt +ENV BLOG_UID=1000 BLOG_GID=1000 + +ADD root / + +RUN set -ex \ + && apk add --no-cache \ + ansible \ + bash \ + g++ \ + openssh \ + python \ + sudo \ + && addgroup -g $BLOG_GID blog \ + && adduser -h /home/blog -D -s /bin/sh -G blog blog \ + && echo 'blog ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/blog \ + && chmod 0440 /etc/sudoers.d/blog \ + && chown -R $BLOG_UID:$BLOG_GID /home/blog + +USER blog + +RUN set -ex \ + && ansible-playbook -c local /home/blog/playbooks/writing_env.yml \ + && /bin/zsh -c "source /home/blog/.zshrc && antigen update" + +ENTRYPOINT ["/usr/local/bin/entrypoint"] diff --git a/ansible/files/flickr2markdown b/writing_env/root/home/blog/playbooks/files/flickr2markdown similarity index 100% rename from ansible/files/flickr2markdown rename to writing_env/root/home/blog/playbooks/files/flickr2markdown diff --git a/ansible/vagrant.yml b/writing_env/root/home/blog/playbooks/writing_env.yml similarity index 82% rename from ansible/vagrant.yml rename to writing_env/root/home/blog/playbooks/writing_env.yml index adb42ff..b561b91 100644 --- a/ansible/vagrant.yml +++ b/writing_env/root/home/blog/playbooks/writing_env.yml @@ -1,6 +1,6 @@ # vim:ft=ansible --- -- hosts: all +- hosts: localhost tasks: @@ -15,7 +15,7 @@ - ca-certificates - coreutils - curl - - g++ + #- g++ - gcc - git - grep @@ -60,12 +60,6 @@ src=flickr2markdown dest=~/.flickr2markdown - - name: clone pelican-plugins - git: - repo=git@github.com:xsteadfastx/pelican-plugins.git - dest=/vagrant/pelican-plugins - accept_hostkey=yes - - name: install js packages npm: name={{ item }} @@ -114,20 +108,3 @@ - name: no git colors command: git config --global color.ui false - - - name: remove some deps - apk: - name={{ item }} - state=absent - with_items: - - gcc - - g++ - - musl-dev - - python3-dev - become: yes - - - name: remove ansible - file: - path=~/ansible - state=absent -