In order to enable debugging for your Django app running in a Docker container, follow these steps using Visual Studio (Code):
- Add
ptvsdto your requirements.txt file
ptvsd == 4.3.2
- To your
launch.json, add this:
| const fastify = require('fastify')(); | |
| fastify.get('/', (request, reply) => reply.send({ hello: 'world' })); | |
| if (require.main === module) { | |
| // called directly i.e. "node app" | |
| fastify.listen(3000, (err) => { | |
| if (err) console.error(err); | |
| console.log(`server listening on ${fastify.server.address().port}`); | |
| }); |
| AWSTemplateFormatVersion: '2010-09-09' | |
| Description: Cognito Stack | |
| Parameters: | |
| AuthName: | |
| Type: String | |
| Description: Unique Auth Name for Cognito Resources | |
| Resources: | |
| # Creates a role that allows Cognito to send SNS messages | |
| SNSRole: |
| Resources: | |
| AWSEBAutoScalingGroup: | |
| Metadata: | |
| ? "AWS::CloudFormation::Authentication" | |
| : | |
| S3Auth: | |
| buckets: | |
| - <my-bucket> | |
| roleName: | |
| ? "Fn::GetOptionSetting" |
| # This will automatically install the Sumo Logic collector on AWS Elastic | |
| # Beanstalk instances. Add this to the .ebextensions folder in your app root | |
| # To add or remove tracked files, simply add or remove source hashes to the | |
| # sources array. | |
| packages: | |
| rpm: | |
| SumoCollector: https://collectors.sumologic.com/rest/download/rpm/64 | |
| services: | |
| sysvinit: |
| // | |
| // hasPosition trait | |
| // | |
| const hasPosition = state => ({ | |
| setPosition: function(x, y) { | |
| this.x = x; | |
| this.y = y; | |
| }.bind(state) | |
| }); |
| # This will automatically install the Sumo Logic collector on AWS Elastic | |
| # Beanstalk instances. Add this to the .ebextensions folder in your app root | |
| # and edit L24-25 to match your Sumo Logic accessid and accesskey. To add or | |
| # remove tracked files, simply add or remove source hashes to the sources | |
| # array on L36. | |
| packages: | |
| rpm: | |
| SumoCollector: https://collectors.sumologic.com/rest/download/rpm/64 | |
| services: |
| var loopback = require('loopback'); | |
| module.exports = function(SampleModel) { | |
| // Returns null if the access token is not valid | |
| function getCurrentUserId() { | |
| var ctx = loopback.getCurrentContext(); | |
| var accessToken = ctx && ctx.get('accessToken'); | |
| var userId = accessToken && accessToken.userId; | |
| return userId; |
| http://pm2.keymetrics.io/docs/usage/use-pm2-with-cloud-providers/ |