Skip to content

Instantly share code, notes, and snippets.

@seLain
Last active May 7, 2021 05:30
Show Gist options
  • Save seLain/dd7b7f142260f4508144743f6a3f1f33 to your computer and use it in GitHub Desktop.
Save seLain/dd7b7f142260f4508144743f6a3f1f33 to your computer and use it in GitHub Desktop.

Revisions

  1. seLain revised this gist Apr 3, 2018. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,8 @@
    ## useful refs
    * https://realpython.com/deploying-a-django-app-to-aws-elastic-beanstalk/#Create.the.Admin.User
    * https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create-deploy-python-django.html


    ## CLI approach
    1. Enter your project root (versioned with Git)
    2. install awsebcli
  2. seLain revised this gist Apr 3, 2018. 1 changed file with 14 additions and 0 deletions.
    14 changes: 14 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -23,6 +23,20 @@ STATIC_ROOT = 'static'
    reference for createsuper user command:
    https://realpython.com/deploying-a-django-app-to-aws-elastic-beanstalk/#Create.the.Admin.User

    10 > eb open

    If encountered 'attempt to write a readonly database' exception while login,
    it's probably caused by permission issue againt db.sqlite3 (if using default db.sqlite3 database)

    solution(1) : > db ssh to login in AWS, and cd to /opt/python/current/app , chown wsgi db.sqlite3
    solution(2) : add chown command to config just behind the migrate command, do > eb deploy
    '''
    02_chown_sqlitedb:
    command: "sudo chown wsgi db.sqlite3"
    leader_only: true
    '''


    ## AWS Console approach

    1. Create EB isntance on AWS console
  3. seLain revised this gist Apr 3, 2018. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -20,6 +20,9 @@ STATIC_ROOT = 'static'
    9.3 > add collected static to git repo
    9.4 > eb deploy

    reference for createsuper user command:
    https://realpython.com/deploying-a-django-app-to-aws-elastic-beanstalk/#Create.the.Admin.User

    ## AWS Console approach

    1. Create EB isntance on AWS console
  4. seLain revised this gist Apr 3, 2018. 1 changed file with 11 additions and 0 deletions.
    11 changes: 11 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,17 @@
    6. > eb list (to check)
    7. > eb open
    8. > eb terminate
    9. If some css/js effect not showing out...
    9.1 set settings.py
    '''
    # Static files (CSS, JavaScript, Images)
    # https://docs.djangoproject.com/en/1.9/howto/static-files/
    STATIC_URL = '/static/'
    STATIC_ROOT = 'static'
    '''
    9.2 > python manage.py collectstatic
    9.3 > add collected static to git repo
    9.4 > eb deploy

    ## AWS Console approach

  5. seLain revised this gist Apr 3, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@
    7. > eb open
    8. > eb terminate

    ## Console approach
    ## AWS Console approach

    1. Create EB isntance on AWS console
    2. local, pip install awsebcli
  6. seLain revised this gist Apr 3, 2018. 1 changed file with 20 additions and 5 deletions.
    25 changes: 20 additions & 5 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,25 @@
    ## CLI approach
    1. Enter your project root (versioned with Git)
    2. install awsebcli
    2.1 if encountering trouble installing PyYAML, using prepackages wheel:
    3. > eb init
    4. > eb create
    5. > eb deploy
    6. > eb list (to check)
    7. > eb open
    8. > eb terminate

    ## Console approach

    1. Create EB isntance on AWS console
    2. local, pip install awsebcli
    2.1 if encountering trouble installing PyYAML, using prepackages wheel:
    3. local, command "eb init" in root project dir to initialize
    3.1 input creditials: generated and retrieved from https://console.aws.amazon.com/iam/home?#/security_credential
    4. on win, need to install openssh if you would like to set SSH during eb init
    5. eb create my-env (rename as needed)

    3. Enter your project root (versioned with Git)
    4. > eb init
    4.1 input creditials: generated and retrieved from https://console.aws.amazon.com/iam/home?#/security_credential
    4.2 on win, need to install openssh if you would like to set SSH during eb init
    5. > eb create my-env (rename as needed)
    6. package all files needed as .zip
    7. upload .zip to EB isntance and wait for running

    * YAML validator: http://yaml-online-parser.appspot.com/
  7. seLain revised this gist Mar 30, 2018. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -5,3 +5,6 @@
    3.1 input creditials: generated and retrieved from https://console.aws.amazon.com/iam/home?#/security_credential
    4. on win, need to install openssh if you would like to set SSH during eb init
    5. eb create my-env (rename as needed)


    * YAML validator: http://yaml-online-parser.appspot.com/
  8. seLain created this gist Mar 30, 2018.
    7 changes: 7 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    1. Create EB isntance on AWS console
    2. local, pip install awsebcli
    2.1 if encountering trouble installing PyYAML, using prepackages wheel:
    3. local, command "eb init" in root project dir to initialize
    3.1 input creditials: generated and retrieved from https://console.aws.amazon.com/iam/home?#/security_credential
    4. on win, need to install openssh if you would like to set SSH during eb init
    5. eb create my-env (rename as needed)