# start the project
sbt run
# hot reload
sbt ~re-start
# check style
sbt scalastyle
# format code
sbt scalafmt
# show project dependencies
sbt dependencyTree
# show outdated dependencies
sbt dependencyUpdates
# run tests
sbt test
# run coverage and generate report
sbt clean coverage test coverageReport
# view report in browser (mac|linux)
open ./target/scala-2.12/scoverage-report/index.html
xdg-open ./target/scala-2.12/scoverage-report/index.html
# generate Dockerfile in target/docker/
sbt docker:stage
# build image
sbt docker:publishLocal
# start temporary container
docker run \
--rm \
-e HTTP_PORT="8080" \
-p 80:8080 \
--name scala-akka-boilerplate \
scala-akka-boilerplate:latest
# start container
docker-compose up -d
# grant permissions to folder
chmod 777 /vol/log/scala-akka-boilerplate
# logs
tail -f /vol/log/scala-akka-boilerplate/scala-akka-boilerplate.log
# request status (with HTTPie)
http :80/status
# access container
docker exec -it scala-akka-boilerplate bash
# access container as root
docker exec -it --user root scala-akka-boilerplate bash
Requirements for deployment
- EC2 instance available e.g.
ec2-000-000-000-000.AWS_REGION.compute.amazonaws.com
- EC2 Container Registry configured e.g.
AWS_ACCOUNT_ID.dkr.ecr.AWS_REGION.amazonaws.com/scala-akka-boilerplate
- Credentials (Access Key ID and Secret Access Key) of a unique IAM user with permission
AmazonEC2ContainerRegistryPowerUser
to push on the registry - Logentries Java Log Set for Logback
CircleCI build setup
- add the repository to CircleCI
- AWS CodeDeploy: set the AWS keypair (Access Key ID and Secret Access Key)
- SSH Permissions: add a private key (PEM) to deploy to the EC2 machine
- Chat Notifications: set a Webhook URL for Slack to get a notification on each build
Configure the following CircleCI Environment Variables:
- AWS_REGION e.g.
eu-west-1
(without a/b/c) - AWS_ACCOUNT_ID (registry)
- EC2_USERNAME e.g.
ubuntu
- EC2_HOST e.g.
ec2-000-000-000-000.AWS_REGION.compute.amazonaws.com
- HTTP_PORT e.g.
8080
- SLACK_WEBHOOK_URL
- LOGENTRIES_TOKEN
View coverage report on CircleCI UI in the Artifacts tab of any build
Logs available in log
(local) or /vol/log/scala-akka-boilerplate
(aws)