Skip to content

Add install sh#877

Open
patymori wants to merge 4 commits intomainfrom
add-install-sh
Open

Add install sh#877
patymori wants to merge 4 commits intomainfrom
add-install-sh

Conversation

@patymori
Copy link
Collaborator

O que esse PR faz?

Automatiza os passos da instalação descritos no documento https://github.com/scieloorg/opac_5/wiki/Upload-application-installation e de atualização descritos em https://github.com/scieloorg/opac_5/wiki/How-to-update-opac_5-and-upload#how-to-update-upload. Após script encorporado, o documento será atualizado para a execução do script.

Onde a revisão poderia começar?

Em install.sh

Como este poderia ser testado manualmente?

Para a instalação
  1. Baixar o script install.sh em um diretório vazio, onde o diretório da aplicação será criado
  2. Alterar o chmod do script para que seja executável: chmod +x install.sh
  3. Executar script com a versão a ser instalada: ./install.sh v2.11.9
  4. O resultado final é ter os conteineres do Upload rodando com a versão instalada
Para a atualização
  1. Baixar o script install.sh em um diretório onde está o diretório do upload. Ex.: path do upload: /var/www/upload, path do script: /var/www/install.sh
  2. Alterar o chmod do script para que seja executável: chmod +x install.sh
  3. Executar script com a versão a ser atualizada: ./install.sh v2.11.9
  4. O resultado final é ter os conteineres do Upload rodando com a nova versão

Algum cenário de contexto que queira dar?

Melhorias no processo de instalação da nova plataforma

Screenshots

n/a

Quais são tickets relevantes?

n/a

Referências

.

- Adiciona comentários
- Executa alguns comandos para instalação ou atualização
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new install.sh script intended to automate SciELO Upload installation and update steps currently documented in the wiki, so users can install/update by providing a target tag/version.

Changes:

  • Introduces install.sh to clone (sparse) the Upload repo or update key files from a given tag.
  • Adds basic install vs update branching and runs make targets to build/migrate/start containers.

Comment on lines +23 to +38
if [ ! -d "$UPLOAD_DIR/$ENV_FILES_DIR" ]; then
echo "Installing version $1 ..."
git clone --no-checkout --filter=blob:none --depth=1 --branch $1 --sparse https://github.com/scieloorg/scms-upload $UPLOAD_DIR
cd $UPLOAD_DIR
git sparse-checkout init --cone
git sparse-checkout set .envs/.production-template compose/production/postgres/maintenance
git checkout $1
mv .envs/.production-template $ENV_FILES_DIR
else
echo "Updating to version $1 ..."
echo " Downloading files from Git repository ..."
cd $UPLOAD_DIR
wget -O Makefile https://raw.githubusercontent.com/scieloorg/scms-upload/refs/tags/$1/Makefile
wget -O production.yml https://raw.githubusercontent.com/scieloorg/scms-upload/refs/tags/$1/production.yml
IS_UPDATE=1
fi
install.sh Outdated
# Bash script for SciELO Upload Installation/Update
#
# How it works:
# ./install <Upload version>
install.sh Outdated
git clone --no-checkout --filter=blob:none --depth=1 --branch $1 --sparse https://github.com/scieloorg/scms-upload $UPLOAD_DIR
cd $UPLOAD_DIR
git sparse-checkout init --cone
git sparse-checkout set .envs/.production-template compose/production/postgres/maintenance
install.sh Outdated
Comment on lines +45 to +53
# For installation: make Docker login and build DB
read -p "Enter the Docker login user: " DOCKER_USER
docker login -u $DOCKER_USER
make build compose=production.yml
make django_migrate compose=production.yml
else
# For updating: update Django containers and make DB migrations
make update_webapp compose=production.yml
make django_migrate_fresh_migrations compose=production.yml
patymori and others added 2 commits March 17, 2026 10:01
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
- Corrige comentário
- Habilita pipefail
- Adiciona aspas nas variáveis
- Corrige condicional para instalação/atualização dos conteineres Docker
@patymori
Copy link
Collaborator Author

@robertatakenaka submetidas as sugestões do Copilot. Não consigo pedir nova revisão a ele.

@robertatakenaka robertatakenaka requested a review from Copilot March 19, 2026 13:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a top-level install.sh script intended to automate SciELO Upload installation and update steps currently documented in the wiki.

Changes:

  • Introduces install.sh to install a given tagged version by cloning a sparse subset of scms-upload and running the required make targets.
  • Adds an update path that downloads updated Makefile and production.yml, then updates containers and runs migrations.

git clone --no-checkout --filter=blob:none --depth=1 --branch "$1" --sparse https://github.com/scieloorg/scms-upload $UPLOAD_DIR
cd "$UPLOAD_DIR"
git sparse-checkout init --cone
git sparse-checkout set .envs/.production-template compose/production/postgres/maintenance Makefile production.yml
Comment on lines +26 to +53
git clone --no-checkout --filter=blob:none --depth=1 --branch "$1" --sparse https://github.com/scieloorg/scms-upload $UPLOAD_DIR
cd "$UPLOAD_DIR"
git sparse-checkout init --cone
git sparse-checkout set .envs/.production-template compose/production/postgres/maintenance Makefile production.yml
git checkout "$1"
mv .envs/.production-template "$ENV_FILES_DIR"
else
echo "Updating to version $1 ..."
echo " Downloading files from Git repository ..."
cd "$UPLOAD_DIR"
wget -O Makefile "https://raw.githubusercontent.com/scieloorg/scms-upload/refs/tags/$1/Makefile"
wget -O production.yml "https://raw.githubusercontent.com/scieloorg/scms-upload/refs/tags/$1/production.yml"
IS_UPDATE=1
fi

echo "$1" > VERSION

echo "Version $(cat VERSION) installed/updated!"

if [ "$IS_UPDATE" -eq 1 ]; then
# For updating: update Django containers and make DB migrations
make update_webapp compose=production.yml
make django_migrate_fresh_migrations compose=production.yml
else
# For installation: make Docker login and build DB
read -p "Enter the Docker login user: " DOCKER_USER
docker login -u $DOCKER_USER
make build compose=production.yml
ENV_FILES_DIR=.envs/.production
IS_UPDATE=0

echo "Checking directory $UPLOAD_DIR$ENV_FILES_DIR ..."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants