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