Skip to content

Commit 17617f4

Browse files
committed
add custom git server repo
1 parent 12e88d1 commit 17617f4

File tree

2 files changed

+67
-1
lines changed

2 files changed

+67
-1
lines changed

custom-import-paths/README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,67 @@ go get -insecure -u 0.0.0.0/user/pkg
1919
go run server.go
2020
```
2121

22+
#### Run GitLab Docker server:
23+
24+
```bash
25+
# run the docker container and expose port 443 and 8000
26+
# don't forget to map the volumes correctly as shown below
27+
# we use port 8000 to not collapse with port 80 which we need by server.go
28+
docker run --detach \
29+
--hostname gitlab.example.com \
30+
--publish 443:443 --publish 8000:80 \
31+
--restart always \
32+
--volume ~/Desktop/gitlab/config:/etc/gitlab \
33+
--volume ~/Desktop/gitlab/log:/var/log/gitlab \
34+
--volume ~/Desktop/gitlab/opt:/var/opt/gitlab \
35+
gitlab/gitlab-ce:latest
36+
37+
# display real time logs for GitLab created container
38+
docker logs --follow [CONTAINER_ID]
39+
40+
# WAIT TILL IT FINISHES
41+
42+
# open up localhost:8000
43+
44+
# set up a new password, preferably something which uses
45+
# Uppercase, letters, numbers, alphanumeric characters
46+
# otherwise GitLab won't allow you to go further
47+
# something like: Pas$word123456
48+
49+
# login with the credentials:
50+
# username: root
51+
# password: [PASSWORD_YOU_CREATED]
52+
53+
# create a repository from the admin panel and name it `some-test`
54+
55+
# clone the created repository on your local machine
56+
git clone http://localhost:8000/root/some-test.git
57+
58+
# add the go pkg shown bellow and save it inside pkg.go
59+
60+
git add -A
61+
62+
git commit -m "initial commit"
63+
64+
git push
65+
66+
# input your username: root
67+
# input your password: which you created
68+
69+
# DONE
70+
```
71+
72+
###### pkg.go
73+
```go
74+
package pkg // import "0.0.0.0/user/pkg"
75+
76+
import "fmt"
77+
78+
func New() {
79+
fmt.Println("Welcome to pkg! (GitLab - Docker)")
80+
}
81+
```
82+
2283
#### More info
2384

2485
Note: import path checking is disabled when using

custom-import-paths/go-get-custom-domain/server.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,15 @@ var projects = map[string]struct {
3030
vcs: "git",
3131
remoteURL: "https://gitlab.com/steevehook/some-test",
3232
},
33+
"gitlab-docker": {
34+
vcs: "git",
35+
remoteURL: "http://localhost:8000/root/some-test.git",
36+
},
3337
"bitbucket-git": {
3438
vcs: "git",
3539
remoteURL: "https://bitbucket.org/steevehook/some-test-git",
3640
},
41+
// BitBucket says they will stop Mercurial support by Feb 2020. Be aware
3742
"bitbucket-hg": {
3843
vcs: "hg",
3944
remoteURL: "https://bitbucket.org/steevehook/some-test-hg",
@@ -42,7 +47,7 @@ var projects = map[string]struct {
4247

4348
func main() {
4449
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
45-
tpl := fmt.Sprintf(html, projects["bitbucket-hg"].vcs, projects["bitbucket-hg"].remoteURL)
50+
tpl := fmt.Sprintf(html, projects["github"].vcs, projects["gitlhub"].remoteURL)
4651
fmt.Fprint(w, tpl)
4752
})
4853
log.Fatal(http.ListenAndServe(":80", nil))

0 commit comments

Comments
 (0)