Skip to content

Commit

Permalink
Develop with Docker and build with 2.0
Browse files Browse the repository at this point in the history
This adds support for developing locally with docker-compose.
Readme files have been update and references to Vagrant removed.
Initial support for building and testing using CircleCI 2.0 is
included and 1.0 config has been removed.
  • Loading branch information
keybits committed May 18, 2017
1 parent 9ca9d08 commit 979e908
Show file tree
Hide file tree
Showing 14 changed files with 119 additions and 193 deletions.
57 changes: 57 additions & 0 deletions .circleci/config.yml
@@ -0,0 +1,57 @@
version: 2
jobs:
build:
docker:
- image: circleci/ruby:2.3.3
working_directory: ~/circleci-docs
environment:
- JEKYLL_ENV=production
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
- JOB_RESULTS_PATH=run-results
steps:
- checkout
- restore_cache:
key: circleci-docs-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
- run:
name: Install essential packages for awscli
command: sudo apt-get update && sudo apt-get install python-dev
- run:
name: Install awscli
command: wget https://bootstrap.pypa.io/get-pip.py && sudo python get-pip.py && pip install --upgrade --user awscli
- run:
name: Install Ruby dependencies
command: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3
- save_cache:
key: circleci-docs-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
paths:
- "vendor/bundle"
- run:
name: Create results directory
command: mkdir -p $JOB_RESULTS_PATH
- run:
name: Expose version files
command: |
# cp jekyll/_data/trusty/versions.json jekyll/environments/trusty.json
cp jekyll/_data/trusty/versions-ubuntu-14_04-XXL.json jekyll/environments/ubuntu-14.04-XXL.json
cp jekyll/_data/trusty/versions-ubuntu-14.04-XL.json jekyll/environments/ubuntu-14.04-XL.json
cp jekyll/_data/trusty/versions-ubuntu-14.04-XL.json jekyll/environments/ubuntu-14.04-XXL-upstart.json
- run:
name: Build the Jekyll site
command: bundle exec jekyll build --config jekyll/_config.yml,jekyll/_config_production.yml --source jekyll --destination jekyll/_site/docs/ 2>&1 | tee $JOB_RESULTS_PATH/build-results.txt
- run:
name: Test with HTMLproofer
command: bundle exec htmlproofer jekyll/_site --allow-hash-href --check-favicon --check-html --disable-external --empty-alt-ignore | tee $JOB_RESULTS_PATH/htmlproofer-results.txt
- store_artifacts:
path: jekyll/_site/docs/
destination: circleci-docs
- store_artifacts:
path: run-results/
destination: run-results
- deploy:
name: Deploy to S3 if tests pass and branch is Master
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
aws s3 sync jekyll/_site/docs s3://circle-production-static-site/docs/ --delete
else
echo "Not master branch so not deploying"
fi
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,4 +1,6 @@
_site/
run-results/
jekyll/environments/
.sass-cache/
.jekyll-metadata
.vagrant/
Expand Down
8 changes: 2 additions & 6 deletions CONTRIBUTING.md
Expand Up @@ -16,9 +16,7 @@ If a doc is unclear or incorrect, you can open an issue by clicking **Open an is

For minor changes like typos, you can click **Edit the file in your fork of this project**, located at the right of each article. This will take you to the source file on GitHub, where you can submit a pull request for your change through the UI.

For larger edits or new articles, you'll want to set up a local environment for editing. You'll need to [fork this repository](https://github.com/circleci/circleci-docs#fork-destination-box), clone the fork to your machine, then choose how to set up your local environment.

If you already have a stable Ruby environment and feel comfortable installing dependencies, follow our [Jekyll guide](README-Jekyll). Otherwise, you can follow our [Vagrant guide](README-Vagrant) to set up a clean environment with all the project's neccessary dependencies.
For larger edits or new articles, you'll want to set up a local environment for editing. Please see our [Local Development README](README-local-development.md) to set that up.

Come back here when you're ready to start editing!

Expand All @@ -32,9 +30,7 @@ All docs live in folders named after the version of CircleCI. The only two you n

2. Add or modify the Markdown files in these directories according to the [style guide](#style-guide) below.

If you installed Jekyll and ran `jekyll serve -Iw`, then the server should watch for changes and automatically rebuild.

If you're using Vagrant, then rebuild the site using `./jctl rebuild`. For more detailed instructions on using `jctl`, see [Jekyll Controller Commands](#jekyll-controller-commands).
If you installed Jekyll with Docker or ran `jekyll serve -Iw`, then the server should watch for changes and automatically rebuild.

3. When you're happy with your changes, commit them with a message summarizing what you did:

Expand Down
6 changes: 3 additions & 3 deletions Gemfile
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

ruby '2.3.1'
ruby '2.3.3'

gem 'jekyll'
gem 'html-proofer'
gem 'jekyll', "~> 3.4.0"
gem 'html-proofer', "~> 3.6.0"
8 changes: 4 additions & 4 deletions Gemfile.lock
@@ -1,7 +1,7 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (5.1.0)
activesupport (5.1.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7)
minitest (~> 5.1)
Expand Down Expand Up @@ -71,11 +71,11 @@ PLATFORMS
ruby

DEPENDENCIES
html-proofer
jekyll
html-proofer (~> 3.6.0)
jekyll (~> 3.4.0)

RUBY VERSION
ruby 2.3.1p112
ruby 2.3.3p222

BUNDLED WITH
1.14.6
26 changes: 0 additions & 26 deletions README-Jekyll.md

This file was deleted.

52 changes: 0 additions & 52 deletions README-Vagrant.md

This file was deleted.

43 changes: 43 additions & 0 deletions README-local-development.md
@@ -0,0 +1,43 @@
# 1. Local Development with Docker (recommended)

The recommended way to work on the CircleCI docs locally is to use Docker.

1. Install Docker for you platform: <https://docs.docker.com/engine/installation/>
2. Clone the CircleCI docs repo: `git clone https://github.com/circleci/circleci-docs.git`
3. `cd` into the directory where you cloned the docs
4. run `docker-compose up`
5. The docs site will now be running on <http://localhost:4000/docs/>

**Note:** If you want to submit a pull request to update the docs, you'll need to [make a fork](https://github.com/circleci/circleci-docs#fork-destination-box) of this repo and clone your version in step 2 above. Then when you push your changes to your fork you can submit a pull request to us.

## Editing and Contributing

Now that you have a working local environment, please follow our [Contributing Guide](CONTRIBUTING.md) to make and submit changes.

# 2. Local Development with Ruby and Bundler (alternative to Docker)

If you already have a stable Ruby environment (currently Ruby 2.3.3) and feel comfortable installing dependencies, install Jekyll by following [this guide](https://jekyllrb.com/docs/installation/).

Check out the [Gemfile](Gemfile) for the Ruby version we're currently using. We recommend [RVM](https://rvm.io/) for managing multiple Ruby versions.

We also use a gem called [HTMLProofer](https://github.com/gjtorikian/html-proofer) to test links, images, and HTML. The docs site will need a passing build to be deployed, so use HTMLProofer to test everything before you push changes to GitHub.

You're welcome to use [Bundler](http://bundler.io/) to install these gems.

## First Run

To get a local copy of our docs, run the following commands:

```bash
git clone https://github.com/circleci/circleci-docs.git
cd circleci-docs/jekyll
jekyll serve -Iw
```

Jekyll will build the site and start a web server, which can be viewed in your browser at <http://localhost:4000/docs/>. `-w` tells Jekyll to watch for changes and rebuild, while `-I` enables an incremental rebuild to keep things efficient.

For more info on how to use Jekyll, check out [their docs](https://jekyllrb.com/docs/usage/).

## Editing and Contributing

Now that you have a working local environment, please follow our [Contributing Guide](CONTRIBUTING.md) to make and submit changes.
4 changes: 1 addition & 3 deletions README.md
Expand Up @@ -4,9 +4,7 @@ This is the public repository for <https://circleci.com/docs/>, a static website

For minor changes like typos, you can click **Suggest an edit to this page**, located at the bottom of each article. This will take you to the source file on GitHub, where you can submit a pull request for your change through the UI.

For larger edits or new articles, you'll want to set up a local environment for editing. You'll need to [fork this repository](https://github.com/circleci/circleci-docs#fork-destination-box), clone the fork to your machine, then choose how to set up your local environment.

If you already have a stable Ruby environment and feel comfortable installing dependencies, follow our [Jekyll guide](README-Jekyll.md). Otherwise, you can follow our [Vagrant guide](README-Vagrant.md) to set up a clean environment with all the project's neccessary dependencies.
For larger edits or new articles, you'll want to set up a local environment for editing. Please see our [Local Development README](README-local-development.md) to set that up.

If you have a question or need help debugging, please head to [CircleCI Discuss](https://discuss.circleci.com/) where our support team will help you out.

Expand Down
10 changes: 0 additions & 10 deletions Vagrantfile

This file was deleted.

13 changes: 0 additions & 13 deletions bootstrap.sh

This file was deleted.

26 changes: 0 additions & 26 deletions circle.yml

This file was deleted.

7 changes: 7 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,7 @@
jekyll:
image: jekyll/jekyll:3.4
command: jekyll serve --watch --incremental
ports:
- 4000:4000
volumes:
- ./jekyll:/srv/jekyll
50 changes: 0 additions & 50 deletions jctl

This file was deleted.

0 comments on commit 979e908

Please sign in to comment.