Skip to content

Commit

Permalink
Atualizações para rodar no Ubuntu 24.04. Adicionado Dockerfile para f…
Browse files Browse the repository at this point in the history
…acilitar execução (#300)

* Atualizações para rodar no Ubuntu 24.04. Adicionado Dockerfile para facilitar a configuração

* Adicionando as altearações do README
  • Loading branch information
lskbr committed Sep 14, 2024
1 parent 2fa97a7 commit 4338f0d
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 10 deletions.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM ubuntu:24.04

RUN mkdir -p /home/wiki
COPY . /home/wiki
WORKDIR /home/wiki
RUN bash install_os_dependencies.sh install
RUN python3 -m venv /opt/venv
RUN /opt/venv/bin/python3 -m pip install -r requirements.txt
ENV PATH="/opt/venv/bin:$PATH"
CMD ["/bin/bash", "develop_server.sh", "docker_start"]
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ Resta então fazer o commit de suas alterações em seu repositório local e env

Mais informações sobre como funciona o Pelican, indicamos o artigo - [http://mindbending.org/pt/instalando-o-pelican](http://mindbending.org/pt/instalando-o-pelican).

Se você quiser gerar o site automaticamente a cada alteração, utilize:

```
$ make devserver
```

Caso queira contribuir com o tema é preciso ter o node instalado em sua máquina. Sua instalação é bem direta e pode ser obtida em:

[https://nodejs.org/en/download/](https://nodejs.org/en/download/)
Expand All @@ -178,3 +184,20 @@ E caso queira rodar sem o live reload, somente para gerar o css para publicaçã
```
$ npm run gulp build
```

#### Rodando com Docker

Criando a imagem:
```
docker build -t wiki .
```

Rodando:
```
docker run --rm -t -i -p 8000:8000 -v .:/home/wiki --name pelican wiki
```

Parando a imagem:
```
docker stop pelican
```
14 changes: 12 additions & 2 deletions develop_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
##
# This section should match your Makefile
##

PY=${PY:-python}
PELICAN=${PELICAN:-pelican}
PELICANOPTS=
Expand All @@ -19,7 +20,7 @@ SRV_PID=$BASEDIR/srv.pid
PELICAN_PID=$BASEDIR/pelican.pid

function usage(){
echo "usage: $0 (stop) (start) (restart) [port]"
echo "usage: $0 (stop) (start) (restart) (docker_start) [port]"
echo "This starts Pelican in debug and reload mode and then launches"
echo "an HTTP server to help site development. It doesn't read"
echo "your Pelican settings, so if you edit any paths in your Makefile"
Expand Down Expand Up @@ -67,11 +68,14 @@ function start_up(){
pelican_pid=$!
echo $pelican_pid > $PELICAN_PID
mkdir -p $OUTPUTDIR && cd $OUTPUTDIR
$PY -m pelican.server $port &
$PY -m pelican --listen $port &

srv_pid=$!
echo $srv_pid > $SRV_PID
cd $BASEDIR

sleep 1

if ! alive $pelican_pid ; then
echo "Pelican didn't start. Is the Pelican package installed?"
return 1
Expand All @@ -82,6 +86,10 @@ function start_up(){
echo 'Pelican and HTTP server processes now running in background.'
}

function docker_start(){
$PELICAN --debug --autoreload -r $INPUTDIR -o $OUTPUTDIR -s $CONFFILE $PELICANOPTS -l -b 0.0.0.0 -D
}

###
# MAIN
###
Expand All @@ -98,6 +106,8 @@ elif [[ $1 == "start" ]]; then
if ! start_up $port; then
shut_down
fi
elif [[ $1 == "docker_start" ]]; then
docker_start
else
usage
fi
8 changes: 4 additions & 4 deletions install_os_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ function list_packages(){

function install()
{
list_packages | xargs apt-get --no-upgrade install -y;
list_packages | xargs apt --no-upgrade install -y;
}

function upgrade()
{
list_packages | xargs apt-get install -y;
list_packages | xargs apt install -y;
}


Expand All @@ -52,7 +52,7 @@ function install_or_upgrade()
exit 1
else

apt-get update
apt update

# Install the basic compilation dependencies and other required libraries of this project
if [ "$PARAN" == "install" ]; then
Expand All @@ -62,7 +62,7 @@ function install_or_upgrade()
fi

# cleaning downloaded packages from apt-get cache
apt-get clean
apt clean

exit 0
fi
Expand Down
9 changes: 6 additions & 3 deletions requirements.apt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# listar as dependencias nao python aqui (Ubuntu 14.04 de preferencia)
python-dev
python3-dev
python-is-python3
python3-pip
python3-venv
build-essential

# lxml dependencies
Expand All @@ -8,10 +11,10 @@ libxml2-dev

## Pillow dependencies
zlib1g-dev
libtiff4-dev
libtiff-dev
libjpeg8-dev
libfreetype6-dev
liblcms1-dev
#liblcms1-dev
libwebp-dev

#cryptography dependecies
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ paramiko
pelican==4.7.1
pelican-alias==1.1
pillow
pycrypto
pycryptodome
pygments
python-dateutil
pytz
Expand Down

0 comments on commit 4338f0d

Please sign in to comment.