Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
908b96a3
Commit
908b96a3
authored
7 years ago
by
Colin Mitchell
Committed by
Eugen Rochko
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Make vagrant HTTP port configurable (#2510)
parent
13c16b4e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Vagrantfile
+6
-4
6 additions, 4 deletions
Vagrantfile
with
6 additions
and
4 deletions
Vagrantfile
+
6
−
4
View file @
908b96a3
# -*- mode: ruby -*-
# vi: set ft=ruby :
ENV
[
"PORT"
]
||=
"3000"
$provision
=
<<
SCRIPT
cd /vagrant # This is where the host folder/repo is mounted
...
...
@@ -12,8 +14,8 @@ sudo apt-add-repository 'deb https://dl.yarnpkg.com/debian/ stable main'
# Add repo for NodeJS
curl -sL https://deb.nodesource.com/setup_6.x | sudo bash -
# Add firewall rule to redirect 80 to
3000
and save
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port
3000
# Add firewall rule to redirect 80 to
PORT
and save
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port
#{
ENV
[
"PORT"
]
}
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
sudo apt-get install iptables-persistent -y
...
...
@@ -62,7 +64,7 @@ $start = <<SCRIPT
cd /vagrant
export $(cat ".env.vagrant" | xargs)
rails s -d -b 0.0.0.0
rails s -d -b 0.0.0.0
-p
#{
ENV
[
"PORT"
]
}
SCRIPT
...
...
@@ -105,7 +107,7 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
end
# Otherwise, you can access the site at http://localhost:3000
config
.
vm
.
network
:forwarded_port
,
guest:
80
,
host:
3000
config
.
vm
.
network
:forwarded_port
,
guest:
80
,
host:
ENV
[
"PORT"
]
# Full provisioning script, only runs on first 'vagrant up' or with 'vagrant provision'
config
.
vm
.
provision
:shell
,
inline:
$provision
,
privileged:
false
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment