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