Skip to content

Instantly share code, notes, and snippets.

@thenets
Created November 12, 2017 16:31
Show Gist options
  • Save thenets/54cfe6d0b92f755ac5bdaec09863a65b to your computer and use it in GitHub Desktop.
Save thenets/54cfe6d0b92f755ac5bdaec09863a65b to your computer and use it in GitHub Desktop.
Instalador do EasyCKAN integrado ao ckanext-dadosgovbr
#!/bin/bash
# ================================================================================
# EasyCKAN integrado ao dadosgovbr/ckanext-dadosgovbrschema
#
# Requisitos:
# - Instale o "curl": apt-get install -y curl
# - Precisa ser executado como root.
#
#
# Este guia de instalação é dedicado para sistemas operacionais Ubuntu / Debian
#
# Porém pode ser facilmente modificado. Basta alterar os comandos "apt-get"
# pelo comando do gerenciador de pacotes da distribuição Linux.
# ================================================================================
set -x
# Verifica se o usuário é root
# ================================================================================
if [[ $EUID -ne 0 ]]; then
echo "Must be run as root... Exiting..." 1>&2
exit 1
fi
echo ''
echo "# Installing EasyCKAN and Docker"
echo "# ================================================================================"
curl -sSL https://raw.githubusercontent.com/thenets/Easy-CKAN/master/install_easyckan.sh | bash
easyckan install
echo ''
echo "# Installing ckanext-dadosgovbrschema"
echo "# ================================================================================"
echo ''
echo "# Add user 1000 to Docker group"
usermod -aG docker $(id -nu 1000)
echo ''
echo "# Create installer script for ckanext-dadosgovbr and install"
DADOSGOVBR_INSTALL='/usr/lib/ckan/default/src/dadosgovbr_install.sh'
DADOSGOVBR_SCHEMA_DIR='/usr/lib/ckan/default/src/ckanext-dadosgovbrschema'
echo "#!/bin/bash" > $DADOSGOVBR_INSTALL
echo "cd /usr/lib/ckan/default/src" >> $DADOSGOVBR_INSTALL
echo "pip install -e git+https://github.com/dadosgovbr/ckanext-dadosgovbrschema.git@master#egg=ckanext-dadosgovbrschema" >> $DADOSGOVBR_INSTALL
echo "pip install -r $DADOSGOVBR_SCHEMA_DIR/pip-requirements.txt" >> $DADOSGOVBR_INSTALL
echo "cd $DADOSGOVBR_SCHEMA_DIR && python setup.py develop" >> $DADOSGOVBR_INSTALL
chown 5000.5000 $DADOSGOVBR_INSTALL
chmod +x $DADOSGOVBR_INSTALL
easyckan exec $DADOSGOVBR_INSTALL
sed -i "s/dadosgovbrschema//g" /etc/ckan/default/development.ini
sed -i "s/ckan.plugins = /ckan.plugins = dadosgovbrschema /g" /etc/ckan/default/development.ini
echo ''
echo "# Setup repository ckanext-dadosgovbr for development"
chown 1000.1000 -R $DADOSGOVBR_SCHEMA_DIR
su $(id -nu 1000) -c "cd $DADOSGOVBR_SCHEMA_DIR && git remote remove origin"
su $(id -nu 1000) -c "cd $DADOSGOVBR_SCHEMA_DIR && git remote add origin git@github.com:dadosgovbr/ckanext-dadosgovbrschema.git"
ln -s $DADOSGOVBR_SCHEMA_DIR /home/$(id -nu 1000)/ckanext-dadosgovbrschema
echo ''
echo "# Restart all containers and setup production mode"
echo "# ================================================================================"
easyckan repair
easyckan production
echo ''
echo 'Installation complete!'
echo ''
easyckan version
@thenets
Copy link
Author

thenets commented Nov 12, 2017

Basta rodar o seguinte comando pra instalar:

curl -sSL https://gist.githubusercontent.com/thenets/54cfe6d0b92f755ac5bdaec09863a65b/raw/c9359d1a356100f6eedf794520270aa3f0c4bfe6/install_easyckan_dadosgovbrschema.sh | sudo bash

Comandos para criar um usuário admin e outros vc encontra no README: https://github.com/thenets/EasyCKAN#33-create-admin-user

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment