In order to compile the backend application you will need Postgresql
, sbt
and JDK
.
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
sudo apt-get update
sudo apt-get install sbt
sudo apt install openjdk-8-jdk
sudo apt install postgresql
sudo systemctl start postgresql@11-main
You need to create an user on the database in order to connect it to your application. Set 'username' and password when prompted
sudo -su postgres
createuser -s -d -P username
Check connection availability and port
pg_isready
Then create the database defining the name on dbname
(eg. gestionale).
createdb dbname
Then exit postgres user.
exit
Set variables according to your environment into conf/env/
.
Production:
sudo nano sos-master/conf/env/prod.conf
Development:
sudo nano sos-master/conf/env/dev.conf
${?APPLICATION_SECRET}
is your production key secret.${JDBC_DATABASE_URL}
is yout postrges urljdbc:postgresql://host/database
(eg.jdbc:postgresql://localhost/gestionale
).${JDBC_DATABASE_USER}
and${JDBC_DATABASE_PASSWORD}
are your database user credetials (eg.postgres
and1234
).${?ADMIN_URL}
is your admin ui domain (eg."http://your-frontend-domain.xyz/admin"
or"http://dmin.your-frontend-domain.xyz"
).${?USER_URL}
is your public ui domain (eg."http://your-frontend-domain.xyz/"
or"http://join.your-frontend-domain.xyz"
).${?USER_WELCOME_URL}
is your welcome domain (eg."http://your-frontend-domain.xyz/welcome"
).${AWS_ACCESS_KEY_ID}
and${AWS_SECRET_KEY}
are your AWS Credentials.${?DUMMY_USER_EMAIL}
is the dummy user email address (eg."[email protected]"
).${?DUMMY_USER_PWD}
is the dummy user password.${?BRAINTREE_MERCHANT_ID}
,${?BRAINTREE_PUBLIC_KEY}
,${?BRAINTREE_PRIVATE_KEY}
,${?BRAINTREE_ENVIRONMENT}
are your Braintree credentials.${?MAILER_HOST}
,${?MAILER_USER}
,${?MAILER_PASS}
are your email host credentials.
Watch out for http or https while setting URLs.
First get eveything needed for sbt.
sbt
Then you can build
sbt stage
You need to seed the database according with your environment.
Production:
sbt seedDataProd
Development:
sbt seedDataDev
Launch the application
sudo target/universal/stage/bin/sos -Dconfig.resource=env/dev.conf -Dhttp.port=9000 -Dlogger.resource=logback.xml -Dplay.evolutions.db.default.autoApply=true -Dplay.http.secret.key='QCY?tAnfk?aZ?iwrNwnxIlR6CTf:G3gf:90Latabg@5241ABR5W:1uDFN];Ik@n'