Skip to content

Commit

Permalink
Merge branch 'fabio' into 'master'
Browse files Browse the repository at this point in the history
Fabio

See merge request brigaud/sw-lsst-eu!1
  • Loading branch information
Fabio Hernandez committed May 18, 2018
2 parents 7a99e0c + 6d12de6 commit 647e9e8
Show file tree
Hide file tree
Showing 30 changed files with 1,174 additions and 112 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
docs/_build
docs/_static
docs/_templates
utils/
26 changes: 26 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM centos:centos7

#
# Install 'fpm' dependencies
#
RUN yum install -q -y ruby-devel gcc make rpm-build rubygems

#
# Install 'fpm'
#
RUN gem install --no-ri --no-rdoc fpm

#
# Create non-privileged user
#
ENV username="lsstsw"
RUN useradd --create-home --uid 1000 --user-group --home-dir /home/${username} ${username}

#
# Add files needed to build the packages
#
WORKDIR /home/${username}
ADD ["buildLinuxPkg.sh", "version.sh", "./"]
ADD ["etc/", "./etc/"]

ENTRYPOINT /home/${username}/buildLinuxPkg.sh
13 changes: 13 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2018 Fabio Hernandez

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
UNAME := $(shell uname)

.PHONY: all

all:
@echo "Usage: make <pkg | test | clean>"


pkg:
ifeq ($(UNAME), Linux)
docker build -t airnandez/sw-lsst-eu .
docker run -it --mount type=bind,source=`pwd`,destination=/scratch --env SCRATCH=/scratch airnandez/sw-lsst-eu
else
bash buildMacOSPkg.sh
endif


test:
ifeq ($(UNAME), Linux)
docker run -it --entrypoint /bin/bash airnandez/sw-lsst-eu
endif


clean:
@rm -f ./*.deb ./*.rpm
119 changes: 15 additions & 104 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,111 +1,22 @@
LSST FRANCE DOCUMENTATION
=========================
# Cloud-based delivery of the LSST science pipelines software

<br />
## Overview
This repository contains documentation and tools on how to get the [Large Synoptic Survey Telescope (LSST) science pipelines](https://pipelines.lsst.io) software delivered to your personal computer on demand.

Introduction
----------
***
All the details available at [https://sw.lsst.eu](https://sw.lsst.eu).

This repository contains LSST documentation sources (reStructuredText file format).
Updating content on this repository automatically generates and publishes online documentation.
## License

<br />
Copyright 2018 Fabio Hernandez

Goals
----------
***
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

- Manage collaboration between LSST documention's authors
- Generate & Publish LSST Documentation
[http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)

<br />

Workflow
----------
***

Each author works on his own branch and can see a preview at every push.
Once the author is satisfied, he can merge his branch with the master branch.
The merge in master generates and publishes the official version.
This repository only contains source documentation (.rst files).
Authors must write documentation respecting this format.
More info on the reStructuredText (rst) file format: https://en.wikipedia.org/wiki/ReStructuredText

![LSST France Software Doc Diagram](lsst-france-sw-diagram.png "LSST France Software Doc Diagram")

### master branch is the official doc that is pushed online at http://sw.lsst.eu/.
### Documentation generation and uploading is fully automated.

<br />

Instructions
----------
***

**Step1**: clone the repo and create your own branch from master

```bash
git clone [email protected]:brigaud/sw-lsst-eu.git
cd sw-lsst-eu
git checkout -b <yourbranch>
```

**Step2**: create/modify your doc in your branch then push it

```bash
git add --all
git commit -m "your changes comments"
git push
```
... wait about a minute and check it out at http://sw.lsst.eu/preview/\<yourbranch\>.

<br />

> **Note:**
> - Each push on your branch will generate a documentation at http://sw.lsst.eu/preview/\<yourbranch\>
> - Useful for preview.
<br />

**Step3**: send a merge request to master branch to put documentation in production
<br /><br />
https://gitlab.in2p3.fr/brigaud/sw-lsst-eu/merge_requests/new?merge_request%5Bsource_branch%5D=\<yourbranch\>
<br /><br />
An administrator will check your version, fix conflicts and finally merge your branch into master branch.<br />
This merge will automatically trigger the build process and update the official documentation at http://sw.lsst.eu/.

<br />

> **Note:**
> - Each merge on master branch will generate a documentation at http://sw.lsst.eu
<br />

> **Important**:
> - Each time master builds a new official doc, preview folder (i.e http://sw.lsst.eu/preview) is deleted
<br />

Recommandations
--------------------
***

All the documentation resides in the "docs" folder.
You can create or delete files and folders in order to create your documentation.
Be sure to update the index.rst file in case you add or delete documentation files or folders in order to access it from the sidebar menu on the website.

<br />

> **Note:**
> - As a community project, it is recommended to work only on parts you've been assigned
> - Keep as much as possible the original tree structure
> - Keep as much as possible your branch up-to-date with respect to master branch (i.e git rebase master <yourbranch>)
<br />

Happy doc!
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
51 changes: 51 additions & 0 deletions buildLinuxPkg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

#
# Import version
#
source 'version.sh'
version=$(pkgVersion)

#
# Package name
#
packageName="cvmfs-config-lsst"

#
# Prepare the output directory
#
outputDir=${SCRATCH:-/tmp}
mkdir -p ${outputDir}

#
# Clean up first
#
rm -f ${outputDir}/${packageName}*.{rpm,deb}

#
# Build RPM and DEB packages
#
for out in rpm deb; do
fpm --name ${packageName} \
--version ${version} \
--depends cvmfs \
--description "Configuration files for CernVM-FS file system /cvmfs/sw.lsst.eu" \
--maintainer "Fabio Hernandez ([email protected])" \
--url "https://sw.lsst.eu" \
--license "Apache v2.0" \
--vendor "CNRS / IN2P3 computing center (CC-IN2P3)" \
--architecture all \
--output-type ${out} \
--input-type dir \
--package ${outputDir} \
--config-files ./etc \
./etc
done

#
# Set file ownership, if necessary
#
userName="lsstsw"
if getent passwd ${userName} > /dev/null 2>&1; then
chown ${userName}:${userName} ${outputDir}/${packageName}*.{rpm,deb}
fi
27 changes: 27 additions & 0 deletions buildMacOSPkg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

#
# Import version
#
source 'version.sh'
version=$(pkgVersion)

#
# Package id
#
packageId="eu.lsst.sw.cvmfs.config"

#
# Package file name
#
packageFileName="sw-lsst-eu-cvmfs-config_${version}.pkg"

#
# Build the package
#
sudo pkgbuild \
--root ./etc \
--identifier ${packageId} \
--version ${version} \
--install-location /etc \
${packageFileName}
37 changes: 37 additions & 0 deletions check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

#
# Usage: bash check.sh
#
# Purpose: test the reachability from this host of the configured HTTP servers
# for CernVM-FS software repository 'sw.lsst.eu', via the configured proxies
#

if [[ ! -f /etc/cvmfs/domain.d/lsst.eu.conf ]]; then
echo "file /etc/cvmfs/domain.d/lsst.eu.conf could not be found"
exit 1
fi

curlCmd=$(command -v curl)
if [[ -z ${curlCmd} ]]; then
echo "command curl not found"
exit 1
fi

source /etc/cvmfs/domain.d/lsst.eu.conf

urls=`echo ${CVMFS_SERVER_URL} | sed -e 's/;/ /g' -e 's|@fqrn@|sw.lsst.eu/.cvmfspublished|g'`
proxies=`echo ${CVMFS_HTTP_PROXY} | sed -e 's/|/ /g' -e 's/;/ /g'`

rc=0
for u in ${urls}; do
for p in ${proxies}; do
ok=`${curlCmd} --silent --head --proxy ${p} ${u} | grep "HTTP/1.1 200 OK"`
if [[ -z ${ok} ]]; then
echo "HTTP HEAD request for $u via proxy $p failed"
rc=1
fi
done
done

exit $rc
66 changes: 66 additions & 0 deletions configure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

#
# Usage: sudo bash configure.sh
#
# This script configures a CernVM FS client to access the
# LSST software repository /cvmfs/sw.lsst.eu. The CernVM-FS
# client software must be previously installed.
#

usage() {
echo "Usage: sudo bash configure.sh"
}

#
# We must run as 'root'
#
if [[ $EUID -ne 0 ]]; then
usage
exit 1
fi

#
# Execute 'cvmfs_config setup'
#
cvmfscfg=$(command -v cvmfs_config)
if [[ -z ${cvmfscfg} ]] || [[ ! -x ${cvmfscfg} ]]; then
echo "Could not find CernVM FS configuration command 'cvmfs_config'"
exit 1
fi
${cvmfscfg} setup
if [ $? -ne 0 ]; then
exit 1
fi

#
# Copy configuration files to their destination under
# /etc/cvmfs
#
srcDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
destDir='/'
toInstall="etc/cvmfs/domain.d etc/cvmfs/keys/lsst.eu"
for dir in ${toInstall}; do
dest=$(readlink -m ${destDir}/${dir})
install -d ${dest}
install --backup --compare --mode=u=r,g=r,o=r -D ${srcDir}/${dir}/* ${dest}
done

#
# Perform system-specific tasks
#
thisOS=`uname`
if [ "$thisOS" == "Linux" ]; then
# Use 'cvmfs_config' to check the configuration
result=`${cvmfscfg} chksetup`
if [ "$result" != "OK" ]; then
echo "There was an error checking your CernVM FS configuration:"
echo $result
exit 1
fi
elif [ "$thisOS" == "Darwin" ]; then
# On MacOS X, create the mount directory
mkdir -p /cvmfs/sw.lsst.eu
fi

exit 0
Loading

0 comments on commit 647e9e8

Please sign in to comment.