Show More
@@ -1,219 +1,226 b'' | |||
|
1 | 1 | .. _dev-setup: |
|
2 | 2 | |
|
3 | 3 | =================== |
|
4 | 4 | Development setup |
|
5 | 5 | =================== |
|
6 | 6 | |
|
7 | 7 | |
|
8 | 8 | RhodeCode Enterprise runs inside a Nix managed environment. This ensures build |
|
9 | 9 | environment dependencies are correctly declared and installed during setup. |
|
10 | 10 | It also enables atomic upgrades, rollbacks, and multiple instances of RhodeCode |
|
11 | 11 | Enterprise running with isolation. |
|
12 | 12 | |
|
13 | 13 | To set up RhodeCode Enterprise inside the Nix environment, use the following steps: |
|
14 | 14 | |
|
15 | 15 | |
|
16 | 16 | |
|
17 | 17 | Setup Nix Package Manager |
|
18 | 18 | ------------------------- |
|
19 | 19 | |
|
20 | 20 | To install the Nix Package Manager, please run:: |
|
21 | 21 | |
|
22 | 22 | $ curl https://nixos.org/nix/install | sh |
|
23 | 23 | |
|
24 | 24 | or go to https://nixos.org/nix/ and follow the installation instructions. |
|
25 | 25 | Once this is correctly set up on your system, you should be able to use the |
|
26 | 26 | following commands: |
|
27 | 27 | |
|
28 | 28 | * `nix-env` |
|
29 | 29 | |
|
30 | 30 | * `nix-shell` |
|
31 | 31 | |
|
32 | 32 | |
|
33 | 33 | .. tip:: |
|
34 | 34 | |
|
35 | 35 | Update your channels frequently by running ``nix-channel --update``. |
|
36 | 36 | |
|
37 | .. note:: | |
|
38 | ||
|
39 | To uninstall nix run the following: | |
|
40 | ||
|
41 | remove the . "$HOME/.nix-profile/etc/profile.d/nix.sh" line in your ~/.profile or ~/.bash_profile | |
|
42 | rm -rf $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs} | |
|
43 | sudo rm -rf /nix | |
|
37 | 44 | |
|
38 | 45 | Switch nix to the latest STABLE channel |
|
39 | 46 | --------------------------------------- |
|
40 | 47 | |
|
41 | 48 | run:: |
|
42 | 49 | |
|
43 | 50 | nix-channel --add https://nixos.org/channels/nixos-16.03 nixpkgs |
|
44 | 51 | |
|
45 | 52 | Followed by:: |
|
46 | 53 | |
|
47 | 54 | nix-channel --update |
|
48 | 55 | |
|
49 | 56 | |
|
50 | 57 | Install required binaries |
|
51 | 58 | ------------------------- |
|
52 | 59 | |
|
53 | 60 | We need some handy tools first. |
|
54 | 61 | |
|
55 | 62 | run:: |
|
56 | 63 | |
|
57 | 64 | nix-env -i nix-prefetch-hg |
|
58 | 65 | nix-env -i nix-prefetch-git |
|
59 | 66 | |
|
60 | 67 | |
|
61 | 68 | Clone the required repositories |
|
62 | 69 | ------------------------------- |
|
63 | 70 | |
|
64 | 71 | After Nix is set up, clone the RhodeCode Enterprise Community Edition and |
|
65 | 72 | RhodeCode VCSServer repositories into the same directory. |
|
66 | 73 | RhodeCode currently is using Mercurial Version Control System, please make sure |
|
67 | 74 | you have it installed before continuing. |
|
68 | 75 | |
|
69 | 76 | To obtain the required sources, use the following commands:: |
|
70 | 77 | |
|
71 | 78 | mkdir rhodecode-develop && cd rhodecode-develop |
|
72 | 79 | hg clone https://code.rhodecode.com/rhodecode-enterprise-ce |
|
73 | 80 | hg clone https://code.rhodecode.com/rhodecode-vcsserver |
|
74 | 81 | |
|
75 | 82 | .. note:: |
|
76 | 83 | |
|
77 | 84 | If you cannot clone the repository, please contact us via support@rhodecode.com |
|
78 | 85 | |
|
79 | 86 | |
|
80 | 87 | Install some required libraries |
|
81 | 88 | ------------------------------- |
|
82 | 89 | |
|
83 | 90 | There are some required drivers and dev libraries that we need to install to |
|
84 | 91 | test RhodeCode under different types of databases. For example in Ubuntu we |
|
85 | 92 | need to install the following. |
|
86 | 93 | |
|
87 | 94 | required libraries:: |
|
88 | 95 | |
|
89 | 96 | sudo apt-get install libapr1-dev libaprutil1-dev |
|
90 | 97 | sudo apt-get install libsvn-dev |
|
91 | 98 | sudo apt-get install mysql-server libmysqlclient-dev |
|
92 | 99 | sudo apt-get install postgresql postgresql-contrib libpq-dev |
|
93 | 100 | sudo apt-get install libcurl4-openssl-dev |
|
94 | 101 | |
|
95 | 102 | |
|
96 | 103 | Enter the Development Shell |
|
97 | 104 | --------------------------- |
|
98 | 105 | |
|
99 | 106 | The final step is to start the development shells. To do this, run the |
|
100 | 107 | following command from inside the cloned repository:: |
|
101 | 108 | |
|
102 | 109 | #first, the vcsserver |
|
103 | 110 | cd ~/rhodecode-vcsserver |
|
104 | 111 | nix-shell |
|
105 | 112 | |
|
106 | 113 | # then enterprise sources |
|
107 | 114 | cd ~/rhodecode-enterprise-ce |
|
108 | 115 | nix-shell |
|
109 | 116 | |
|
110 | 117 | .. note:: |
|
111 | 118 | |
|
112 | 119 | On the first run, this will take a while to download and optionally compile |
|
113 | 120 | a few things. The following runs will be faster. The development shell works |
|
114 | 121 | fine on both MacOS and Linux platforms. |
|
115 | 122 | |
|
116 | 123 | |
|
117 | 124 | Create config.nix for development |
|
118 | 125 | --------------------------------- |
|
119 | 126 | |
|
120 | 127 | In order to run proper tests and setup linking across projects, a config.nix |
|
121 | 128 | file needs to be setup:: |
|
122 | 129 | |
|
123 | 130 | # create config |
|
124 | 131 | mkdir -p ~/.nixpkgs |
|
125 | 132 | touch ~/.nixpkgs/config.nix |
|
126 | 133 | |
|
127 | 134 | # put the below content into the ~/.nixpkgs/config.nix file |
|
128 | 135 | # adjusts, the path to where you cloned your repositories. |
|
129 | 136 | |
|
130 | 137 | { |
|
131 | 138 | rc = { |
|
132 | 139 | sources = { |
|
133 | 140 | rhodecode-vcsserver = "/home/dev/rhodecode-vcsserver"; |
|
134 | 141 | rhodecode-enterprise-ce = "/home/dev/rhodecode-enterprise-ce"; |
|
135 | 142 | rhodecode-enterprise-ee = "/home/dev/rhodecode-enterprise-ee"; |
|
136 | 143 | }; |
|
137 | 144 | }; |
|
138 | 145 | } |
|
139 | 146 | |
|
140 | 147 | |
|
141 | 148 | |
|
142 | 149 | Creating a Development Configuration |
|
143 | 150 | ------------------------------------ |
|
144 | 151 | |
|
145 | 152 | To create a development environment for RhodeCode Enterprise, |
|
146 | 153 | use the following steps: |
|
147 | 154 | |
|
148 | 155 | 1. Create a copy of vcsserver config: |
|
149 | 156 | `cp ~/rhodecode-vcsserver/configs/development.ini ~/rhodecode-vcsserver/configs/dev.ini` |
|
150 | 157 | 2. Create a copy of rhodocode config: |
|
151 | 158 | `cp ~/rhodecode-enterprise-ce/configs/development.ini ~/rhodecode-enterprise-ce/configs/dev.ini` |
|
152 | 159 | 3. Adjust the configuration settings to your needs if needed. |
|
153 | 160 | |
|
154 | 161 | .. note:: |
|
155 | 162 | |
|
156 | 163 | It is recommended to use the name `dev.ini` since it's included in .hgignore file. |
|
157 | 164 | |
|
158 | 165 | |
|
159 | 166 | Setup the Development Database |
|
160 | 167 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
161 | 168 | |
|
162 | 169 | To create a development database, use the following example. This is a one |
|
163 | 170 | time operation executed from the nix-shell of rhodecode-enterprise-ce sources :: |
|
164 | 171 | |
|
165 | 172 | paster setup-rhodecode dev.ini \ |
|
166 | 173 | --user=admin --password=secret \ |
|
167 | 174 | --email=admin@example.com \ |
|
168 | 175 | --repos=~/my_dev_repos |
|
169 | 176 | |
|
170 | 177 | |
|
171 | 178 | Compile CSS and JavaScript |
|
172 | 179 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
173 | 180 | |
|
174 | 181 | To use the application's frontend and prepare it for production deployment, |
|
175 | 182 | you will need to compile the CSS and JavaScript with Grunt. |
|
176 | 183 | This is easily done from within the nix-shell using the following command:: |
|
177 | 184 | |
|
178 | 185 | grunt |
|
179 | 186 | |
|
180 | 187 | When developing new features you will need to recompile following any |
|
181 | 188 | changes made to the CSS or JavaScript files when developing the code:: |
|
182 | 189 | |
|
183 | 190 | grunt watch |
|
184 | 191 | |
|
185 | 192 | This prepares the development (with comments/whitespace) versions of files. |
|
186 | 193 | |
|
187 | 194 | Start the Development Servers |
|
188 | 195 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
189 | 196 | |
|
190 | 197 | From the rhodecode-vcsserver directory, start the development server in another |
|
191 | 198 | nix-shell, using the following command:: |
|
192 | 199 | |
|
193 | 200 | pserve configs/dev.ini |
|
194 | 201 | |
|
195 | 202 | In the adjacent nix-shell which you created for your development server, you may |
|
196 | 203 | now start CE with the following command:: |
|
197 | 204 | |
|
198 | 205 | |
|
199 | 206 | pserve --reload configs/dev.ini |
|
200 | 207 | |
|
201 | 208 | .. note:: |
|
202 | 209 | |
|
203 | 210 | `--reload` flag will automatically reload the server when source file changes. |
|
204 | 211 | |
|
205 | 212 | |
|
206 | 213 | Run the Environment Tests |
|
207 | 214 | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
208 | 215 | |
|
209 | 216 | Please make sure that the tests are passing to verify that your environment is |
|
210 | 217 | set up correctly. RhodeCode uses py.test to run tests. |
|
211 | 218 | While your instance is running, start a new nix-shell and simply run |
|
212 | 219 | ``make test`` to run the basic test suite. |
|
213 | 220 | |
|
214 | 221 | |
|
215 | 222 | Need Help? |
|
216 | 223 | ^^^^^^^^^^ |
|
217 | 224 | |
|
218 | 225 | Join us on Slack via https://rhodecode.com/join or post questions in our |
|
219 | 226 | Community Portal at https://community.rhodecode.com |
General Comments 0
You need to be logged in to leave comments.
Login now