-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathasdf-install.sh
executable file
·66 lines (52 loc) · 2.06 KB
/
asdf-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
##
## Development environment installation using asdf
## https://github.com/asdf-vm/asdf
##
# Install required packages
sudo apt update -y
sudo DEBIAN_FRONTEND=noninteractive apt install -y sqlite3 sqlitebrowser \
linux-headers-$(uname -r) build-essential software-properties-common automake autoconf make cmake \
gpg bc m4 bzip2 dirmngr curl locate zlib1g-dev libssh-dev libssl-dev libncurses5-dev libsqlite3-dev libbz2-dev
# Add plugins and install following .tool-versions
asdf plugin-add python
asdf plugin-add postgres
asdf plugin-add nodejs
bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring
asdf install
asdf reshim
# Install pip tools
pip install --upgrade pip
pip install virtualenvwrapper
# Create virtualenv
mkvirtualenv coobs
# Setup python ENV vars at ~/.bash_aliases
VENVWRAPPER=$(locate virtualenvwrapper.sh)
tee -a $HOME/.bash_aliases <<TXT
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/projects
source $(echo $VENVWRAPPER)
TXT
source $HOME/.bash_aliases
# Install python requirements
make install-requirements
# Install node dependencies
make install-frontend
# Copy the settings template
cp coobs/settings/dev.template.py coobs/settings/dev.py
# Generate secret key for django and update it at coobs/settings.py
sed -i "s!SECRET_KEY = .*!SECRET_KEY = '$(openssl rand -base64 32)'!g" coobs/settings/dev.py
# Start postgres and create the database's user
pg_ctl start
sudo -iu postgres bash -c "psql -c \"CREATE USER coobs WITH PASSWORD 'coobspass';\""
sudo -iu postgres bash -c "psql -c \"ALTER ROLE coobs SET client_encoding TO 'utf8';\""
sudo -iu postgres bash -c "psql -c \"ALTER ROLE coobs SET default_transaction_isolation TO 'read committed';\""
sudo -iu postgres bash -c "psql -c \"ALTER ROLE coobs SET timezone TO 'UTC';\""
sudo -iu postgres bash -c "psql -c \"ALTER USER coobs CREATEDB;\""
# @TODO Configure db parameters at coobs/settings/dev.py
# Create the DB, run migrations and create django superuser
make reset-db
# Done!
echo "Installation done!"
echo "Run server: make server"
echo "Run frontend: make frontend"