##// END OF EJS Templates
docs: added tip for faster nix-shell by pre-installing phantomJS
marcink -
r3364:680228f0 default
parent child Browse files
Show More
@@ -1,226 +1,238 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 --update``.
36 36
37 37 .. note::
38 38
39 39 To uninstall nix run the following:
40 40
41 41 remove the . "$HOME/.nix-profile/etc/profile.d/nix.sh" line in your ~/.profile or ~/.bash_profile
42 42 rm -rf $HOME/{.nix-channels,.nix-defexpr,.nix-profile,.config/nixpkgs}
43 43 sudo rm -rf /nix
44 44
45 45 Switch nix to the latest STABLE channel
46 46 ---------------------------------------
47 47
48 48 run::
49 49
50 50 nix-channel --add https://nixos.org/channels/nixos-18.03 nixpkgs
51 51
52 52 Followed by::
53 53
54 54 nix-channel --update
55 55
56 56
57 57 Install required binaries
58 58 -------------------------
59 59
60 60 We need some handy tools first.
61 61
62 62 run::
63 63
64 64 nix-env -i nix-prefetch-hg
65 65 nix-env -i nix-prefetch-git
66 66
67 67
68 Speed up JS build by installing PhantomJS
69 -----------------------------------------
70
71 PhantomJS will be downloaded each time nix-shell is invoked. To speed this by
72 setting already downloaded version do this::
73
74 nix-env -i phantomjs-2.1.1
75
76 # and set nix bin path
77 export PATH=$PATH:~/.nix-profile/bin
78
79
68 80 Clone the required repositories
69 81 -------------------------------
70 82
71 83 After Nix is set up, clone the RhodeCode Enterprise Community Edition and
72 84 RhodeCode VCSServer repositories into the same directory.
73 85 RhodeCode currently is using Mercurial Version Control System, please make sure
74 86 you have it installed before continuing.
75 87
76 88 To obtain the required sources, use the following commands::
77 89
78 90 mkdir rhodecode-develop && cd rhodecode-develop
79 91 hg clone https://code.rhodecode.com/rhodecode-enterprise-ce
80 92 hg clone https://code.rhodecode.com/rhodecode-vcsserver
81 93
82 94 .. note::
83 95
84 96 If you cannot clone the repository, please contact us via support@rhodecode.com
85 97
86 98
87 99 Install some required libraries
88 100 -------------------------------
89 101
90 102 There are some required drivers and dev libraries that we need to install to
91 103 test RhodeCode under different types of databases. For example in Ubuntu we
92 104 need to install the following.
93 105
94 106 required libraries::
95 107
96 108 sudo apt-get install libapr1-dev libaprutil1-dev
97 109 sudo apt-get install libsvn-dev
98 110 sudo apt-get install mysql-server libmysqlclient-dev
99 111 sudo apt-get install postgresql postgresql-contrib libpq-dev
100 112 sudo apt-get install libcurl4-openssl-dev
101 113
102 114
103 115 Enter the Development Shell
104 116 ---------------------------
105 117
106 118 The final step is to start the development shells. To do this, run the
107 119 following command from inside the cloned repository::
108 120
109 121 #first, the vcsserver
110 122 cd ~/rhodecode-vcsserver
111 123 nix-shell
112 124
113 125 # then enterprise sources
114 126 cd ~/rhodecode-enterprise-ce
115 127 nix-shell
116 128
117 129 .. note::
118 130
119 131 On the first run, this will take a while to download and optionally compile
120 132 a few things. The following runs will be faster. The development shell works
121 133 fine on both MacOS and Linux platforms.
122 134
123 135
124 136 Create config.nix for development
125 137 ---------------------------------
126 138
127 139 In order to run proper tests and setup linking across projects, a config.nix
128 140 file needs to be setup::
129 141
130 142 # create config
131 143 mkdir -p ~/.nixpkgs
132 144 touch ~/.nixpkgs/config.nix
133 145
134 146 # put the below content into the ~/.nixpkgs/config.nix file
135 147 # adjusts, the path to where you cloned your repositories.
136 148
137 149 {
138 150 rc = {
139 151 sources = {
140 152 rhodecode-vcsserver = "/home/dev/rhodecode-vcsserver";
141 153 rhodecode-enterprise-ce = "/home/dev/rhodecode-enterprise-ce";
142 154 rhodecode-enterprise-ee = "/home/dev/rhodecode-enterprise-ee";
143 155 };
144 156 };
145 157 }
146 158
147 159
148 160
149 161 Creating a Development Configuration
150 162 ------------------------------------
151 163
152 164 To create a development environment for RhodeCode Enterprise,
153 165 use the following steps:
154 166
155 167 1. Create a copy of vcsserver config:
156 168 `cp ~/rhodecode-vcsserver/configs/development.ini ~/rhodecode-vcsserver/configs/dev.ini`
157 169 2. Create a copy of rhodocode config:
158 170 `cp ~/rhodecode-enterprise-ce/configs/development.ini ~/rhodecode-enterprise-ce/configs/dev.ini`
159 171 3. Adjust the configuration settings to your needs if needed.
160 172
161 173 .. note::
162 174
163 175 It is recommended to use the name `dev.ini` since it's included in .hgignore file.
164 176
165 177
166 178 Setup the Development Database
167 179 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
168 180
169 181 To create a development database, use the following example. This is a one
170 182 time operation executed from the nix-shell of rhodecode-enterprise-ce sources ::
171 183
172 184 rc-setup-app dev.ini \
173 185 --user=admin --password=secret \
174 186 --email=admin@example.com \
175 187 --repos=~/my_dev_repos
176 188
177 189
178 190 Compile CSS and JavaScript
179 191 ^^^^^^^^^^^^^^^^^^^^^^^^^^
180 192
181 193 To use the application's frontend and prepare it for production deployment,
182 194 you will need to compile the CSS and JavaScript with Grunt.
183 195 This is easily done from within the nix-shell using the following command::
184 196
185 197 grunt
186 198
187 199 When developing new features you will need to recompile following any
188 200 changes made to the CSS or JavaScript files when developing the code::
189 201
190 202 grunt watch
191 203
192 204 This prepares the development (with comments/whitespace) versions of files.
193 205
194 206 Start the Development Servers
195 207 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
196 208
197 209 From the rhodecode-vcsserver directory, start the development server in another
198 210 nix-shell, using the following command::
199 211
200 212 pserve configs/dev.ini
201 213
202 214 In the adjacent nix-shell which you created for your development server, you may
203 215 now start CE with the following command::
204 216
205 217
206 218 pserve --reload configs/dev.ini
207 219
208 220 .. note::
209 221
210 222 `--reload` flag will automatically reload the server when source file changes.
211 223
212 224
213 225 Run the Environment Tests
214 226 ^^^^^^^^^^^^^^^^^^^^^^^^^
215 227
216 228 Please make sure that the tests are passing to verify that your environment is
217 229 set up correctly. RhodeCode uses py.test to run tests.
218 230 While your instance is running, start a new nix-shell and simply run
219 231 ``make test`` to run the basic test suite.
220 232
221 233
222 234 Need Help?
223 235 ^^^^^^^^^^
224 236
225 237 Join us on Slack via https://rhodecode.com/join or post questions in our
226 238 Community Portal at https://community.rhodecode.com
General Comments 0
You need to be logged in to leave comments. Login now