#100 Set up Happiness Packets development environment
Closed: complete 4 months ago by jflory7. Opened 5 months ago by jflory7.

Summary

  1. Follow setup instructions for a development environment
  2. Improve documentation if needed

Background

A development environment is important for working on fedora-happiness-packets. You need one to test your changes before making a pull request. It also makes it easy to test other peoples' changes too.

There are two main tasks for this ticket:

Follow setup instructions for a development environment

Run through the existing documentation to set up a development environment. Completing this helps you iterate new changes and test them. When you complete this, post a screenshot of fedora-happiness-packets running locally in your browser. :computer: :camera:

Improve documentation if needed

If everything correctly works, you don't need to do anything more. :100:

If the steps didn't work for you, compare what you did change to get it working to the documentation. If something is unclear or a step is missing, submit a pull request with the improvement. Additions don't need to be long – it's better to write in a more direct and simple way.

Details

Recommended documentation is published in our official documentation. If you have not worked with Sphinx docs or ReStructuredText docs before, see #108 for some helpful resources to get started.

Outcome

  • You successfully run a development environment on your own device
  • You can now make small changes and quickly test them out
  • Documentation improves so it is more accurate and/or easier to understand

Note: This issue will remain open until the end of the Summer Coding 2019 community bonding period. This ticket does not require an assignee to work on this task – it can be repeated by anyone.


Should we include possible errors and their solutions that a contributor might face when setting up the environment..???

@phoenixabhishek Use your best judgment for what you think is important. Since we use Docker containers, this hopefully reduces complexity.

One improvement could be linking the pre-requisites to installation instructions elsewhere, like the Docker docs or Fedora Developer Portal docs for installing Docker.

Metadata Update from @jflory7:
- Issue tagged with: PASSED

5 months ago

There are a few bugs that I ran into during the whole setup process, and the solutions took some time to understand and resolve.
Some were related to Docker, while some were OS specific (Windows) for files.
The Fedora Developer Portal docs are specific to Fedora systems.

Hey @jflory7 these are the issues that I had to go through for a successful project setup on my Windows system.
Please review and let me know if any part of this can be added :smile:
Thank you :smiley:

Issues and possible solutions during setting up Happiness Packets development environment on Windows


1. '.' is not recognized as an internal or external command


In this case, try removing the './' before the file name
Ex.: try generate_client_secrets.sh instead of ./generate_client_secrets.sh

2. /bin/sh: ./filename: not found


This error might occur when executing commands like ./generate_client_secrets.sh or ./manage.py by you or one of the build commands.

This occurs because of differences in the type of 'End of line sequence' used with files.

If it is CRLF, you'll have to change it to LF.

This can be done via the IDE
crlf-1.PNG
crlf-2.PNG

OR

You can use the following command in your cmd
cat filename.sh | sed '/\015/d' >newFilename.sh

Then rename the newFilename to the required filename.

Ex.: cat generate_client_secrets.sh | sed '/\015/d' >new_generate_client_secrets.sh
will give a new file by name 'new_generate_client_secrets.sh' rename this to 'generate_client_secrets.sh' and delete the old file.

More on this issue can be found here

3. fetch http://dl-cdn.alpinelinux.org/alpine/** error


when executing docker-compose up --build you might get an error of the following kind.

fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)

This can be solved by setting your DNS to static.

  • Open Docker -> Settings
  • Go to Network
  • Change 'DNS Server' from Automatic to Fixed
  • Change IP from 8.8.8.8 to 8.8.4.4

4. Windows named pipe error


For certain commands, you will need to have docker up and running already using docker-compose up

If you are getting this error while docker is still up, one of the required ports might have been already occupied.
You can restart Docker to fix this.

@phoenixabhishek I think the current guidelines are for macOS and Linux users. Maybe Windows-specific instructions are helpful to include.

I think a new ticket to write Windows-specific docs is helpful. This should belong in project documentation. @echoduck introduces Sphinx documentation in PR #65. Once it is merged, I will open a new ticket for Windows-specific instructions and you can work on it if you like. :smile:

@phoenixabhishek I think the current guidelines are for macOS and Linux users. Maybe Windows-specific instructions are helpful to include.
I think a new ticket to write Windows-specific docs is helpful. This should belong in project documentation. @echoduck introduces Sphinx documentation in PR #65. Once it is merged, I will open a new ticket for Windows-specific instructions and you can work on it if you like. 😄

Sure, once you open the ticket, please assign it to me, I already have a structure ready as you can see here. :smiley:

@phoenixabhishek Great, I'll work on getting the other PR merged so there is other documentation to work with. I'll ping you in the ticket once it is created.

Hi @jflory7 , now that PR #65 is merged, please let me know when to start with this one :smile:

@jflory7 please assign the tasks to me as you have stated that i should on it

Hi @jflory7, Is this also a task that multiple outreachy applicants can work on similar to #103 ?

@jflory7 please assign the tasks to me as you have stated that i should on it

@feisal You can start working on this task. You do not need permission to work on it. See the note at the bottom of the ticket:

Note: This issue will remain open until the end of the Summer Coding 2019 community bonding period. This ticket does not require an assignee to work on this task – it can be repeated by anyone.

Hi @jflory7, Is this also a task that multiple outreachy applicants can work on similar to #103 ?

@anasustic Yes, this task can be repeated by anyone. :thumbsup:

The goal is to get a working development environment with Docker. You will learn about some of the tools used to deploy fedora-happiness-packets if you are not familiar with them. You can post a screenshot in this ticket when you have done it. If you have questions while running through this ticket, feel free to ask here. :grinning:

@jflory7 can I request a snap of what is the expected output when ./manage.py test -v 2 -p integration_test*.py --settings=happinesspackets.settings.tsting is run.

I am getting output, but it doesn't look right to me.
This is my O/P:

manage-py-op.PNG

@phoenixabhishek I receive the same output on my end. I am not familiar with how unit testing is currently done to know more. For the purpose of this ticket, this is working as expected. The mentors may identify new tasks about writing new unit tests soon.

@jflory7 thank you for your response.
In that case I have all the contents needed for a clear documentation.
It should be ready by tomorrow if all goes well.
Should I share the first draft of the document on this thread or on #108 once it is ready before creating a pull request..???

@phoenixabhishek Let's use ticket #108 since you are working on Windows-specific documentation. Thanks!

@jflory7 I have added useful links for installing Docker and Docker Compose in PR #117 Please find the time to review. Thanks! :)

The bin/bash ./filename not found error can be fixed using the IDE....For instance, you can use sublime text and go to view=>line endings and select UNIX from the options....it fixes the issue

Hey @jflory7 these are the issues that I had to go through for a successful project setup on my Windows system.
Please review and let me know if any part of this can be added 😄
Thank you 😃
Issues and possible solutions during setting up Happiness Packets development environment on Windows

  1. '.' is not recognized as an internal or external command

In this case, try removing the './' before the file name
Ex.: try generate_client_secrets.sh instead of ./generate_client_secrets.sh
2. /bin/sh: ./filename: not found

This error might occur when executing commands like ./generate_client_secrets.sh or ./manage.py by you or one of the build commands.
This occurs because of differences in the type of 'End of line sequence' used with files.
If it is CRLF, you'll have to change it to LF.
This can be done via the IDE
crlf-1.PNG
crlf-2.PNG
OR
You can use the following command in your cmd
cat filename.sh | sed '/\015/d' >newFilename.sh
Then rename the newFilename to the required filename.
Ex.: cat generate_client_secrets.sh | sed '/\015/d' >new_generate_client_secrets.sh
will give a new file by name 'new_generate_client_secrets.sh' rename this to 'generate_client_secrets.sh' and delete the old file.
More on this issue can be found here
3. fetch http://dl-cdn.alpinelinux.org/alpine/** error

when executing docker-compose up --build you might get an error of the following kind.
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz: temporary error (try again later)
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
WARNING: Ignoring http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz: temporary error (try again later)
This can be solved by setting your DNS to static.

Open Docker -> Settings
Go to Network
Change 'DNS Server' from Automatic to Fixed
Change IP from 8.8.8.8 to 8.8.4.4

  1. Windows named pipe error

For certain commands, you will need to have docker up and running already using docker-compose up
If you are getting this error while docker is still up, one of the required ports might have been already occupied.
You can restart Docker to fix this.

Hi All,
I installed Docker and Docker Compose on a brand new Ubuntu 18.04.2 system.
I get an error at step 2 of the Setting up a development environment Run the client secret generation script: since there is no generate_client_secrets.sh. I am sure I am missing a step here :)
Thanks,
Ana

I get an error at step 2 of the Setting up a development environment Run the client secret generation script: since there is no generate_client_secrets.sh. I am sure I am missing a step here :)

Hi @anasustic. You should see the generate_client_secrets.sh script in the repo. You should run the script before starting Docker.

Be sure to clone the repository and enter the root directory before following the instructions on the website.

Hi! I followed the documentation to set up my development environment and the installation was very smooth. I attach the screenshot to prove it, and I must say that I'm very excited to get working on this project.
devenv.png

Hi 🙂

I followed the documentation to setup my development environment.
I am running the development environment on Ubuntu 18.04.2 system inside a VirtualBox and accessing it over SSH from my host machine which is a Win10 laptop. This works really well using a Host Network on one of the interfaces of the host and virtual machine so they can see each other.
I had to add my virtual machine box IP in ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'virtual_machine_IP'] setting for this setup to work.

The instructions how to setup the development environment were really clear.
I am a newbie with docker. I missed in the instructions the setp to verify if the logged in user is member of the docker group sudo usermod -aG docker ${USER} and if it is not add it using sudo gpasswd -a ${USER} docker. The error I was getting before doing that was ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running? This user rights problem is somewhat described in Fedora Developers Portal docs.

@jflory7 do I create a PR for this?

site.JPG
terminal.JPG

Hi,
The test suite ran according to the documentation.
The inegration tests ran also according to the documentation but there were 0 tests to run.

test.JPG

Hi @anasustic ,
It's great to hear that you were successful with the setup :confetti_ball: :confetti_ball: :confetti_ball: :confetti_ball: :confetti_ball:

About the tests, that's precisely what we are getting now too as pointed by @jflory7 too here

@mauaraujo @anasustic Great, I'm glad both of you got it running! :tada:

I missed in the instructions the setp to verify if the logged in user is member of the docker group sudo usermod -aG docker ${USER} and if it is not add it using sudo gpasswd -a ${USER} docker. The error I was getting before doing that was ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

@anasustic This would be a useful thing to catch in a Frequently Asked Questions page. I created a new FAQ page in the docs. Do you want to document this there?

@jflory7 Thanks! I will give it a try 😊

Hi,
I am getting an error fatal: unable to access 'https://pagure.io/forks/anasustic/fedora-commops/fedora-happiness-packets.git/': The requested URL returned error: 403 when I push my update to my fork.
I created my SSH key following https://docs.pagure.org/pagure/usage/first_steps.html and also added the SSH public key to my pagure.io account.

Is there a step I am missing or it takes some time to get setup?
Thanks,
Ana

On Saturday, March 2, 2019 4:19:36 PM EST Ana Sustic wrote:

anasustic added a new comment to an issue you are following:
Hi, I am getting an error ```fatal: unable to access 'https://pagure.io/forks/anasustic/fedora-commops/fedora-happiness-packets. git/': The requested URL returned error: 403``` when I push my update to my fork. I created my SSH key following https://docs.pagure.org/pagure/usage/first_steps.html and also added the public key to my pagure.io account. Is there a step I am missing or it takes some time to get setup? Thanks, Ana

To reply, visit the link below or just reply to this email
https://pagure.io/fedora-commops/fedora-happiness-packets/issue/100

git remote set-url origin ssh://git@pagure.io/forks/anasustic/fedora- happiness-packets.git

You can't push to an HTTP(S) URI with Pagure.

--
John M. Harris, Jr. johnmh@splentity.com
Splentity
https://splentity.com/

I will look at my terminal history because I ran into some errors that were not addressed in the guide but I cant remember them off the top of my head

docker.jpg

I had to use sudo docker-compose up, because without the sudo it didn't work. Maybe its only a small detail for some people, but it had me googleing for some time, I think it would be nice to add it to the guide as an option if "docker-compose up" fails.

On Saturday, March 2, 2019 4:19:36 PM EST Ana Sustic wrote:

anasustic added a new comment to an issue you are following:
Hi,
I am getting an error fatal: unable to access 'https://pagure.io/forks/anasustic/fedora-commops/fedora-happiness-packets. git/': The requested URL returned error: 403 when I push my update to my
fork.
I created my SSH key following
https://docs.pagure.org/pagure/usage/first_steps.html and also added the
public key to my pagure.io account. Is there a step I am missing or it
takes some time to get setup? Thanks,
Ana
To reply, visit the link below or just reply to this email
https://pagure.io/fedora-commops/fedora-happiness-packets/issue/100

git remote set-url origin ssh://git@pagure.io/forks/anasustic/fedora-
happiness-packets.git
You can't push to an HTTP(S) URI with Pagure.
--
John M. Harris, Jr. johnmh@splentity.com
Splentity
https://splentity.com/

Great. Thanks @johnmh
@jflory7 would it be ok to add another item about how to push a change to a fork in pagure.io to the FAQ?

I followed the guidelines https://docs.pagure.org/pagure/usage/first_steps.html but was missing the step git remote set-url origin ssh://git@pagure.io/forks/<user_name>/fedora-commops/fedora-happiness-packets.git before pushing a change from my local repo to my fork

Hi!
I followed the documentation provided and have finished setting up the development environment.The documentation was lucid and really helpful.It feels amazing to be on board and start learning as a part of this community.😊

fedoraworkin1.png
fedoraworking.png

@jflory7 should we post the screenshots on this thread, kindly advise

I had to use sudo docker-compose up, because without the sudo it didn't work. Maybe its only a small detail for some people, but it had me googleing for some time, I think it would be nice to add it to the guide as an option if "docker-compose up" fails.

@nynaeve Looks like @anasustic caught this in PR #132. This likely happened because your user account was not a member of the docker group. We now have this addressed in the FAQ. :tada:

@jflory7 would it be ok to add another item about how to push a change to a fork in pagure.io to the FAQ?

I followed the guidelines https://docs.pagure.org/pagure/usage/first_steps.html but was missing the step git remote set-url origin ssh://git@pagure.io/forks/<user_name>/fedora-commops/fedora-happiness-packets.git before pushing a change from my local repo to my fork

@anasustic Actually I think improving the Pagure documentation is an excellent idea. The source file for the doc page you were looking at is here. It might help to add a note there to remind someone to always use SSH URLs when cloning a repository.

Are you interested in doing this? If so, let me know if you need any guidance on submitting an improvement to Pagure's usage docs.

I followed the documentation provided and have finished setting up the development environment.The documentation was lucid and really helpful.It feels amazing to be on board and start learning as a part of this community.

@aditisol7 Woot woot! :tada: :tada: Nice work. You can check out #103 for a next task to try working on. :mag:

@jflory7 should we post the screenshots on this thread, kindly advise

@gichboi Yep, if everything is working for you, feel free to post up a screenshot here. :grinning:

Fedora packets is running locally,
Screen_Shot_2019-03-04_at_1.32.48_AM.png

Hi!
I'm happy to hop on board the happiness packets train :) I was able to set up the local environment as shown below:
fedora_happiness_packets.png

However, I did run into a small issue, perhaps it's because I am quite new to learning how to set up a local development environment and using git in general, but I was confused on where to execute ./generate_client_secrets.sh. I think it would be great to add that you need to fork and clone the repository after setting up Docker, then change into that directory to find and execute generate_client_secrets.sh. I think this addition would be helpful for beginners like me who need all the guidance they can get when venturing into open source!

I'm happy to hop on board the happiness packets train :) I was able to set up the local environment as shown below:

Congratulations @janyu99 :confetti_ball: :confetti_ball: :confetti_ball: :confetti_ball: :confetti_ball: on your successful setup.

Your suggestion on adding steps to direct users to appropriate directory is surely something that can be added to make the document better.

Infact, it can be your very first contribution to this project as well. :smile: :smile: :smile: :smile: :smile:

Will you be interested to take this up..???

Fedora packets is running locally,

I'm happy to hop on board the happiness packets train :) I was able to set up the local environment as shown below:

@joycenamuli @janyu99 Excellent, glad you both got it started! :tada: :tada:

I was confused on where to execute ./generate_client_secrets.sh. I think it would be great to add that you need to fork and clone the repository after setting up Docker, then change into that directory to find and execute generate_client_secrets.sh.

@janyu99 Good point. Now that you point it out, I realize some skips were stepped to get there. Do you want to help improve the documentation as a first task or leave it open for someone else to work on? Both choices are equally okay. :thumbsup:

@phoenixabhishek @jflory7 Yes, I would be happy to work on this improvement! It'll be a great starting point for me :grin:

@janyu99 I ran into the same issue when I needed to execute ./generate_client_secrets.sh as described in one of my previous comments. I am aware cloning the repo after installing Docker is a very obvious step for a seasoned contributer but for us newbies is not :)

@jflory7 I will give the Pagure's usage doc first_steps.rst a try :) Here is my pull request.

@anasustic Super, thanks for opening that! :tada: I'll follow along in that Pagure PR.

And we are up and running! The documentation is pretty neat.
However I got this error when running Docker compose, in the beginning :
[ERROR: An HTTP request took too long to complete. Retry with --verbose to obtain debug information.
If you encounter this issue regularly because of slow network conditions, consider setting COMPOSE_HTTP_TIMEOUT to a higher value (current value: 60).]
I solved this by restarting Docker.
Screenshot_2019-03-04_at_21.22.38.png
Screenshot_2019-03-04_at_21.32.23.png

And we are up and running! The documentation is pretty neat.

Awesome! :tada:

I solved this by restarting Docker.

This could be a good addition to the FAQ page of the docs. Do you want to add this there in a pull request?

https://pagure.io/fedora-commops/fedora-happiness-packets/blob/master/f/docs/faq.rst

And we are up and running! The documentation is pretty neat.

Awesome! 🎉

I solved this by restarting Docker.

This could be a good addition to the FAQ page of the docs. Do you want to add this there in a pull request?
https://pagure.io/fedora-commops/fedora-happiness-packets/blob/master/f/docs/faq.rst

I will get right on it!

I am having troubles in running the web server. I can't seem to understand the error. Someone please help me :3
Screenshot_from_2019-03-06_20-44-03.png

The redis server is working. Celery shows this:

Screenshot_from_2019-03-06_20-45-05.png

@sanjana11147 it looks like the port needed for redis (in your case, 0.0.0.0:6379) is already used by another process.
You can run sudo netstat -lnp to see what process is running on the port and then end that process to release it.

I will get right on it!

Thanks @severusho! If you have any questions about how to do this, come say hi to the CommOps team for guidance.

I am having troubles in running the web server. I can't seem to understand the error. Someone please help me :3

Hey @sanjana11147, I agree with @phoenixabhishek's analysis. Looks like Redis is already running on your machine. You can also use grep to filter for that specific port:

sudo netstat -tulpn | grep 6379

Thank you so much @phoenixabhishek and @jflory7 :)
I found the problem and Fedora Happiness is running successfully locally. :raised_hands:

Thank you so much @phoenixabhishek and @jflory7 :)
I found the problem and Fedora Happiness is running successfully locally. 🙌

Awesome! Glad that did the trick for you. :confetti_ball:

As a side note, this isn't the first time this has happened. It is a good idea to add this to the FAQ page about how to debug if Redis is already running.

@jflory7 I agree, this can be a good first issue for someone to work on :thumbsup: :thumbsup: :thumbsup: :thumbsup: :thumbsup:

Should I open a ticket for it? @jflory7

Should I open a ticket for it? @jflory7

@sanjana11147 Since this is a quick improvement to the docs, feel free to send a new pull request directly for this. :thumbsup:

Hii @jflory7 , I have made a PR for this. Please review :)

The development environment is up and running.

A little observation though celery too is running but with a warning screen. "WindowsError: the parameter is incorrect". I use a virtual environment wrapper and not docker here.

A read up shows that celery4 is not supported on window? Any advise Pls?

A little observation though celery too is running but with a warning screen. "WindowsError: the parameter is incorrect". I use a virtual environment wrapper and not docker here.

A read up shows that celery4 is not supported on window? Any advise Pls?

Hi @adetola, I am unable to reproduce this as I don't have access to a Windows machine. This is one advantage to using containers / Docker though. When you use Docker, we will also have the same container environment for testing and debugging.

There may be incompatibilities with some libraries on Windows, but I'm not sure. If you are on Windows, I think it helps to use the Docker method for your development environment.

OK. I currently use win32 the Docker method works on win64. I am at a cross road. Thank you Sir for your response.

Hi all! Thanks everyone who participated with Fedora during the Outreachy application cycle. Since the application period closed today, I am closing this ticket as complete. :clapper:

An extra thanks goes to everyone who helped mentor and guide others who faced problems in this ticket. :blush:

Metadata Update from @jflory7:
- Issue close_status updated to: complete
- Issue status updated to: Closed (was: Open)

4 months ago

Login to comment on this ticket.

Metadata
Attachments 18
Attached 5 months ago View Comment
Attached 5 months ago View Comment
Attached 5 months ago View Comment
Attached 4 months ago View Comment
Attached 4 months ago View Comment
Attached 4 months ago View Comment
Attached 4 months ago View Comment
Attached 4 months ago View Comment
Attached 4 months ago View Comment
Attached 4 months ago View Comment
Attached 4 months ago View Comment