Running a play framework app in Amazon EC2 micro instance

前端 未结 2 776
旧巷少年郎
旧巷少年郎 2021-02-14 22:38

I have a really basic play! app which simply handles a couple of normal GET and POST requests and talks to a MySQL database, nothing fancy.

I ran play dist

2条回答
  •  北恋
    北恋 (楼主)
    2021-02-14 23:12

    Using play 2.2.1 I had to run play dist to generate the zip file. Then I copied that to the aws instance. Once there, I extracted the zip and changed the executable file:

    from:

    local mem=${1:-1024}
    

    to:

    local mem=${1:-512}
    

    That did it for me. I got the idea from here but I didn't want to just delete the logic they had there, so I just reduced the default value.

    Also please note that on aws ec2 micro:

    $ java -version
    java version "1.6.0_24"
    OpenJDK Runtime Environment (IcedTea6 1.11.14) (amazon-65.1.11.14.57.amzn1-x86_64)
    OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
    

    So you have to use the same Java JDK when runnin play dist.

    EDIT:

    I updated java to openjdk 7 and was able to run the sample play applications without any errors.

提交回复
热议问题