mazz / faithfulword-phx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The devnotes.md has some commands to get your environment up but you'll need asdf:

go to this page and follow how to install asdf:

https://asdf-vm.com/#/core-manage-asdf-vm

then:

asdf plugin-add elixir
asdf plugin-add erlang
asdf plugin-add nodejs

asdf install elixir 1.9.1
asdf install erlang 22.0.7
NODEJS_CHECK_SIGNATURES=no asdf install nodejs 11.15.0

install a local postgresql db server

mac: go to https://postgresapp.com and download latest binary linux ubuntu: install psql

now you're ready to install the web app:

cd ~/faithfulword-phx
git fetch
git checkout develop # latest working branch
mix deps.get && mix deps.compile
cd apps/faithful_word_api
cd assets && npm install
cd ../../
python3 -m venv my3venv
source my3venv/bin/activate
pip install -U pip
pip install psycopg2
cd ../faithfulword-phx

### latest db file:
2020-01-21-mediaitem-v1.3-bin.sql


## linux local postgresql

sudo vim /etc/postgresql/10/main/pg_hba.conf
local   all             postgres                                trust
local   all             all                                     trust
host    all             all             127.0.0.1/32            trust
host    all             all             ::1/128                 trust

create postgres/postgres

sudo -u postgres psql

psql:

postgres=# ALTER USER postgres PASSWORD 'postgres';
postgres=# CREATE ROLE michael WITH SUPERUSER CREATEDB CREATEROLE LOGIN ENCRYPTED PASSWORD 'michael';
postgres=# CREATE ROLE faithful_word WITH SUPERUSER CREATEDB CREATEROLE LOGIN ENCRYPTED PASSWORD 'faithful_word';
postgres=# create database michael;
FW_DATABASE_URL=ecto://postgres:postgres@localhost/faithful_word_dev ./dbtool.py migratefromwebsauna ./2020-01-24-media-item-bin-v1.3.sql faithful_word_dev /usr/bin ; ./dbtool.py convertv12bibletoplaylists faithful_word_dev ; ./dbtool.py convertv12gospeltoplaylists faithful_word_dev ; ./dbtool.py convertv12musictoplaylists faithful_word_dev ; ./dbtool.py normalizemusic faithful_word_dev ; ./dbtool.py normalizegospel faithful_word_dev ; ./dbtool.py normalizepreaching faithful_word_dev ; ./dbtool.py normalizebible faithful_word_dev ; ./dbtool.py misccleanup faithful_word_dev ; FW_DATABASE_URL=ecto://postgres:postgres@localhost/faithful_word_dev mix run apps/db/priv/repo/seeds.exs ; FW_DATABASE_URL=ecto://postgres:postgres@localhost/faithful_word_dev mix run apps/db/priv/repo/hash_ids.exs

FW_DATABASE_URL=ecto://postgres:postgres@localhost/faithful_word_dev ./dbtool.py migratefromwebsauna ./2020-01-24-media-item-bin-v1.3.sql faithful_word_dev /Applications/Postgres.app/Contents/Versions/12/bin ; ./dbtool.py convertv12bibletoplaylists faithful_word_dev ; ./dbtool.py convertv12gospeltoplaylists faithful_word_dev ; ./dbtool.py convertv12musictoplaylists faithful_word_dev ; ./dbtool.py normalizemusic faithful_word_dev ; ./dbtool.py normalizegospel faithful_word_dev ; ./dbtool.py normalizepreaching faithful_word_dev ; ./dbtool.py normalizebible faithful_word_dev ; ./dbtool.py misccleanup faithful_word_dev ; FW_DATABASE_URL=ecto://postgres:postgres@localhost/faithful_word_dev mix run apps/db/priv/repo/seeds.exs ; FW_DATABASE_URL=ecto://postgres:postgres@localhost/faithful_word_dev mix run apps/db/priv/repo/hash_ids.exs

2020-01-24-media-item-bin-v1.3.sql

export db as a complete seeded file to production:

./dbtool.py exportdb faithful_word_dev /Applications/Postgres.app/Contents/Versions/12/bin 2020-01-24-media-item-bin-v1.3-seeded-mat.sql

run

FW_DATABASE_URL=ecto://postgres:postgres@localhost/faithful_word_dev mix phx.server


### open url in browser

http://localhost:4000/v1.2/books?language-id=en

currently we manually refresh the ts_vector index because the PG triggers slow down the dbtool.py import script.
If you want /v1.3/search to return results you must run this SQL statement:

refresh materialized view media_items_search

About


Languages

Language:Elixir 76.2%Language:Python 12.7%Language:HTML 6.9%Language:CSS 2.4%Language:JavaScript 0.9%Language:Vue 0.4%Language:Shell 0.4%Language:Dockerfile 0.2%