Boxfuse Setup & Deployment for Play Framework in Scala
3 min readNov 29, 2021
- Visit the Boxfuse website.
- Login with your GitHub account.
- Connect your AWS account and give permission for using json.
- Make sure you select the correct AWS region.
- Download the personalized Boxfuse client.
- Place it in root directory and add it to env variable.
- In my case, I placed it inside
~/go/installation/amd/go/boxfuse/.
- To add boxfuse to env variables I used:
export GOROOT=/Users/<username>/go/installation/amd/goexport GOPATH=/Users/<username>/goexport GOBIN=$GOPATH/binexport GO111MODULE=onexport PATH=$GOPATH/bin:$PATHexport PATH=$GOROOT/bin:$PATH
- Now, you can check if it is installed properly using
boxfuse -v.
- Now, navigate to the Play project and create a distribution image using
sbt dist
- It should show something like this:
[info] Main Scala API documentation successful.
[warn] there were two feature warnings; re-run with -feature for details
[warn] 67 warnings found
[success] All package validations passed
[info] Your package is ready in /Project/directory/target/universal/<Project_Name>-1.0.zip
[success] Total time: 154 s (02:34), completed 27-Oct-2021, 3:16:15 PM
- Now, run dist image with Boxfuse using
boxfuse run -env=test
(Note: it will run on AWS). - Define all required env variables in the boxfuse.conf file located in Boxfuse installation directory as below:
envvars.myvar=myvalue
envvars.otherone=Something Else
- Or to pass env variables from terminal, use this:
boxfuse run -env=test envvars.SERVER_PORT=26657 envvars.PLAY_HTTP_SECRET="YOUR_PLAY_SECRET" -capacity=1:t2.micro
-capacity=1:t2.micro
is used to define the number of instances and types of instances to deploy.- For more configuration, check
<boxfuse-installation-directory>/conf/boxfuse.conf
(Note: by default, it shows all the logs in the console).
Errors & Fixes:
- Unable to create RDS DB instance ERROR: Running
WARNING: Run failed: Unable to create RDS DB instance
ERROR: Running 0xankit/<Project_Name>:0.0.0.1635328070074 failed![FIXED] Change db.t2.micro to db.t3.micro from boxfuse dashboard by clicking on scale and then try again.
2. Unable to start VirtualBox instance boxfuse-dev-hdd-2016.02.09_0xankit-<Project_Name>
ERROR: Unable to start VirtualBox instance boxfuse-dev-hdd-2016.02.09_0xankit-<Project_Name>
=> ensure VirtualBox is working correctly
=> ensure hardware virtualization (VT-x or AMD-V) is enabled on your machine and check by running "/usr/local/bin/VBoxManage list hostinfo"
- [FIXED] Define -env=test
3. JVM exited with status 255
" play.core.server.ProdServerStart
i-0cd1a2fa4e0bcc642 => 2021-10-28 11:08:56.147 JVM exited with status 255
i-0cd1a2fa4e0bcc642 => 2021-10-28 11:08:56.147 Rebooting in 15 seconds ...
- [FIXED] Define
logs.filter.level=TRACE
to see exact error.
4. Postgres root certificate error: Could not open SSL root certificate file.
ERROR: i-0a5d6b28fb9d1c587 => 2021-10-29 12:24:43.512 Caused by: org.postgresql.util.PSQLException: Could not open SSL root certificate file //.postgresql/root.crt.
- [FIXED] Define
slick.dbs.default.db.properties.sslfactory="org.postgresql.ssl.NonValidatingFactory"
in application.conf
5. For Timeout error
- [FIXED] Define
slick.dbs.default.db.connectionTimeout=15s
in application.conf
6. Evolutions couldn’t be applied
- [FIXED] Define
play.evolutions.autoApply=true
in application.conf
7. For ‘couldn’t write permission’ issue
- [FIXED] Define
play.server.pidfile.path=/dev/null
in application.conf
And with that, you’ve crossed another level to becoming a boss coder. GG! 👏
I hope you found this article instructional and informative. If you have any feedback or queries, please let me know in the comments below. And follow me on twitter!