Fix create / update of test sets
Initial changes for direct compose-deploy
Fix test group import to include test_group_ids in the questions created
To run this application you need to install:
First you need to initialize the data cluster:
sudo su - postgres -c "initdb --locale en_US.UTF-8 -D '/var/lib/postgres/data'"
Then login/connect to the database server:
sudo runuser -u postgres -- psql
Create the database and permissions
CREATE USER kopfsalat_dev WITH PASSWORD 'somePassword';
CREATE DATABASE kopfsalat_dev;
GRANT ALL PRIVILEGES ON DATABASE kopfsalat_dev to kopfsalat_dev;
ALTER DATABASE kopfsalat_dev OWNER TO kopfsalat_dev;
Exit the database server using \q
\q
Finally, create the db-schema using ecto.migrate
mix ecto.migrate
To start the Phoenix server:
mix deps.get
sudo systemctl start postgresql.service
mix ecto.setup
(or mix ecto.reset
if you want to reset)mix assets.deploy
to prepare static assetsmix phx.server
Now you can visit localhost:4000
from your browser.
Ready to run in production? Please check our deployment guides.
mix phx.gen.json Accounts User users username:string password:string last_login:datetime language:integer birth_year:integer gender:integer
mix phx.gen.html Accounts Admin admins username:string password:string last_login:datetime super:boolean
mix phx.gen.html Tests Test tests title:string description:string content:string created_admin_id:integer visible:boolean
mix phx.gen.html Tests TestGroup test_groups title:string description:string created_admin_id:integer
mix phx.gen.html Questions Question questions content:string answer_value:string answer_key:string fail_content:string success_content: string order:integer max_time:integer visible:boolean
mix phx.gen.json TestRuns TestRun test_runs user_id:integer test_set_id:integer device_id:string start:date
mix phx.gen.json Responses Response responses user_id:integer test_set_id:integer question_id:integer value:string response_type:integer success:boolean start:date duration:integer out_of_focus_count:number out_of_focus_ms:number
mix phx.gen.schema Media.Upload uploads filename:string size:integer content_type:string hash:string
mix phx.gen.html Badges Badge badges query:map badge_upload_id:integer upload_sprite_index:integer title:string description:string
mix phx.gen.html Badges BadgeLevel badge_levels badge_id:integer comp_mode:integer value:integer color:string
mix phx.gen.schema Media.BadgeUpload badge_uploads badge_id:integer upload_id:integer
mix ecto.migrate
mix ecto.gen.migration some_new_migration
mix test
mix phx.routes
podman
and postgres
(apt install podman postgresql)adduser kopfsalat --group
su postgres
createdb db_name
psql
exit
drop back to rootpodman load -i digamma.tar.gz
env.sh
:
export CONTAINER_NAME=kopfsalat_api
export HOSTNAME=example.com
export DATABASE_URL="ecto://db_username:myPassword@localhost/db_name"
export SECRET_KEY_BASE="some really long secret key, possibly generated by: mix phx.gen.secret"
export ACME_CHALLENGE_DIR=/opt/acme
export SSL_DIR=/etc/letsencrypt/live/$HOSTNAME
./start_container.sh
scp deploy_scripts/run_certbot.sh server\_user@example.org:/root/
source ./env.sh && curl $HOSTNAME
./run_certbot.sh
./start_container.sh
crontab -e
@daily /root/start_container.sh
FORCE_SSL=true
before the podman build
command
FORCE_SSL=true podman build -f Containerfile -t kopfsalat\_api .
apt install ufw
ufw allow ssh
ufw allow http
ufw allow https
ufw enable