Skip to content

Contributing Setup

Andrew Berezovskyi edited this page Jan 30, 2020 · 13 revisions

Introduction

To make content changes to the site, you will need to edit or add new static files to the oslc-site-hugo repository. Right now we don't have a guide for how the content is structured, that will follow.

Environment

How to setup your environment to contribute to this OSLC site prototype.

We are using the following technologies:

  • Hugo static site generator
  • git / Github
  • Github pages

Hugo / Github Pages integration is explained in this article:

https://gohugo.io/tutorials/github-pages-blog/

The approach we are using is outlined in the second half of the page under the heading 'Hosting Personal/Organization Pages'. This page pulls out the relevant parts and adds further explanation. The repositories are already setup, so we'll just straight in how to use them.

Platform Note

These instructions are for macOS, so might vary a little on other platforms. All commands are Terminal / command line commands, unless otherwise stated.

Repositories Note

If you are not an approved contributor to these repositories, you will need to replace the urls with the urls of your fork of the repositories.

Code and Content Setup

  • Get the static content
    • git clone git@github.com:OSLC/oslc-site-hugo.git && cd oslc-site-hugo
    • If it is a fork, you will need to clone that repository instead
  • Make your website work locally.
  • Once you are happy with the results, Ctrl+C (kill server) then if you want to see your changes live check the deployment section bellow

Style updates

npm install -g sass
cd themes/oslc/static/css
sass scss/oslc.scss:./oslc.css

Making and Testing Changes

  • After making changes, you can test them locally.

Checkins / Pull Requests

Contribution guidelines to come...

  • To check in changes to the static content, just do as you usually would from the oslc-site-hugo directory (git add, commit, ...).
  • If it is a fork, make a pull request.

Deployment

To oslc.co

First time

  • Login to server
ssh -A root@165.227.5.255
  • Go to the directory where the website will be hosted
cd ../var/www
  • Clone the repository with the static files
git clone git@github.com:OSLC/oslc.github.io.git
  • Add site file to NGINX sites-enabled directory
cd /etc/nginx/sites-enabled
vim oslc.co
  • Add config to file
server {
  listen 80;listen [::]:80;
  server_name oslc.co;

  location / {
    root /var/www/oslc.co;
    index index.html index.php;
  }
}
  • Restart NGINX
service nginx restart
  • Log out of the server
exit

Update production

  • Change to production branch
git checkout production
  • Pull changes from master
git pull origin master
  • generate hugo site
hugo -b https://open-services.net/ -t oslc
  • Add and push changes to reposotiry
git add *
git commit -m 'YOUR MESSAGE'
git push origin production
  • Login to the server
ssh -A root@165.227.5.255
  • go to the site directory
cd ../var/www/oslc.co
  • Make sure you are in the production branch
git status

if not on production

git checkout production
  • Pull the changes
git pull origin production
  • Log out of the server
exit
  • Regenerate the site index for search (Currently inactive)
cd static-src
node site.js
cd ..

Happy Hacking!