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

chore(docs): Improve local installation guide #7320

Merged
merged 11 commits into from
Oct 19, 2020

Conversation

hongquan
Copy link
Member

@hongquan hongquan commented Oct 4, 2020

Fixes #

Short description of what this resolves:

This PR is to improve installation guide for development.

After this PR, another improvement in settings system should be added to make our software adapt better with different Postgres connection methods for various circumstance. For example:

  • For local development: Favor "ident" method (just need same username, no need password).
  • For prod where PostgreSQL stays in the same machine as backend: Favor "ident" method.
  • For container-based deployment: Follow database URL (because PostgreSQL run in other container), where password may not even needed, if we configure Postgres container to "trust" web app container.

Changes proposed in this pull request:

  • Short command to install dependency softwares.
  • Favor virtualenvwrapper for creating virtual environment (explanation is included).
  • Favor "ident" connection method for PostgreSQL in development.

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • All the functions created/modified in this PR contain relevant docstrings.

@codecov
Copy link

codecov bot commented Oct 4, 2020

Codecov Report

Merging #7320 into development will increase coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #7320      +/-   ##
===============================================
+ Coverage        64.12%   64.18%   +0.05%     
===============================================
  Files              259      259              
  Lines            13086    13126      +40     
===============================================
+ Hits              8392     8425      +33     
- Misses            4694     4701       +7     
Impacted Files Coverage Δ
app/api/admin_sales/utils.py 27.77% <0.00%> (-12.23%) ⬇️
app/api/helpers/query.py 54.54% <0.00%> (-1.98%) ⬇️
app/api/helpers/scheduled_jobs.py 59.18% <0.00%> (-0.82%) ⬇️
app/api/helpers/files.py 72.22% <0.00%> (-0.28%) ⬇️
app/api/helpers/notification.py 78.31% <0.00%> (-0.26%) ⬇️
app/api/events.py 37.31% <0.00%> (-0.19%) ⬇️
manage.py 0.00% <0.00%> (ø)
app/api/tax.py 52.45% <0.00%> (ø)
app/api/auth.py 23.82% <0.00%> (ø)
app/instance.py 87.77% <0.00%> (ø)
... and 56 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3d562fa...ffac77a. Read the comment docs.

scripts/heroku.sh Outdated Show resolved Hide resolved
sudo apt-get install python3.7
virtualenv -p python3.7 venv
. venv/bin/activate
xargs -a deb-packages.txt sudo apt install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should keep the dependencies explicitly listed here to avoid indirection and it's easier to track updates as well

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this deb-packages.txt will help deploy process, it allows deploy script to automatically install new dependency if it is added.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just added a note to README, to let developer know that the list of dependencies are in that file.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we use docker alpine to build the image, it doesn't help us in deployment particularly. Where else is it being used to install the dependencies?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamareebjamal If you write down:

sudo apt install libpq-dev
brew install python@3

as before this PR, does it help you build Alpine Docker container?

The old README doesn't help you build Alpine Docker container, why do you use Alpine as excuse to refuse this change?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this deb-packages.txt will help deploy process, it allows deploy script to automatically install new dependency if it is added.

I was commenting about this. Since we use alpine builds, debian dependencies don't help us in deployment process. Never said that the current docs help us in deployment process. Since, a separate file does not help us in the deployment process, why do we need to add an extra file and an indirection. Any change should have a net positive impact in the maintenance and developer experience.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@iamareebjamal

debian dependencies don't help us in deployment process

This PR doesn't interfere the deployment process. It is addressing the "local installation guide". Before this PR, the documentation is guiding beginner to setup development environment on Ubuntu/Debian, and this PR still focus on it.
If you want to improve deployment process, let's do it in separate PR.

Copy link
Member Author

@hongquan hongquan Oct 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add an extra file and an indirection

That extra file is to help developer install dependencies in one command, and also, if the dependencies list grows over time, it just make that file grow instead of this document. If you concern about list of packages staying in separate file, why don't you concern the requirements.txt, which is also a separate file to list dependencies?

deb-packages.txt Outdated Show resolved Hide resolved
.env.example Outdated Show resolved Hide resolved
.env.example Outdated Show resolved Hide resolved
docs/installation/local.md Outdated Show resolved Hide resolved
docs/installation/local.md Outdated Show resolved Hide resolved
docs/installation/local.md Outdated Show resolved Hide resolved
docs/installation/local.md Outdated Show resolved Hide resolved
docs/installation/local.md Outdated Show resolved Hide resolved
```sh
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
xargs -a deb-packages.txt sudo apt install
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repo is not cloned at this point. People will copy paste the command and be greeted with an error

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I move this command down to after "cloning".

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part is already after "cloning".

@iamareebjamal
Copy link
Member

Other that the pull rebase command, other changes LGTM

hongquan and others added 2 commits October 13, 2020 11:27
"rebase" instead of "merge".

Co-authored-by: Areeb Jamal <[email protected]>
@iamareebjamal iamareebjamal changed the title Improve local installation guide chore(docs): Improve local installation guide Oct 19, 2020
@auto-label auto-label bot added the docs label Oct 19, 2020
@iamareebjamal iamareebjamal merged commit 27588e5 into fossasia:development Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants