Show More
@@ -1,186 +1,195 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 --up |
|
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 | To do this, use the following example:: |
|
66 | RhodeCode currently is using Mercurial Version Control System, please make sure | |
|
67 | you have it installed before continuing. | |||
|
68 | ||||
|
69 | To obtain the required sources, use the following commands: | |||
67 |
|
70 | |||
68 | mkdir rhodecode-develop && cd rhodecode-develop |
|
71 | mkdir rhodecode-develop && cd rhodecode-develop | |
69 | hg clone https://code.rhodecode.com/rhodecode-enterprise-ce |
|
72 | hg clone https://code.rhodecode.com/rhodecode-enterprise-ce | |
70 | hg clone https://code.rhodecode.com/rhodecode-vcsserver |
|
73 | hg clone https://code.rhodecode.com/rhodecode-vcsserver | |
71 |
|
74 | |||
72 | .. note:: |
|
75 | .. note:: | |
73 |
|
76 | |||
74 |
If you cannot clone the repository, please |
|
77 | If you cannot clone the repository, please contact us via support@rhodecode.com | |
75 | via support@rhodecode.com |
|
|||
76 |
|
78 | |||
77 |
|
79 | |||
78 | Install some required libraries |
|
80 | Install some required libraries | |
79 | ------------------------------- |
|
81 | ------------------------------- | |
80 |
|
82 | |||
81 | 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 | |
82 | 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 | |
83 | the following. |
|
85 | the following. | |
84 |
|
86 | |||
85 | required libraries:: |
|
87 | required libraries:: | |
86 |
|
88 | |||
87 | sudo apt-get install libapr1-dev libaprutil1-dev |
|
89 | sudo apt-get install libapr1-dev libaprutil1-dev | |
88 | sudo apt-get install libsvn-dev |
|
90 | sudo apt-get install libsvn-dev | |
89 | sudo apt-get install mysql-server libmysqlclient-dev |
|
91 | sudo apt-get install mysql-server libmysqlclient-dev | |
90 | sudo apt-get install postgresql postgresql-contrib libpq-dev |
|
92 | sudo apt-get install postgresql postgresql-contrib libpq-dev | |
91 | sudo apt-get install libcurl4-openssl-dev |
|
93 | sudo apt-get install libcurl4-openssl-dev | |
92 |
|
94 | |||
93 |
|
95 | |||
94 | Enter the Development Shell |
|
96 | Enter the Development Shell | |
95 | --------------------------- |
|
97 | --------------------------- | |
96 |
|
98 | |||
97 | The final step is to start the development shell. To do this, run the |
|
99 | The final step is to start the development shells. To do this, run the | |
98 | following command from inside the cloned repository:: |
|
100 | following command from inside the cloned repository:: | |
99 |
|
101 | |||
|
102 | #first, the vcsserver | |||
|
103 | cd ~/rhodecode-vcsserver | |||
|
104 | nix-shell | |||
|
105 | ||||
|
106 | # then enterprise sources | |||
100 | cd ~/rhodecode-enterprise-ce |
|
107 | cd ~/rhodecode-enterprise-ce | |
101 |
|
|
108 | nix-shell | |
102 |
|
109 | |||
103 | .. note:: |
|
110 | .. note:: | |
104 |
|
111 | |||
105 | 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 | |
106 | 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 | |
107 | fine on both MacOS and Linux platforms. |
|
114 | fine on both MacOS and Linux platforms. | |
108 |
|
115 | |||
109 |
|
116 | |||
110 |
|
117 | |||
111 | Creating a Development Configuration |
|
118 | Creating a Development Configuration | |
112 | ------------------------------------ |
|
119 | ------------------------------------ | |
113 |
|
120 | |||
114 | To create a development environment for RhodeCode Enterprise, |
|
121 | To create a development environment for RhodeCode Enterprise, | |
115 | use the following steps: |
|
122 | use the following steps: | |
116 |
|
123 | |||
117 | 1. Create a copy of `~/rhodecode-enterprise-ce/configs/development.ini` |
|
124 | 1. Create a copy of vcsserver config: | |
118 | 2. Adjust the configuration settings to your needs |
|
125 | `cp ~/rhodecode-vcsserver/configs/development.ini ~/rhodecode-vcsserver/configs/dev.ini` | |
|
126 | 2. Create a copy of rhodocode config: | |||
|
127 | `cp ~/rhodecode-enterprise-ce/configs/development.ini ~/rhodecode-enterprise-ce/configs/dev.ini` | |||
|
128 | 3. Adjust the configuration settings to your needs if needed. | |||
119 |
|
129 | |||
120 | .. note:: |
|
130 | .. note:: | |
121 |
|
131 | |||
122 | It is recommended to use the name `dev.ini`. |
|
132 | It is recommended to use the name `dev.ini` since it's included in .hgignore file. | |
123 |
|
133 | |||
124 |
|
134 | |||
125 | Setup the Development Database |
|
135 | Setup the Development Database | |
126 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
136 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
127 |
|
137 | |||
128 | To create a development database, use the following example. This is a one |
|
138 | To create a development database, use the following example. This is a one | |
129 | time operation:: |
|
139 | time operation executed from the nix-shell of rhodecode-enterprise-ce sources :: | |
130 |
|
140 | |||
131 | paster setup-rhodecode dev.ini \ |
|
141 | paster setup-rhodecode dev.ini \ | |
132 | --user=admin --password=secret \ |
|
142 | --user=admin --password=secret \ | |
133 | --email=admin@example.com \ |
|
143 | --email=admin@example.com \ | |
134 | --repos=~/my_dev_repos |
|
144 | --repos=~/my_dev_repos | |
135 |
|
145 | |||
136 |
|
146 | |||
137 | Compile CSS and JavaScript |
|
147 | Compile CSS and JavaScript | |
138 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
148 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
139 |
|
149 | |||
140 | To use the application's frontend and prepare it for production deployment, |
|
150 | To use the application's frontend and prepare it for production deployment, | |
141 | you will need to compile the CSS and JavaScript with Grunt. |
|
151 | you will need to compile the CSS and JavaScript with Grunt. | |
142 | This is easily done from within the nix-shell using the following command:: |
|
152 | This is easily done from within the nix-shell using the following command:: | |
143 |
|
153 | |||
144 | grunt |
|
154 | grunt | |
145 |
|
155 | |||
146 | When developing new features you will need to recompile following any |
|
156 | When developing new features you will need to recompile following any | |
147 | changes made to the CSS or JavaScript files when developing the code:: |
|
157 | changes made to the CSS or JavaScript files when developing the code:: | |
148 |
|
158 | |||
149 | grunt watch |
|
159 | grunt watch | |
150 |
|
160 | |||
151 | This prepares the development (with comments/whitespace) versions of files. |
|
161 | This prepares the development (with comments/whitespace) versions of files. | |
152 |
|
162 | |||
153 | Start the Development Server |
|
163 | Start the Development Servers | |
154 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
164 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
155 |
|
165 | |||
156 | From the rhodecode-vcsserver directory, start the development server in another |
|
166 | From the rhodecode-vcsserver directory, start the development server in another | |
157 | nix-shell, using the following command:: |
|
167 | nix-shell, using the following command:: | |
158 |
|
168 | |||
159 |
pserve configs/dev |
|
169 | pserve configs/dev.ini | |
160 |
|
170 | |||
161 | In the adjacent nix-shell which you created for your development server, you may |
|
171 | In the adjacent nix-shell which you created for your development server, you may | |
162 | now start CE with the following command:: |
|
172 | now start CE with the following command:: | |
163 |
|
173 | |||
164 |
|
174 | |||
165 |
|
|
175 | pserve --reload configs/dev.ini | |
166 |
|
176 | |||
167 | .. note:: |
|
177 | .. note:: | |
168 |
|
178 | |||
169 | To automatically refresh - and recompile the frontend assets - when changes |
|
179 | `--reload` flag will automatically reload the server when source file changes. | |
170 | are made in the source code, you can use the option `--reload`. |
|
|||
171 |
|
180 | |||
172 |
|
181 | |||
173 | Run the Environment Tests |
|
182 | Run the Environment Tests | |
174 | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
|
183 | ^^^^^^^^^^^^^^^^^^^^^^^^^ | |
175 |
|
184 | |||
176 | Please make sure that the tests are passing to verify that your environment is |
|
185 | Please make sure that the tests are passing to verify that your environment is | |
177 | set up correctly. RhodeCode uses py.test to run tests. |
|
186 | set up correctly. RhodeCode uses py.test to run tests. | |
178 | While your instance is running, start a new nix-shell and simply run |
|
187 | While your instance is running, start a new nix-shell and simply run | |
179 | ``make test`` to run the basic test suite. |
|
188 | ``make test`` to run the basic test suite. | |
180 |
|
189 | |||
181 |
|
190 | |||
182 | Need Help? |
|
191 | Need Help? | |
183 | ^^^^^^^^^^ |
|
192 | ^^^^^^^^^^ | |
184 |
|
193 | |||
185 | Join us on Slack via https://rhodecode.com/join or post questions in our |
|
194 | Join us on Slack via https://rhodecode.com/join or post questions in our | |
186 | Community Portal at https://community.rhodecode.com |
|
195 | Community Portal at https://community.rhodecode.com |
General Comments 0
You need to be logged in to leave comments.
Login now