Difference between revisions of "Dev Getting Started"

From Dreamwidth Notes
Jump to: navigation, search
(correct links)
m (no more free/nonfree)
 
(71 intermediate revisions by 12 users not shown)
Line 1: Line 1:
Welcome to Dreamwidth code development! This page is a guide to how to get started with hacking on the Dreamwidth code.  
+
Welcome to Dreamwidth code development! This page is a guide to how to get started with hacking on the Dreamwidth code. It's intended to cover all steps of the process from the very beginning, but each individual step is a brief overview -- follow the links for more detail. If you're confused about anything here, you can ask us in <dwcomm>dw-dev-training</dwcomm> or the latest <dwcomm>dw-dev</dwcomm> [https://dw-dev.dreamwidth.org/tag/questions question thread], or come talk to us in the [https://dw-dev.dreamwidth.org/209778.html Discord] [[Chat]] channels. One-on-one mentorship may be available if time permits.
 +
 
 +
This is geared at people who have little to no development experience. If you've got more experience and just need the details of how our project differs from other open source projects out there, check out the [[Dev Quick Start]] list.
  
 
The languages and skills Dreamwidth development uses are:
 
The languages and skills Dreamwidth development uses are:
  
 
* Perl (the majority of the project)
 
* Perl (the majority of the project)
* [[BML]] (custom templating language)
+
* [[BML]] (custom templating language inherited from LiveJournal which we are currently phasing out)
* HTML
+
* [[Routing and Template Toolkit|TT]] (Template Toolkit - better templating language, used for new pages)
* Javascript
+
* [[Styles|S2]] (custom templating language used in journal styles)
* MySQL
+
* HTML / CSS / [[Foundation]]
 +
* Javascript / JQuery
 +
* MySQL and DBI (the Perl interface to MySQL and other SQL databases)
 +
* Test::More (for writing automated tests)
 +
 
 +
You don't need to know them all! Some familiarity with at least one will be helpful, but we welcome people at all levels, and are happy to answer questions and give advice as long as you're willing to learn.
 +
 
 +
 
 +
== One time only: Initial setup ==
 +
 
 +
What you need:
 +
 
 +
=== A working Dreamwidth installation ===
 +
 
 +
To hack on the Dreamwidth code, you'll need a development environment: a place where you can install the Dreamwidth code yourself, to make changes and submit them.  We offer hosted sandbox development environments where we'll install the code for you. We call them [[Dreamhacks]], and they're available free of charge for anyone who's interested in contributing to the project. (It's possible for you to install the code yourself on your own server, but we don't recommend it for beginners. Even the most experienced Dreamwidth developers mostly work on Dreamhacks.)
 +
 
 +
* [http://hack.dreamwidth.net/ Apply for a Dreamhack]: this will give you a hosted development environment with everything already ready for you to get started.
 +
 
 +
* Go through the [[Beginning dev checklist]] and follow along with the steps for getting your Dreamhack account set up. Most of these steps are tasks you'll only have to do once to make sure your development environment is set up to hack on.
 +
 
 +
=== A GitHub account ===
 +
 
 +
[[Git Getting Started | GitHub]] is the version control system we use. It keeps the "master version" of the Dreamwidth code, keeps track of the changes you make, and allows you to submit those changes to us for us to review and incorporate them.
 +
 
 +
* Create a GitHub account with your preferred username.
 +
 
 +
* [https://help.github.com/articles/fork-a-repo/ Fork] the [https://github.com/dreamwidth/dreamwidth/ dreamwidth] repository from the Dreamwidth organization.
 +
 
 +
===A basic sense of the code structure and how to find things===
 +
 
 +
You aren't going to know everything right up front, of course, but there are a few things you can look through and familiarize yourself with.
 +
 
 +
* Familiarize yourself with Perl, the language that the majority of DW development is done in. The best reference that we've found to point people at is [http://www.ebb.org/PickingUpPerl/ Picking Up Perl]. You absolutely don't need to be a Perl guru to submit a patch, but you should be familiar with the basic syntax.
 +
 
 +
* If you'd like to practice first, check out [https://openhatch.org/missions/ OpenHatch's Training Missions] -- they'll let you practice with some of the tools you might need! (In particular, you might find their Git training mission helpful.)
 +
 
 +
* Browse through some of the [http://github.com/dreamwidth/dw-free Dreamwidth source code] to get a good sense of where things are and what the setup looks like. The basic directory structure, as well as some guidelines about what goes where, can be found in [[Directory Structure]].
 +
 
 +
* Read the [[Programming Guidelines]]. (You may not understand all of the items there, but you can familiarize yourself with them, and start noticing when existing code doesn't follow the rules as you read.)
 +
 
 +
* If you start to get overwhelmed, don't worry! Go do something else for a bit and come back to this later -- this doesn't all have to be done at once. You can read an old [http://azurelunatic.dreamwidth.org/6731755.html dev pep-talk].  Also, have a look through the Epic List of [[Things Real Dreamwidth Programmers Do]] if you start feeling a bit of [https://en.wikipedia.org/wiki/Impostor_syndrome impostor syndrome]. Finally, you can always ask for help in irc or in <dwcomm>dw-dev-training</dwcomm> -- everybody who's working on the project now was in your shoes at one point, and we all remember what it's like to feel overwhelmed and over our heads. We want to help you!
  
To hack on the Dreamwidth code, you'll need a development environment: a place where you can install the Dreamwidth code yourself, to make changes and generate patches.  
+
* If you run into problems following any of these instructions, we also want to know about it so we can fix this documentation. You can let us know in irc or in <dwcomm>dw-dev-training</dwcomm>, or make a note on the [[Dev Wanted How-To]] or [[Installation Wanted How-To]] pages to describe what you found confusing.
  
If you have the means and desire to install your own development environment, there are resources in the [[:Category:Dreamwidth Installation|Dreamwidth Installation category]].  The original LJ Server documentation is [http://www.livejournal.com/doc/server/ here].  You might also find the [http://wiki.ljcode.org/ LJCode wiki] useful. (We know that the install documentation isn't all that great at the moment, and we'd love it if you keep notes on this wiki as you go.)
+
== Finding something to work on ==
  
If all of that seems like too much of a headache, we offer hosted sandbox development environments where we'll install the code for you. We call them [[Dreamhacks]], and they're available free of charge for anyone who's interested in contributing to the project. Information on how to apply can be found at the [http://hack.dreamwidth.net/ main Dreamhack page].
+
Once you've gone through the initial setup, pick an issue to work on. The issues are kept in [http://wiki.dreamwidth.net/wiki/index.php/Github_Issues GitHub Issues].
  
==The short version==
+
* Look through the [https://github.com/dreamwidth/dw-free/labels/curated:%20beginner curated:beginner] label for issues that someone thinks would make a good first issue to work on. From time to time, people also post lists of "[http://dw-dev-training.dreamwidth.org/tag/babydev+bait babydev bait]" to <dwcomm>dw_dev_training</dwcomm>, and there is [http://dw-dev-training.dreamwidth.org/45772.html a masterlist].
  
For those who are experienced enough to not need a walkthrough:
+
* Let people know that you're working on the bug by assigning it to yourself. Comment on the issue you've chosen with some variation on the word "claim" ("claim", "claimed" and "claiming" all work, and can be surrounded by any other text). This will trigger our bot to assign the issue to you.
  
To browse the Dreamwidth code, you can look at the [http://hg.dwscoalition.org/ Mercurial repository]; the main parts of the code you will be interested in are in <tt>dw-free</tt>. To see the changes being made to the Dreamwidth code, look at <dwcomm>changelog</dwcomm>, which automatically posts commits.
+
* [[Git How To#How to create a new branch for feature development / bugfixes|Create a new branch in git for this issue]] so you have a place to make your changes.
  
You can find information on how to keep your code updated on [[Dev Maintenance]], information on programming style on [[Dev Programming Guidelines]], information on finding things in [[Dev Finding Things]], and information on submitting patches on [[Dev Patches]].  There is a [http://bugs.dwscoalition.org/buglist.cgi?query_format=advanced&short_desc_type=allwordssubstr&short_desc=&long_desc_type=substring&long_desc=&bug_file_loc_type=allwordssubstr&bug_file_loc=&keywords_type=allwords&keywords=&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailtype1=substring&email1=&emailassigned_to2=1&emailreporter2=1&emailqa_contact2=1&emailcc2=1&emailtype2=substring&email2=&bugidtype=include&bug_id=&chfie comprehensive bug list] as well as other useful info on [[Bugzilla]].  See [[Development]] for a more complete reading list, or look through the pages in [[:Category:Development]].
+
== Making your changes ==
  
Before any of your patches are committed, we'll need a [[CLA|contributor licensing agreement]] on file from you.
+
* Make sure your git repository is [[Dev_Maintenance#Updating_dw-free|up to date]].
  
Developers should check out the documentation on [[Design]] as well.
+
* Make your changes, probably in your [[Dreamhacks|Dreamhack]] ([[Beginning_dev_checklist#Editors|editing text files]], though the tricky part is [[Dev Finding Things|finding things]]).
  
==The long version==
+
* [[Dev_Maintenance#Restart_the_server|Restart Apache]] and test your changes on the Dreamhack. It's a good idea to test multiple use cases, including logged in/not logged in, community vs personal journal (if applicable), personal journal with different settings, etc.
  
If you're totally new to programming and/or contributing to Open Source projects, don't worry! We'll walk you through the process.  
+
* [[Git How To#The_Basics|Commit your changes to git.]]
  
Your best source of real-time information, including help for what to do when you totally break something, is the [irc://irc.dreamwidth.org/dw_kindergarten #dw_kindergarten] [[IRC]] channel, where there are people willing to mentor who can figure out where your abilities are at and how to best apply them.  We also have a Dreamwidth community: <dwcomm>dw_dev_training</dwcomm>. It's a good idea to watch both that and the <dwcomm>dw_dev</dwcomm> community.
+
* [[Git How To#The_Basics|Push your new git branch to your github account.]]
  
Here's a step-by-step checklist for getting started hacking on the Dreamwidth code.
 
  
1. Get a development environment. We run the [[Dreamhacks|Dreamhack]] service so you won't have to install and configure the code yourself, so all you need to do is apply for a Dreamhack account.
+
== Submitting your changes ==
  
2. Read over the [[Beginning dev checklist]] and follow along with the steps for getting your Dreamhack account set up. Most of these steps are tasks you'll only have to do once to make sure your development environment is set up to hack on.
+
* Once you're satisfied that your changes fix the issue and don't introduce any new bugs, [[Git How To#How to submit a pull request|open a pull request.]] This sends your changes to us for us to look over in [[Code Review|review]].
  
3. If you run into problems and have to ask for help, be sure to make a note on the [[Dev Wanted How-To]] or [[Installation Wanted How-To]] pages after you get the problem fixed, so someone can make sure to document it for someone else having the same problem. (Or, write a Wiki article on how you fixed it! Even if you don't entirely understand the fix, you can write down the steps you took to fix the problem as a starting point.)
+
* A senior Dreamwidth developer will look over your changes and see if they can be accepted or if there are things you need to change. If there are things that could be improved, the reviewer will comment on the commit and give you notes on what can be improved. Don't worry if your changes don't pass review on the first time -- it's really common for pull requests to go through several versions before they're committed.
  
4. Familiarize yourself with Perl, the language that the majority of DW development is done in. The best reference that we've found to point people at is [http://www.ebb.org/PickingUpPerl/ Picking Up Perl]. You absolutely don't need to be a Perl guru to submit a patch, but you should be familiar with the basic syntax.
+
* If your pull request needs more changes, you can go back to the branch you made for the change and make those changes. Once you commit them to your branch and [[Git How To#The_Basics|push your changes]] to make them public, the pull request will update automatically. However, this doesn't fire off a notification to the folk reviewing the code, so please leave a comment on your pull request to let people know that the requested changes have been made!
  
5. Browse through some of the [http://hg.dwscoalition.org/dw-free/file/tip/ Dreamwidth source code] to get a good sense of where things are and what the setup looks like. The basic directory structure, as well as some guidelines about what goes where, can be found in [[Main development folder]].  
+
* When your pull request is accepted, the person who accepts it will close the pull request and the issue that the pull request fixed.
  
6. Read the [[Programming Guidelines]]. (You may not understand all of the items there, but you can familiarize yourself with them, and start noticing when existing code doesn't follow the rules as you read.)
+
== The next fix! ==
  
7. Send in a signed [[Contributor Licensing Agreement]], or CLA. We need to have that on file before we accept any of your contributions.
+
* Once your pull request is accepted and merged into the main branch, you can delete the branch for that issue on your GitHub account.
  
8. Pick a bug that you want to work on! Some useful [[Bugzilla]] searches are pre-recorded for you: go to the Preferences link and pick the Saved Searches tab. You probably want to at least look at the all-unassigned query, and probably want to also look at the unassigned-effortminor query (as the ones that are most likely suitable for beginning developers). From time to time, people also post lists of "babydev bait" to <dwcomm>dw-dev-training</dwcomm>.
+
* Switch back to the 'master' branch on your Dreamhack and update to the most current code.
  
9. Set the bug to "Assigned" and put your Bugzilla email address in the "Assigned To" field. This tells people that you're working on it.
+
* Pick the next issue to work on!
  
10. Make your fixes. Be sure to test! It's a good idea to test multiple use cases, including logged in/not logged in, community vs personal journal (if applicable), personal journal with different settings, etc.
+
== Further reading ==
  
11. Generate a [[Patches|patch]] and upload it to Bugzilla. Be sure to set the review? and commit? flags, so code reviewers and committers know about your patch and can review it.
+
This is a brief overview of the process. There are plenty of places to go for more information. Useful wiki pages include:
  
12. If your patch passes review, it'll be committed. If there are things that could be improved, the reviewer will set the flags to commit- and review- and give you notes on what can be improved. Don't worry if your patch doesn't pass review on the first time -- it's really common for patches to go through several versions before they're committed.
+
* [[Dev Finding Things]] - getting around the code base and figuring out where to start when looking for a specific feature
 +
* [[Dev Programming Guidelines]] - programming style
 +
* [[Design]] - things to keep in mind when designing features. Developers, please take note of this page!
 +
* [[Dev Maintenance]]  - how to keep your code updated
 +
* [[Git How To]] - basic commands for keeping track of your changes using version control. Also includes instructions for submitting those changes via a pull request
 +
* [[Git Getting Started]] - a collection of resources for using Git
 +
* [[Github Issues]] - instructions for filing and claiming bugs to work on
 +
* [[Development]] - another list of stuff that might be useful for you at some point, in particular [[Development#Customising_Your_Dev_Environment | Customising Your Dev Environment]] (for instructions on setting up the Support Board, enabling Beta Features, and so on)
 +
* [[:Category:Development]] - every page tagged with the Development category on the wiki
  
 
==What'd we miss?==
 
==What'd we miss?==
  
If you run into anything in the process that isn't well-documented, or you have questions, you can ask in the <dwcomm>dw_dev_training</dwcomm> community or in the #dw_kindergarten irc channel. You should also make a note on the [[Dev Wanted How-To]] or [[Installation Wanted How-To]] wiki pages so we can document it better for the next person to come along!
+
If you run into anything in the process that isn't well-documented, or you have questions, you can ask in the <dwcomm>dw_dev_training</dwcomm> community or in the #dreamwidth-dev irc channel. You should also make a note on the [[Dev Wanted How-To]] or [[Installation Wanted How-To]] wiki pages so we can document it better for the next person to come along!
  
 
[[Category: Getting Started]]
 
[[Category: Getting Started]]
 
[[Category: Development]]
 
[[Category: Development]]

Latest revision as of 22:09, 17 December 2022

Welcome to Dreamwidth code development! This page is a guide to how to get started with hacking on the Dreamwidth code. It's intended to cover all steps of the process from the very beginning, but each individual step is a brief overview -- follow the links for more detail. If you're confused about anything here, you can ask us in [info]dw-dev-training or the latest [info]dw-dev question thread, or come talk to us in the Discord Chat channels. One-on-one mentorship may be available if time permits.

This is geared at people who have little to no development experience. If you've got more experience and just need the details of how our project differs from other open source projects out there, check out the Dev Quick Start list.

The languages and skills Dreamwidth development uses are:

  • Perl (the majority of the project)
  • BML (custom templating language inherited from LiveJournal which we are currently phasing out)
  • TT (Template Toolkit - better templating language, used for new pages)
  • S2 (custom templating language used in journal styles)
  • HTML / CSS / Foundation
  • Javascript / JQuery
  • MySQL and DBI (the Perl interface to MySQL and other SQL databases)
  • Test::More (for writing automated tests)

You don't need to know them all! Some familiarity with at least one will be helpful, but we welcome people at all levels, and are happy to answer questions and give advice as long as you're willing to learn.


One time only: Initial setup

What you need:

A working Dreamwidth installation

To hack on the Dreamwidth code, you'll need a development environment: a place where you can install the Dreamwidth code yourself, to make changes and submit them. We offer hosted sandbox development environments where we'll install the code for you. We call them Dreamhacks, and they're available free of charge for anyone who's interested in contributing to the project. (It's possible for you to install the code yourself on your own server, but we don't recommend it for beginners. Even the most experienced Dreamwidth developers mostly work on Dreamhacks.)

  • Apply for a Dreamhack: this will give you a hosted development environment with everything already ready for you to get started.
  • Go through the Beginning dev checklist and follow along with the steps for getting your Dreamhack account set up. Most of these steps are tasks you'll only have to do once to make sure your development environment is set up to hack on.

A GitHub account

GitHub is the version control system we use. It keeps the "master version" of the Dreamwidth code, keeps track of the changes you make, and allows you to submit those changes to us for us to review and incorporate them.

  • Create a GitHub account with your preferred username.

A basic sense of the code structure and how to find things

You aren't going to know everything right up front, of course, but there are a few things you can look through and familiarize yourself with.

  • Familiarize yourself with Perl, the language that the majority of DW development is done in. The best reference that we've found to point people at is Picking Up Perl. You absolutely don't need to be a Perl guru to submit a patch, but you should be familiar with the basic syntax.
  • If you'd like to practice first, check out OpenHatch's Training Missions -- they'll let you practice with some of the tools you might need! (In particular, you might find their Git training mission helpful.)
  • Browse through some of the Dreamwidth source code to get a good sense of where things are and what the setup looks like. The basic directory structure, as well as some guidelines about what goes where, can be found in Directory Structure.
  • Read the Programming Guidelines. (You may not understand all of the items there, but you can familiarize yourself with them, and start noticing when existing code doesn't follow the rules as you read.)
  • If you start to get overwhelmed, don't worry! Go do something else for a bit and come back to this later -- this doesn't all have to be done at once. You can read an old dev pep-talk. Also, have a look through the Epic List of Things Real Dreamwidth Programmers Do if you start feeling a bit of impostor syndrome. Finally, you can always ask for help in irc or in [info]dw-dev-training -- everybody who's working on the project now was in your shoes at one point, and we all remember what it's like to feel overwhelmed and over our heads. We want to help you!
  • If you run into problems following any of these instructions, we also want to know about it so we can fix this documentation. You can let us know in irc or in [info]dw-dev-training, or make a note on the Dev Wanted How-To or Installation Wanted How-To pages to describe what you found confusing.

Finding something to work on

Once you've gone through the initial setup, pick an issue to work on. The issues are kept in GitHub Issues.

  • Let people know that you're working on the bug by assigning it to yourself. Comment on the issue you've chosen with some variation on the word "claim" ("claim", "claimed" and "claiming" all work, and can be surrounded by any other text). This will trigger our bot to assign the issue to you.

Making your changes

  • Restart Apache and test your changes on the Dreamhack. It's a good idea to test multiple use cases, including logged in/not logged in, community vs personal journal (if applicable), personal journal with different settings, etc.


Submitting your changes

  • Once you're satisfied that your changes fix the issue and don't introduce any new bugs, open a pull request. This sends your changes to us for us to look over in review.
  • A senior Dreamwidth developer will look over your changes and see if they can be accepted or if there are things you need to change. If there are things that could be improved, the reviewer will comment on the commit and give you notes on what can be improved. Don't worry if your changes don't pass review on the first time -- it's really common for pull requests to go through several versions before they're committed.
  • If your pull request needs more changes, you can go back to the branch you made for the change and make those changes. Once you commit them to your branch and push your changes to make them public, the pull request will update automatically. However, this doesn't fire off a notification to the folk reviewing the code, so please leave a comment on your pull request to let people know that the requested changes have been made!
  • When your pull request is accepted, the person who accepts it will close the pull request and the issue that the pull request fixed.

The next fix!

  • Once your pull request is accepted and merged into the main branch, you can delete the branch for that issue on your GitHub account.
  • Switch back to the 'master' branch on your Dreamhack and update to the most current code.
  • Pick the next issue to work on!

Further reading

This is a brief overview of the process. There are plenty of places to go for more information. Useful wiki pages include:

  • Dev Finding Things - getting around the code base and figuring out where to start when looking for a specific feature
  • Dev Programming Guidelines - programming style
  • Design - things to keep in mind when designing features. Developers, please take note of this page!
  • Dev Maintenance - how to keep your code updated
  • Git How To - basic commands for keeping track of your changes using version control. Also includes instructions for submitting those changes via a pull request
  • Git Getting Started - a collection of resources for using Git
  • Github Issues - instructions for filing and claiming bugs to work on
  • Development - another list of stuff that might be useful for you at some point, in particular Customising Your Dev Environment (for instructions on setting up the Support Board, enabling Beta Features, and so on)
  • Category:Development - every page tagged with the Development category on the wiki

What'd we miss?

If you run into anything in the process that isn't well-documented, or you have questions, you can ask in the [info]dw_dev_training community or in the #dreamwidth-dev irc channel. You should also make a note on the Dev Wanted How-To or Installation Wanted How-To wiki pages so we can document it better for the next person to come along!