Skip to content

Commit

Permalink
Merge branch 'develop' into enhance/parameterize-db-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
eternaltyro committed Feb 10, 2022
2 parents 750480c + aa3c8a2 commit d0d16d0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 27 deletions.
14 changes: 7 additions & 7 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ jobs:
build:
working_directory: /home/circleci/app
docker:
- image: circleci/python:3.7-buster-node
- image: cimg/python:3.7-buster-node
steps:
- checkout
- setup_remote_docker
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
type: string
working_directory: /home/circleci/tasking-manager
docker:
- image: circleci/python:3.7-buster-node
- image: cimg/python:3.7-buster-node
steps:
- checkout
- setup_remote_docker
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
frontend_deploy:
working_directory: /home/circleci/tasking-manager
docker:
- image: circleci/python:3.7-buster-node
- image: cimg/python:3.7-buster-node
parameters:
stack_name:
description: "the name of the stack for cfn-config"
Expand Down Expand Up @@ -226,7 +226,7 @@ workflows:
ignore:
- /^deployment\/.*/
- backend_deploy:
name: staging
name: backend-staging
filters:
branches:
only:
Expand All @@ -238,7 +238,7 @@ workflows:
gitsha: $CIRCLE_SHA1
context: tasking-manager-staging
- frontend_deploy:
name: staging
name: frontend-staging
filters:
branches:
only:
Expand Down Expand Up @@ -315,7 +315,7 @@ workflows:
backend-production:
jobs:
- backend_deploy:
name: production
name: backend-production
filters:
branches:
only:
Expand All @@ -326,7 +326,7 @@ workflows:
frontend-production:
jobs:
- frontend_deploy:
name: production
name: frontend-production
filters:
branches:
only:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/labeler@v2
- uses: actions/labeler@v3
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('OrganisationTier', () => {
expect(within(container.querySelector('h1')).getByText('Low')).toBeTruthy();
expect(screen.getAllByRole('progressbar')[1].style.width).toBe('10%');
expect(screen.getByText('Subscribed tier')).toBeInTheDocument();
expect(screen.getAllByText('Low').length).toBe(2);
expect(screen.getAllByText(/Low/).length).toBe(2);
expect(screen.getByText('9,000')).toBeInTheDocument();
expect(screen.getByText('Actions remaining on the Low tier')).toBeInTheDocument();
});
Expand Down
31 changes: 13 additions & 18 deletions scripts/aws/cloudformation/tasking-manager.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ const Resources = {
},
Properties: {
IamInstanceProfile: cf.ref('TaskingManagerEC2InstanceProfile'),
ImageId: 'ami-0565af6e282977273',
ImageId: 'ami-00fa576fb10a52a1c',
InstanceType: 'c5d.large',
SecurityGroups: [cf.importValue(cf.join('-', ['hotosm-network-production', cf.ref('NetworkEnvironment'), 'ec2s-security-group', cf.region]))],
UserData: cf.userData([
Expand All @@ -346,27 +346,22 @@ const Resources = {
'dpkg-reconfigure --frontend=noninteractive locales',
'sudo apt-get -y update',
'sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade',
'sudo add-apt-repository ppa:deadsnakes/ppa -y',
'sudo apt-get update',
'sudo apt-get -y install python3.6',
'sudo apt-get -y install python3.6-dev',
'sudo apt-get -y install python3.6-venv',
'sudo apt-get -y install curl',
'wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -',
'sudo sh -c \'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" > /etc/apt/sources.list.d/PostgreSQL.list\'',
'sudo apt-get update -y',
'sudo apt-get install -y postgresql-11',
'sudo apt-get -y install postgresql-11-postgis',
'sudo apt-get -y install postgresql-11-postgis-scripts',
'sudo apt-get install -y postgresql-12',
'sudo apt-get -y install postgresql-12-postgis-3',
'sudo apt-get -y install postgresql-12-postgis-3-scripts',
'sudo apt-get -y install postgis',
'sudo apt-get -y install libpq-dev',
'sudo apt-get -y install libxml2',
'sudo apt-get -y install wget libxml2-dev',
'sudo apt-get -y install libgeos-3.5.0',
'sudo apt-get -y install libgeos-3.8.0',
'sudo apt-get -y install libgeos-dev',
'sudo apt-get -y install libproj9',
'sudo apt-get -y install libproj15',
'sudo apt-get -y install libproj-dev',
'sudo apt-get -y install python-pip libgdal1-dev',
'sudo apt-get -y install python3-pip libgdal-dev libpq-dev python3-psycopg2 python3.8-venv',
'sudo apt-get -y install libjson-c-dev',
'sudo apt-get -y install git',
'sudo apt-get -y install awscli',
Expand All @@ -379,16 +374,16 @@ const Resources = {
'git clone --recursive https://github.com/hotosm/tasking-manager.git',
'cd tasking-manager/',
cf.sub('git reset --hard ${GitSha}'),
'python3.6 -m venv ./venv',
'python3 -m venv ./venv',
'. ./venv/bin/activate',
'pip install --upgrade pip',
'pip install -r requirements.txt',
'echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf',
'export LC_ALL=C',
'wget https://s3.amazonaws.com/amazoncloudwatch-agent/ubuntu/amd64/latest/amazon-cloudwatch-agent.deb -O /tmp/amazon-cloudwatch-agent.deb',
'dpkg -i /tmp/amazon-cloudwatch-agent.deb',
'wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz',
'pip2 install aws-cfn-bootstrap-latest.tar.gz',
'wget https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz',
'python3 -m easy_install --script-dir /opt/aws/bin aws-cfn-bootstrap-py3-latest.tar.gz',
'echo "Exporting environment variables:"',
cf.sub('export NEW_RELIC_LICENSE=${NewRelicLicense}'),
cf.join('', ['export POSTGRES_ENDPOINT=', cf.getAtt('TaskingManagerRDS','Endpoint.Address')]),
Expand Down Expand Up @@ -416,14 +411,14 @@ const Resources = {
cf.sub('export TM_IMAGE_UPLOAD_API_KEY="${TaskingManagerImageUploadAPIKey}"'),
'psql "host=$POSTGRES_ENDPOINT dbname=$POSTGRES_DB user=$POSTGRES_USER password=$POSTGRES_PASSWORD" -c "CREATE EXTENSION IF NOT EXISTS postgis"',
cf.if('DatabaseDumpFileGiven', cf.sub('aws s3 cp ${DatabaseDump} dump.sql; sudo -u postgres psql "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_ENDPOINT/$POSTGRES_DB" < dump.sql'), ''),
'./venv/bin/python3.6 manage.py db upgrade',
'./venv/bin/python3 manage.py db upgrade',
'echo "------------------------------------------------------------"',
cf.sub('export NEW_RELIC_LICENSE_KEY="${NewRelicLicense}"'),
cf.sub('export TM_SENTRY_BACKEND_DSN="${SentryBackendDSN}"'),
'export NEW_RELIC_ENVIRONMENT=$TM_ENVIRONMENT',
cf.sub('NEW_RELIC_CONFIG_FILE=./scripts/aws/cloudformation/newrelic.ini newrelic-admin run-program gunicorn -b 0.0.0.0:8000 --worker-class gevent --workers 5 --timeout 179 --access-logfile ${TaskingManagerLogDirectory}/gunicorn-access.log --access-logformat \'%(h)s %(l)s %(u)s %(t)s \"%(r)s\" %(s)s %(b)s %(T)s \"%(f)s\" \"%(a)s\"\' manage:application &'),
cf.sub('sudo cfn-init -v --stack ${AWS::StackName} --resource TaskingManagerLaunchConfiguration --region ${AWS::Region} --configsets default'),
cf.sub('cfn-signal --exit-code $? --region ${AWS::Region} --resource TaskingManagerASG --stack ${AWS::StackName}')
cf.sub('sudo /opt/aws/bin/cfn-init -v --stack ${AWS::StackName} --resource TaskingManagerLaunchConfiguration --region ${AWS::Region} --configsets default'),
cf.sub('/opt/aws/bin/cfn-signal --exit-code $? --region ${AWS::Region} --resource TaskingManagerASG --stack ${AWS::StackName}')
]),
KeyName: 'mbtiles'
}
Expand Down

0 comments on commit d0d16d0

Please sign in to comment.