Skip to content
corinnecurcie edited this page May 21, 2015 · 3 revisions

JDA Development

The Dev Server, Your Fork, and The Local Machine

On the dev server, each of you have a folder which contains a copy of the website. When you go to http://dev.jdarchive.org/YOURNAME/web/en/home, that website pulls in the contents of your folder on the dev server to create a copy of our main site.

Your folder on the dev server should be linked to your forked copy of the JDArchive repo. That is, the "origin" remote is linked to YOUR fork. However, the "upstream" remote is linked to the JDArchive repo.

You should clone your forked repository on your local machine. That way, on your computer, you have a code base that you can edit with your own text editor.

Initial Dev Server Setup

  1. On Github, "fork" this repo to your own account: https://github.com/Japan-Digital-Archives/Japan-Digital-Archive

  2. SSH into the dev server either from putty (PC) or terminal (MAC/Linux). On putty enter dev.jdarchive.org as the host, hit connect, then enter username and password emailed to you. On terminal, use ssh [email protected] from the terminal and it will prompt you for the password.

  3. Type in passwd and hit enter, this will prompt you to change your password to something secure that isn't the default password emailed to you.

  4. Once you're sshed in, you'll be in ~/home/USERNAME. From here, generate your ssh key and add it to your github account. [Instructions here] (https://help.github.com/articles/generating-ssh-keys/#platform-linux) - Start on step 2. In step 3, the xclip thing won't work, so use cat ~/.ssh/id_rsa.pub and copy the output, then continue with their instructions.

  5. Next, cd /var/www/. Then do ls and you should see a lot names - that means you're in the right spot.

  6. Get the HTTPS clone url of your forked repo (its on your forked repo's github page in the lower right, but click SSH to get the right URL): it should be like https://github.com/GITHUBUSERNAME/Japan-Digital-Archive.git

  7. Run sudo mkdir YOURUSERNAME and sudo chown YOURUSERNAME YOURUSERNAME - yes you should type your username twice in that second command. .

  8. In /var/www, do git clone CLONE-URL YOURUSERNAME - the username is important because that will make your repo clone into your directory.

  9. cd username so that you are in your folder.

  10. Check git remote -v - it may have the origin and upstream remotes if you set them up on your local machine already, but I can't remember if those transfer.

  11. If you don't have the following remotes, add them with: git remote add origin "[email protected]:YOUR-GITHUB-USERNAME/Japan-Digital-Archive.git" and git remote add upstream "https://github.com/Japan-Digital-Archives/Japan-Digital-Archive.git" (yes, the URLs are supposed to be different formats)

  12. Do mkdir app/cache and mkdir app/logs

  13. Type and enter the following: cp ../corinne/app/config/parameters.ini app/config/, cp ../corinne/web/.htaccess web/, sudo setfacl -R -m u:www-data:rwx -m u:$1:rwx app/cache app/logs, sudo setfacl -dR -m u:www-data:rwx -m u:$1:rwx app/cache app/logs(yes it should say corinne in those instructions, keep the corinne there)

  14. Now you have to edit the parameters file, replacing 'corinne' with your username. Type sudo vim app/config/parameters.ini, then type in "I" (capital i) to get into insert mode, then use keyboard arrows to navigate to the "directory" line where it says "corinne/web", then change it to "username/web" with your username. The press ESC to get out of insert mode, and ":wq!" to save and quit.

  15. Run composer install

  16. Check if http://dev.jdarchive.org/USERNAME/web/en/home works! It should look like the regular jdarchive homepage.

For Lead: Creating New Development Instance

  1. ssh into dev server
  2. sudo adduser username
  3. Enter default password, enter default for everything else
  4. To give sudo access: sudo usermod -a -G sudo username

New employees who will be doing work on the dev server need to have their account created from the steps above, and then sent the instructions for cloning their repo onto the server and installing composer. Also, employees should make an account on the JDA site itself, and then should be given Admin privileges through the Admin Dashboard's user list so that they will have access to the admin dashboard. If they will need access to the production server, they need to send the tech lead their public ssh-key (either the string starting with 'ssh-rsa' and probably ending with an email, or the file containing this string). The tech lead then needs to add that string to the list of authorized keys, by editing the authorized_keys file at /home/ubuntu/.ssh on the prod server. Typically we've been replacing emails at the end with rsa-key-ydmdate for when the key was added. Once this happens, the employee should be able to ssh into [email protected] without a password (unless there is a password connected with their ssh key but they will know that).