Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Muskellunge Release! #1738

Merged
merged 25 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
073f61d
Created progress report for sprint1
adammenker Nov 14, 2021
367be52
created reflection
adammenker Nov 14, 2021
267f4a0
Added reflection to progress report, table img
sbrennan98 Nov 14, 2021
15bf463
Added link to server
sbrennan98 Nov 14, 2021
19e35ac
Merge branch 'chaoss:main' into main
sbrennan98 Nov 21, 2021
1c70ee6
Merge branch 'chaoss:main' into https-sprint2
sbrennan98 Nov 21, 2021
90cb612
Merge branch 'chaoss:main' into https-sprint3
sbrennan98 Nov 21, 2021
8e13c7d
Merge branch 'chaoss:main' into https-sprint4
sbrennan98 Nov 21, 2021
0dc56da
Added diagrams & sprint 2 update
sbrennan98 Nov 22, 2021
05c325c
Merge branch 'main' of https://github.com/sbrennan98/augur into main
sbrennan98 Nov 22, 2021
1dc281a
Merge branch 'main' into https-sprint3
sbrennan98 Dec 6, 2021
1e3ca95
mid-sprint documentation update
sbrennan98 Dec 6, 2021
6eacc01
Altered Flask/Gunicorn configuration
sbrennan98 Dec 6, 2021
d55e87d
Altered frontend configuration
sbrennan98 Dec 6, 2021
3234f8c
Added placeholder docs boilerplate for https
adammenker Dec 13, 2021
ac0a7d5
mistune patch, documentation, sprint 3 rollback
sbrennan98 Dec 17, 2021
108c1e1
Merge branch 'https-sprint4' into main
sbrennan98 Dec 17, 2021
7c1505c
sprint 3 rollback
sbrennan98 Dec 17, 2021
ea73429
Sprint 4 progress report
sbrennan98 Dec 17, 2021
f45eeb7
removed CS4320 documents from main for pull request
sbrennan98 Dec 17, 2021
c69660e
removed CS4320 documents from main for pull request
sbrennan98 Dec 17, 2021
9ff1a2b
Added Goggins' fixes and documented them
sbrennan98 Dec 20, 2021
5217c01
Merge branch 'spg-patch-abf' into https
sgoggins Apr 13, 2022
9a011fd
Merge pull request #1542 from sbrennan98/https
sgoggins Apr 13, 2022
dd972d6
Update version and chaoss_user table creation.
sgoggins Apr 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docs/source/deployment/nginx-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,36 @@ This file will be located in the ``/etc/nginx/sites-enabled`` directory on most
access_log /var/log/nginx/augur.censusscienceosshealth.access.log;

}

--------------------
Enabling HTTPS
--------------------

HTTPS is an extension of HTTP. It is used for secure communications over a computer networks by encrypting your data so it is not vulnerable to MIM(Man-in-the-Middle) attacks etc. While Augur's API data might not be very sensitive, it would still be a nice feature to have so something can't interfere and provide wrong data. Additionally, the user may not feel very comfortable using an application when the browser is telling the user it is not secure. Features such as logins is an example of information that would be particularly vulnerable to attacks. Lastly, search engine optimization actually favors applications on HTTPS over HTTP.

This guide will start on a fully configured EC2 Ubuntu 20.04 instance, meaning it is assumed to already have Augur installed and running with all of its dependencies(PostgreSQL, Nginx, etc).

~~~~~~~~~~~~~~~~~~~~
Let's Encrypt/Certbot
~~~~~~~~~~~~~~~~~~~~

The easiest way to get an HTTPS server up is to make use of `Let's Encrypt <https://letsencrypt.org/>`_'s `Certbot <https://certbot.eff.org/>`_ tool. It is an open source tool that is so good it will even alter the nginx configuration for you automatically to enable HTTPS. Following their guide for ``Ubuntu 20.04``, run ``sudo snap install --classic certbot``, ``sudo ln -s /snap/bin/certbot /usr/bin/certbot``, and then ``sudo certbot --nginx``.

~~~~~~~~~~~~~~~~~~~
Fixing the Backend
~~~~~~~~~~~~~~~~~~~

Now our server is configured properly and our frontend is being served over HTTPS, but there's an extra problem: the backend APIs are still being served over HTTP resulting in a ``blocked loading mixed active content`` error. This issue is a deep rooted issue and serveral files need to be modified to accomodate HTTPS.

First, we will start with lines 29, 33, & 207 of ``augur/frontend/src/AugurAPI.ts`` and rewrite the URL to use the HTTPS protocol instead of HTTP. We will then do this again in ``augur/frontend/src/common/index.tx`` & ``augur/frontend/src/compare/index.ts`` where the ``AugurAPI`` constructor was called and passed an HTTP protocol. Next we need to configure gunicorn in the backend to support our SSL certificates, but by default certbot places these in a directory that requires root access. Copy these files by running ``sudo cp /etc/letsencrypt/live/<server name here>/fullchain.pem /home/ubuntu/augur/fullchain.pem`` and ``sudo cp /etc/letsencrypt/live/<server name here>/privkey.pem /home/ubuntu/augur/privkey.pem`` into augur's root directory, then change the user and group permissions with ``sudo chown ubuntu <filename.pem>`` and ``sudo chgrp ubuntu <filename.pem`` for both pem files. Now that the user permissions are set properly, gunicorn should be able to access them but we still need to add them to our gunicorn configuration document in ``augur/application.py``. Change the corresponding code block to look like this:

.. code-block:: python

self.gunicorn_options = {
'bind': '%s:%s' % (self.config.get_value("Server", "host"), self.config.get_value("Server", "port")),
'workers': int(self.config.get_value('Server', 'workers')),
'timeout': int(self.config.get_value('Server', 'timeout')),
'certfile': '/home/ubuntu/augur/fullchain.pem',
'keyfile': '/home/ubuntu/augur/privkey.pem'
}

6 changes: 3 additions & 3 deletions frontend/src/AugurAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export default class AugurAPI {
[key: string]: any// Add index signature
};

constructor(hostURL: string = 'http://localhost:5000', version: string = '/api/unstable', autobatch: any = null) {
constructor(hostURL: string = 'https://localhost:5000', version: string = '/api/unstable', autobatch: any = null) {
this.__downloadedGitRepos = []

this._version = version || '/api/unstable'
this._host = hostURL || 'http://localhost:5000'
this._host = hostURL || 'https://localhost:5000'
console.log(this._host)
this.__cache = {}
this.__timeout = null
Expand Down Expand Up @@ -204,7 +204,7 @@ abstract class BaseRepo {
[k: string]: any

constructor(parent: AugurAPI){
this._host = parent._host || 'http://localhost:5000'
this._host = parent._host || 'https://localhost:5000'
this._version = parent._version
this.__URLFunctionFactory = parent.__URLFunctionFactory
this.parent = parent
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var config = require('../frontend.config.json')
const AugurAPIModule = require('@/AugurAPI').default;
var port = config['Frontend'] ? (config['Frontend']['port'] ? ':' + config['Frontend']['port'] : '') : (config['Server']['port'] ? ':' + config['Server']['port'] : '')
var host = config['Frontend'] ? (config['Frontend']['host']) : (config['Server']['host'])
const AugurAPI = new AugurAPIModule('http://' + host + port);
const AugurAPI = new AugurAPIModule('https://' + host + port);

import Errors from './views/Errors.vue';
import Tables from './views/Tables.vue';
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/store/modules/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var config = require('../../../../frontend.config.json')
const AugurAPIModule = require('@/AugurAPI').default;
var port = config['Frontend'] ? (config['Frontend']['port'] ? ':' + config['Frontend']['port'] : '') : (config['Server']['port'] ? ':' + config['Server']['port'] : '')
var host = config['Frontend'] ? (config['Frontend']['host']) : (config['Server']['host'])
const AugurAPI = new AugurAPIModule('http://' + host + port);
const AugurAPI = new AugurAPIModule('https://' + host);

const state = {
// hasState: false,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/store/modules/compare/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var config = require('../../../../frontend.config.json')
const AugurAPIModule = require('@/AugurAPI').default;
var port = config['Frontend'] ? (config['Frontend']['port'] ? ':' + config['Frontend']['port'] : '') : (config['Server']['port'] ? ':' + config['Server']['port'] : '')
var host = config['Frontend'] ? (config['Frontend']['host']) : (config['Server']['host'])
const AugurAPI = new AugurAPIModule('http://' + host + port);
const AugurAPI = new AugurAPIModule('https://' + host);

const state = {
baseRepo: '',
Expand Down
6 changes: 3 additions & 3 deletions metadata.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#SPDX-License-Identifier: MIT
__name__ = "Augur"
__slug__ = "Augur: Monica"
__slug__ = "Augur: Muskellunge"
__url__ = "https://github.com/chaoss/augur"

__short_description__ = "Python 3 package for free/libre and open-source software community metrics, models & data collection"

__version__ = "0.25.19"
__release__ = "v0.25.19"
__version__ = "0.26.0"
__release__ = "v0.26.0"

__license__ = "MIT"
__copyright__ = "University of Missouri, University of Nebraska-Omaha, CHAOSS, & Augurlabs 2022"
80 changes: 1 addition & 79 deletions schema/create_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,82 +22,4 @@
\i schema/generate/95-schema_update_97.sql
\i schema/generate/96-schema_update_98.sql
\i schema/generate/97-schema_update_99.sql


-- prior update scripts incorporated into
-- augur.sql file for release v0.21.1
-- Update scripts
-- \i schema/generate/06-schema_update_8.sql
-- \i schema/generate/07-schema_update_9.sql
-- \i schema/generate/08-schema_update_10.sql
-- \i schema/generate/09-schema_update_11.sql
-- \i schema/generate/10-schema_update_12.sql
-- \i schema/generate/10-schema_update_12.sql
-- \i schema/generate/11-schema_update_13.sql
-- \i schema/generate/12-schema_update_14.sql
-- \i schema/generate/13-schema_update_15.sql
-- \i schema/generate/14-schema_update_16.sql
-- \i schema/generate/15-schema_update_17.sql
-- \i schema/generate/16-schema_update_18.sql
-- \i schema/generate/17-schema_update_19.sql
-- \i schema/generate/18-schema_update_20.sql
-- \i schema/generate/19-schema_update_21.sql
-- \i schema/generate/20-schema_update_22.sql
-- \i schema/generate/21-schema_update_23.sql
-- \i schema/generate/22-schema_update_24.sql
-- \i schema/generate/23-schema_update_25.sql
-- \i schema/generate/24-schema_update_26.sql
-- \i schema/generate/25-schema_update_27.sql
-- \i schema/generate/26-schema_update_28.sql
-- \i schema/generate/27-schema_update_29.sql
-- \i schema/generate/28-schema_update_30.sql
-- \i schema/generate/29-schema_update_31.sql
-- \i schema/generate/30-schema_update_32.sql
-- \i schema/generate/31-schema_update_33.sql
-- \i schema/generate/32-schema_update_34.sql
-- \i schema/generate/33-schema_update_35.sql
-- \i schema/generate/34-schema_update_36.sql
-- \i schema/generate/35-schema_update_37.sql
-- \i schema/generate/36-schema_update_38.sql
-- \i schema/generate/37-schema_update_39.sql
-- \i schema/generate/38-schema_update_40.sql
-- \i schema/generate/39-schema_update_41.sql
-- \i schema/generate/40-schema_update_42.sql
-- \i schema/generate/41-schema_update_43.sql
-- \i schema/generate/42-schema_update_44.sql
-- \i schema/generate/43-schema_update_45.sql
-- \i schema/generate/44-schema_update_46.sql
-- \i schema/generate/45-schema_update_47.sql
-- \i schema/generate/46-schema_update_48.sql
-- \i schema/generate/47-schema_update_49.sql
-- \i schema/generate/48-schema_update_50.sql
-- \i schema/generate/49-schema_update_51.sql
-- \i schema/generate/50-schema_update_52.sql
-- \i schema/generate/51-schema_update_53.sql
-- \i schema/generate/52-schema_update_54.sql
-- \i schema/generate/53-schema_update_55.sql
-- \i schema/generate/54-schema_update_56.sql
-- \i schema/generate/55-schema_update_57.sql
-- \i schema/generate/56-schema_update_58.sql
-- \i schema/generate/57-schema_update_59.sql
-- \i schema/generate/58-schema_update_60.sql
-- \i schema/generate/59-schema_update_61.sql
-- \i schema/generate/60-schema_update_62.sql
-- \i schema/generate/61-schema_update_63.sql
-- \i schema/generate/62-schema_update_64.sql
-- \i schema/generate/63-schema_update_65.sql
-- \i schema/generate/64-schema_update_66.sql
-- \i schema/generate/65-schema_update_67.sql
-- \i schema/generate/66-schema_update_68.sql
-- \i schema/generate/67-schema_update_69.sql
-- \i schema/generate/68-schema_update_70.sql
-- \i schema/generate/69-schema_update_71.sql
-- \i schema/generate/70-schema_update_72.sql
-- \i schema/generate/71-schema_update_73.sql
-- \i schema/generate/72-schema_update_74.sql
-- \i schema/generate/72-schema_update_74.sql
-- \i schema/generate/73-schema_update_75.sql
-- \i schema/generate/74-schema_update_76.sql
-- \i schema/generate/75-schema_update_77.sql
-- \i schema/generate/76-schema_update_78.sql
-- \i schema/generate/77-schema_update_79.sql
\i schema/generate/98-schema_update_100.sql
34 changes: 34 additions & 0 deletions schema/generate/98-schema_update_100.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
BEGIN;
-- ----------------------------
-- Table structure for chaoss_user
-- ----------------------------
DROP TABLE IF EXISTS "augur_data"."chaoss_user";
CREATE TABLE "augur_data"."chaoss_user" (
"chaoss_id" serial8 NOT NULL,
"chaoss_login_name" varchar COLLATE "pg_catalog"."default",
"chaoss_login_hashword" varchar COLLATE "pg_catalog"."default",
"chaoss_email" varchar COLLATE "pg_catalog"."default",
"chaoss_text_phone" varchar COLLATE "pg_catalog"."default",
"chaoss_first_name" varchar COLLATE "pg_catalog"."default",
"chaoss_last_name" varchar COLLATE "pg_catalog"."default",
"tool_source" varchar COLLATE "pg_catalog"."default",
"tool_version" varchar COLLATE "pg_catalog"."default",
"data_source" varchar COLLATE "pg_catalog"."default",
"data_collection_date" timestamptz(6) DEFAULT now()
)
;
ALTER TABLE "augur_data"."chaoss_user" OWNER TO "augur";

-- ----------------------------
-- Uniques structure for table chaoss_user
-- ----------------------------
ALTER TABLE "augur_data"."chaoss_user" ADD CONSTRAINT "chaoss_unique_email_key" UNIQUE ("chaoss_email");

-- ----------------------------
-- Primary Key structure for table chaoss_user
-- ----------------------------
ALTER TABLE "augur_data"."chaoss_user" ADD CONSTRAINT "chaoss_user_pkey" PRIMARY KEY ("chaoss_id");

update "augur_operations"."augur_settings" set value = 100 where setting = 'augur_data_version';

COMMIT;