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