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