Non-interactive AWS install by running a single script.
Non-interactive AWS install by running a single script. Complete non-interactive AWS install with one line. Squash of 28 commits: Initial commit of complete install script. Must be sudo. Non interactive prostgres. Install mysql with unique password. Service file. Add init file. Nginx config. Script contains aws specific settings. Update references after rename. Prevent localhost ssh prompt. Postfix with policyd. Typo in localhost. Postfix package has other name. sudo -l session needs oneliners. More sudo commands to prevent permission problems. Change in existing file. Change in existing file must be referenced. Switch order. Postfix comment. Old way to generate password, less sudo. todo login Must use private ip and login instructions. Starting up. Fixed and checked various todos. Use service. Set host name. Go to default dir. Only works on next login. Only replace first host. Cleaned up the comments. Link to nginx config. Move to aws dir. Update links to aws for interactive install. Existing script stays at the same location. Change directory. Use the new init scripts for gitlab service and nginx. Use the branch for file downloads. Update with newest changes to installation.md. Correct reference. Use master branch since we need the nginx condfig and use absolute paths. Need to copy with sudo.
This commit is contained in:
parent
b2b88b2ff2
commit
eae41ad1df
3 changed files with 162 additions and 36 deletions
|
@ -3,7 +3,8 @@
|
|||
sudo apt-get update
|
||||
sudo apt-get upgrade
|
||||
|
||||
sudo apt-get install -y git git-core wget curl gcc checkinstall libxml2-dev libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libreadline-gplv2-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server openssh-server python-dev python-pip libyaml-dev postfix
|
||||
sudo DEBIAN_FRONTEND='noninteractive' apt-get install -y postfix-policyd-spf-python # Install postfix without prompting.
|
||||
sudo apt-get install -y git git-core wget curl gcc checkinstall libxml2-dev libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libreadline-gplv2-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server openssh-server python-dev python-pip libyaml-dev
|
||||
|
||||
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
|
||||
tar xfvz ruby-1.9.3-p194.tar.gz
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Platform requirements:
|
||||
## Platform requirements:
|
||||
|
||||
**The project is designed for the Linux operating system.**
|
||||
|
||||
|
@ -22,7 +22,7 @@ You might have some luck using these, but no guarantees:
|
|||
|
||||
Gitlab does **not** run on Windows and we have no plans of making Gitlab compatible.
|
||||
|
||||
## This installation guide created for Debian/Ubuntu and properly tested.
|
||||
## This installation guide created for Debian/Ubuntu and properly tested.
|
||||
|
||||
The installation consists of 6 steps:
|
||||
|
||||
|
@ -43,13 +43,13 @@ Also read the [Read this before you submit an issue](https://github.com/gitlabhq
|
|||
|
||||
> - - -
|
||||
> First 3 steps can be easily skipped with simply install script:
|
||||
>
|
||||
> # Install curl and sudo
|
||||
>
|
||||
> # Install curl and sudo
|
||||
> apt-get install curl sudo
|
||||
>
|
||||
>
|
||||
> # 3 steps in 1 command :)
|
||||
> curl https://raw.github.com/gitlabhq/gitlabhq/master/doc/debian_ubuntu.sh | sh
|
||||
>
|
||||
>
|
||||
> Now you can go to step 4"
|
||||
> - - -
|
||||
|
||||
|
@ -61,7 +61,7 @@ Also read the [Read this before you submit an issue](https://github.com/gitlabhq
|
|||
sudo apt-get upgrade
|
||||
|
||||
sudo apt-get install -y wget curl gcc checkinstall libxml2-dev libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libreadline6-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server openssh-server git-core python-dev python-pip libyaml-dev postfix
|
||||
|
||||
|
||||
# If you want to use MySQL:
|
||||
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
|
||||
|
||||
|
@ -77,7 +77,7 @@ Also read the [Read this before you submit an issue](https://github.com/gitlabhq
|
|||
# 3. Install gitolite
|
||||
|
||||
Create user for git:
|
||||
|
||||
|
||||
sudo adduser \
|
||||
--system \
|
||||
--shell /bin/sh \
|
||||
|
@ -90,7 +90,7 @@ Create user for git:
|
|||
Create user for gitlab:
|
||||
|
||||
# ubuntu/debian
|
||||
sudo adduser --disabled-login --gecos 'gitlab system' gitlab
|
||||
sudo adduser --disabled-login --gecos 'gitlab system' gitlab
|
||||
|
||||
Add your user to git group:
|
||||
|
||||
|
@ -103,7 +103,7 @@ Generate key:
|
|||
Get gitolite source code:
|
||||
|
||||
cd /home/git
|
||||
sudo -H -u git git clone git://github.com/gitlabhq/gitolite /home/git/gitolite
|
||||
sudo -H -u git git clone git://github.com/gitlabhq/gitolite /home/git/gitolite
|
||||
|
||||
Setup:
|
||||
|
||||
|
@ -114,21 +114,21 @@ Setup:
|
|||
|
||||
sudo -u git -H sed -i 's/0077/0007/g' /home/git/share/gitolite/conf/example.gitolite.rc
|
||||
sudo -u git -H sh -c "PATH=/home/git/bin:$PATH; gl-setup -q /home/git/gitlab.pub"
|
||||
|
||||
|
||||
Permissions:
|
||||
|
||||
sudo chmod -R g+rwX /home/git/repositories/
|
||||
sudo chown -R git:git /home/git/repositories/
|
||||
sudo chown gitlab:gitlab /home/git/repositories/**/hooks/post-receive
|
||||
sudo chown gitlab:gitlab /home/git/repositories/**/hooks/post-receive
|
||||
|
||||
#### CHECK: Logout & login again to apply git group to your user
|
||||
|
||||
|
||||
# clone admin repo to add localhost to known_hosts
|
||||
# & be sure your user has access to gitolite
|
||||
sudo -u gitlab -H git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin
|
||||
sudo -u gitlab -H git clone git@localhost:gitolite-admin.git /tmp/gitolite-admin
|
||||
|
||||
# if succeed you can remove it
|
||||
sudo rm -rf /tmp/gitolite-admin
|
||||
sudo rm -rf /tmp/gitolite-admin
|
||||
|
||||
**IMPORTANT! If you cant clone `gitolite-admin` repository - DONT PROCEED INSTALLATION**
|
||||
|
||||
|
@ -140,7 +140,7 @@ Permissions:
|
|||
cd /home/gitlab
|
||||
sudo -H -u gitlab git clone -b stable git://github.com/gitlabhq/gitlabhq.git gitlab
|
||||
cd gitlab
|
||||
|
||||
|
||||
sudo -u gitlab mkdir tmp
|
||||
|
||||
# Rename config files
|
||||
|
@ -151,22 +151,22 @@ Permissions:
|
|||
# SQLite
|
||||
sudo -u gitlab cp config/database.yml.sqlite config/database.yml
|
||||
|
||||
# Or
|
||||
# Or
|
||||
# Mysql
|
||||
# Install MySQL as directed in Step #1
|
||||
|
||||
|
||||
# Login to MySQL
|
||||
$ mysql -u root -p
|
||||
|
||||
$ mysql -u root -p
|
||||
|
||||
# Create the gitlabhq production database
|
||||
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
|
||||
|
||||
|
||||
# Create the MySQL User change $password to a real password
|
||||
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
|
||||
|
||||
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
|
||||
|
||||
# Grant proper permissions to the MySQL User
|
||||
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
|
||||
|
||||
|
||||
# Exit MySQL Server and copy the example config, make sure to update username/password in config/database.yml
|
||||
sudo -u gitlab cp config/database.yml.example config/database.yml
|
||||
|
||||
|
@ -177,7 +177,7 @@ Permissions:
|
|||
#### Setup DB
|
||||
|
||||
sudo -u gitlab bundle exec rake gitlab:app:setup RAILS_ENV=production
|
||||
|
||||
|
||||
Checking status:
|
||||
|
||||
sudo -u gitlab bundle exec rake gitlab:app:status RAILS_ENV=production
|
||||
|
@ -197,13 +197,13 @@ Checking status:
|
|||
Can clone gitolite-admin?............YES
|
||||
UMASK for .gitolite.rc is 0007? ............YES
|
||||
|
||||
If you got all YES - congrats! You can go to next step.
|
||||
If you got all YES - congrats! You can go to next step.
|
||||
|
||||
# 5. Server up
|
||||
|
||||
Application can be started with next command:
|
||||
|
||||
# For test purposes
|
||||
# For test purposes
|
||||
sudo -u gitlab bundle exec rails s -e production
|
||||
|
||||
# As daemon
|
||||
|
@ -239,7 +239,7 @@ You can login via web using admin generated with setup:
|
|||
sudo -u gitlab cp config/unicorn.rb.orig config/unicorn.rb
|
||||
sudo -u gitlab bundle exec unicorn_rails -c config/unicorn.rb -E production -D
|
||||
|
||||
Edit /etc/nginx/nginx.conf. In the *http* section add:
|
||||
Edit /etc/nginx/nginx.conf. In the *http* section add the following section of code or replace it completely with https://raw.github.com/dosire/gitlabhq/master/aws/nginx.conf
|
||||
|
||||
upstream gitlab {
|
||||
server unix:/home/gitlab/gitlab/tmp/sockets/gitlab.socket;
|
||||
|
@ -249,27 +249,27 @@ Edit /etc/nginx/nginx.conf. In the *http* section add:
|
|||
listen YOUR_SERVER_IP:80; # e.g., listen 192.168.1.1:80;
|
||||
server_name YOUR_SERVER_FQDN; # e.g., server_name source.example.com;
|
||||
root /home/gitlab/gitlab/public;
|
||||
|
||||
|
||||
# individual nginx logs for this gitlab vhost
|
||||
access_log /var/log/nginx/gitlab_access.log;
|
||||
error_log /var/log/nginx/gitlab_error.log;
|
||||
|
||||
|
||||
location / {
|
||||
# serve static files from defined root folder;.
|
||||
# @gitlab is a named location for the upstream fallback, see below
|
||||
try_files $uri $uri/index.html $uri.html @gitlab;
|
||||
}
|
||||
|
||||
# if a file, which is not found in the root folder is requested,
|
||||
|
||||
# if a file, which is not found in the root folder is requested,
|
||||
# then the proxy pass the request to the upsteam (gitlab unicorn)
|
||||
location @gitlab {
|
||||
proxy_redirect off;
|
||||
|
||||
|
||||
# you need to change this to "https", if you set "ssl" directive to "on"
|
||||
proxy_set_header X-FORWARDED_PROTO http;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
|
||||
proxy_pass http://gitlab;
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ Create init script in /etc/init.d/gitlab:
|
|||
# Short-Description: GitLab git repository management
|
||||
# Description: GitLab git repository management
|
||||
### END INIT INFO
|
||||
|
||||
|
||||
DAEMON_OPTS="-c /home/gitlab/gitlab/config/unicorn.rb -E production -D"
|
||||
NAME=unicorn
|
||||
DESC="Gitlab service"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue