-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup installation instruction for portal + containerization
- Loading branch information
Showing
6 changed files
with
158 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM nginx:latest | ||
|
||
# Configuration variable for HTTPS (through Let's Encrypt) | ||
ARG HTTPS=false | ||
ENV DOMAIN=organisation.org | ||
ENV [email protected] | ||
|
||
# Use of HTTP & HTTPS ports | ||
EXPOSE 80 | ||
EXPOSE 443 | ||
|
||
# Install dependencies | ||
RUN apt-get update && \ | ||
apt-get install -y wget git | ||
|
||
# Install Quarto | ||
ARG QUARTO_VERSION=1.4.554 | ||
RUN wget https://github.com/quarto-dev/quarto-cli/releases/download/v$QUARTO_VERSION/quarto-$QUARTO_VERSION-linux-amd64.deb && \ | ||
apt install -y ./quarto-$QUARTO_VERSION-linux-amd64.deb && \ | ||
rm quarto-$QUARTO_VERSION-linux-amd64.deb | ||
|
||
# Dependencies to enable HTTPS with Let's Encrypt | ||
RUN if [ "$HTTPS" = "true" ]; then \ | ||
apt-get update && \ | ||
apt-get install -y certbot; \ | ||
fi | ||
|
||
# Use of local sources of the repository to launch the portal | ||
COPY . /usr/share/portal | ||
WORKDIR /usr/share/portal | ||
|
||
RUN quarto render --output-dir html && \ | ||
# Fix of README not used as index by quarto \ | ||
cd html && ln -sf README.html index.html | ||
|
||
ENTRYPOINT ["/usr/share/portal/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
server { | ||
listen 80; | ||
server_name ${DOMAIN}; | ||
|
||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
} | ||
|
||
server { | ||
listen 443 ssl; | ||
server_name ${DOMAIN}; | ||
|
||
# SSL certificate configuration | ||
ssl_certificate /etc/letsencrypt/live/${DOMAIN}/fullchain.pem; | ||
ssl_certificate_key /etc/letsencrypt/live/${DOMAIN}/privkey.pem; | ||
|
||
# Other SSL configuration directives can go here | ||
|
||
# Serve HTTPS content | ||
location / { | ||
root /usr/share/portal/html; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
server { | ||
server_name ${DOMAIN}; | ||
|
||
location / { | ||
root /usr/share/portal/html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
|
||
CONFIG_FILE=open-portal.conf | ||
CONFIG_FOLDER=/usr/share/portal/config | ||
|
||
# Create let's encrypt certificate | ||
if [ "$(command -v certbot)" ] | ||
then | ||
CONFIG_FILE=open-portal-ssl.conf | ||
# Use --test-cert to avoid real certificate | ||
certbot certonly --standalone --test-cert -d $DOMAIN -m $MAIL --agree-tos -n | ||
fi | ||
|
||
# Set up configuration file | ||
envsubst '${DOMAIN}' < $CONFIG_FOLDER/$CONFIG_FILE > /etc/nginx/conf.d/default.conf | ||
|
||
nginx -g "daemon off;" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Portal Installation | ||
|
||
You can build your own open portal to bring together the open resources you use or want to provide. This guide will help | ||
you set up a portal locally or for a website. | ||
|
||
## Dependencies | ||
|
||
The website is rendered by Quarto, first follow their [installation instructions](https://quarto.org/docs/get-started/) for your device. | ||
|
||
**Using Linux (Debian)**: | ||
```bash | ||
# Basic apt dependencies | ||
sudo apt update | ||
sudo apt install git | ||
|
||
# Install Quarto | ||
VERSION=1.4.554 | ||
|
||
wget https://github.com/quarto-dev/quarto-cli/releases/download/v$VERSION/quarto-$VERSION-linux-amd64.deb | ||
sudo apt install ./quarto-$VERSION-linux-amd64.deb | ||
``` | ||
|
||
## Local Portal | ||
|
||
Use the following steps to download and start the portal locally. | ||
|
||
```bash | ||
# Download portal repository | ||
git clone https://github.com/Open-Models/Open-Portal.git | ||
|
||
# Go into the repository folder | ||
cd Open-Portal | ||
|
||
# Render html website (generated in the _site folder) | ||
quarto render | ||
``` | ||
|
||
The portal can be then published with any web server. The command `quarto preview` can be used to display the website locally. | ||
|
||
> **Warning**: Quarto do not use `README.md` files by default as `index.html` (see | ||
> [quarto-dev/quarto-cli#1615](https://github.com/quarto-dev/quarto-cli/issues/1615), | ||
> for now you can fix the home page with the following command: `rm index.html && ln -s README.html index.html` | ||
## Using Docker | ||
|
||
The portal can be installed using docker containers. If needed, see installation instructions from [Docker | ||
website](https://docs.docker.com/engine/install/). | ||
|
||
**Steps to launch the portal:** | ||
```bash | ||
git clone https://github.com/Open-Models/Open-Portal | ||
cd Open-Portal | ||
|
||
sudo docker build -t portal-image . | ||
sudo docker run --name portal -p 80:80 portal-image | ||
``` | ||
|
||
The portal is created using sources of the local repository. | ||
|
||
**To initiate a portal served under https:** | ||
```bash | ||
sudo docker build --build-arg HTTPS=true -t portal-image . | ||
sudo docker run -e DOMAIN=portal.organisation.org -e [email protected] -p 80:80 -p 443:443 portal-image | ||
``` | ||
|
||
`HTTPS`, `DOMAIN` & `MAIL` variables are required to obtain an SSL certificate using let's encrypt. |