Browse Source

docker moby

windhamdavid 2 years ago
parent
commit
8480ad6e77
15 changed files with 205 additions and 13 deletions
  1. 16 13
      Summary.md
  2. 137 0
      db/postgres.md
  3. 1 0
      host/mailcow.md
  4. 10 0
      lang/rails.md
  5. 3 0
      software/_software.md
  6. 0 0
      localhost/adobe.md
  7. 0 0
      localhost/apple.md
  8. 0 0
      localhost/brew.md
  9. 0 0
      localhost/chrome.md
  10. 3 0
      localhost/ngrok.md
  11. 0 0
      localhost/sketch.md
  12. 8 0
      saas/linode.md
  13. 1 0
      server/_servers.md
  14. 21 0
      server/docker.md
  15. 5 0
      til.md

+ 16 - 13
Summary.md

@@ -36,6 +36,13 @@
 	* [Nginx](server/nginx.md)
 	* [Mail](server/mail.md)
 	* [GoAccess](server/goaccess.md)
+* [Database](db/_db.md)
+	* [MongoDB](db/mongodb.md)
+		* [Ubuntu](db/ubuntu-mongo.md)
+	* [MariaDB](db/mariadb.md)
+	* [MySQL](db/mysql.md)
+	* [Redis](db/redis.md)
+	* [PostgreSQL](db/postgres.md)
 * [Hosted](host/_host.md)
 	* [Gogs](host/gogs.md)
 	* [Icecast](host/icecast.md)
@@ -49,24 +56,20 @@
 	* [Discourse](host/discourse.md)
 	* [nodebb](host/nodebb.md)
 	* [zammad](host/zammad.md)
+* [localhost](localhost/_localhost.md)
+	* [Apple](localhost/apple.md)
+	* [Chrome](localhost/chrome.md)
+	* [Homebrew](localhost/brew.md)
+	* [Adobe](localhost/adobe.md)
+	* [Sketch](localhost/sketch.md)
+	* [ngrok](localhost/ngrok.md)
 * [SasS](saas/_saas.md)
 	* [Now](saas/now.md)
 	* [Cloud9](saas/c9io.md)
 	* [Stripe](saas/stripe.md)
 	* [Heroku](saas/heroku.md)
-* [Software](software/_software.md)
-	* [Apple](software/apple.md)
-	* [Chrome](software/chrome.md)
-	* [Homebrew](software/brew.md)
-	* [Adobe](software/adobe.md)
-	* [Sketch](software/sketch.md)
-* [Database](db/_db.md)
-	* [MongoDB](db/mongodb.md)
-		* [Ubuntu](db/ubuntu-mongo.md)
-	* [MariaDB](db/mariadb.md)
-	* [MySQL](db/mysql.md)
-	* [Redis](db/redis.md)
-	* [PostgreSQL](db/postgres.md)
+
+
 
 
 #### Projects

+ 137 - 0
db/postgres.md

@@ -1 +1,138 @@
 # PostgreSQL  
+
+
+
+
+
+
+###PostgreSQL on Ubuntu 16.04
+
+
+Install PostgreSQL from the Ubuntu package repository:
+
+    sudo apt-get install postgresql postgresql-contrib
+
+#### Configure PostgreSQL
+
+#### Modify the Postgres Users
+
+By default, PostgreSQL will create a Linux user named `postgres` to access the database software.
+
+{: .caution}
+>
+>The `postgres` user should not be used for for other purposes (e.g. connecting to other networks). Doing so presents a serious risk to the security of your databases.
+
+1.  Change the `postgres` user's Linux password:
+
+        sudo passwd postgres
+
+2.  Issue the following commands to set a password for the `postgres` database user. Be sure to replace `newpassword` with a strong password and keep it in a secure place.
+
+        su - postgres
+        psql -d template1 -c "ALTER USER postgres WITH PASSWORD 'newpassword';"
+
+    Note that this user is distinct from the `postgres` Linux user. The Linux user is used to access the database, and the PostgreSQL user is used to perform administrative tasks on the databases.
+
+    The password set in this step will be used to connect to the database via the network. Peer authentication will be used by default for local connections. See the [Secure Local PostgreSQL Access section](#secure-local-postgresql-access) for information about changing this setting.
+
+#### Create a Database
+
+Run the commands in this section as the `postgres` Linux user.
+
+1.  Create a sample database called `mytestdb`:
+
+        createdb mytestdb
+
+2.  Connect to the test database:
+
+        psql mytestdb
+
+3.  You will see the following output:
+
+        psql (9.5.2)
+        Type "help" for help.
+
+        mytestdb=#
+
+    This is the PostgreSQL client shell, in which you can issue SQL commands. To see a list of available commands, use the `\h` command. You may find more information on a specific command by adding it after `\h`.
+
+#### Create Tables
+
+This section contains examples which create a test database with an employee's first and last name, assigning each a unique key. When creating your own tables, you may specify as many parameters (columns) as you need and name them appropriately. Run the commands in this section from the PostgreSQL shell, opened in Step 2 of the [Create a Database](#create-a-database) section.
+
+1.  Create a table called "employees" in your test database:
+
+        CREATE TABLE employees (employee_id int, first_name varchar, last_name varchar);
+
+2.  Insert a record into the table:
+
+        INSERT INTO employees VALUES (1, 'John', 'Doe');
+
+3.  View the contents of the "employees" table:
+
+        SELECT * FROM employees;
+
+    This produces the following output:
+
+         employee_id | first_name | last_name
+        -------------+------------+-----------
+                   1 | John       | Doe
+        (1 row)
+
+4.  Exit the PostgreSQL shell by entering the `\q` command.
+
+### Create PostgreSQL Roles
+
+PostgreSQL grants database access via *roles* which are used to specify privileges. Roles can be understood as having a similar function to Linux "users." In addition, roles may also be created as a set of other roles, similar to a Linux "group." PostgreSQL roles apply globally, so you will not need to create the same role twice if you'd like to grant it access to more than one database on the same server.
+
+The example commands in this section should be run as the `postgres` Linux user.
+
+1.  Add a new user role, then a password at the prompt:
+
+        createuser examplerole --pwprompt
+
+    If you need to delete a role, you can use the `dropuser` command in place of `createuser`.
+
+2.  Connect to the database:
+
+        psql mytestdb
+
+    You'll be connected as the `postgres` database user by default.
+
+3.  From the PostgreSQL shell, enter the following to grant all privileges on the table `employees` to the user `examplerole`:
+
+        GRANT ALL ON employees TO examplerole;
+
+4.  Exit the PostgreSQL shell by entering `\q`.
+
+### Secure Local PostgreSQL Access
+
+PostgreSQL uses *peer authentication* by default. This means database connections will be granted to local system users that own or have privileges on the database being connected to. Such authentication is useful in cases where a particular system user will be running a local program (e.g. scripts, CGI/FastCGI processes owned by separate users, etc.), but for greater security, you may wish to require passwords to access your databases.
+
+Commands in this section should be run as the `postgres` Linux user unless otherwise specified.
+
+1.  Edit the `/etc/postgresql/9.5/main/pg_hba.conf` file, under the `# "local" is for Unix domain socket connections only` header:
+
+    {: .file-excerpt }
+    /etc/postgresql/9.5/main/pg_hba.conf
+    :   ~~~
+        # "local" is for Unix domain socket connections only
+        local    all        all             peer
+        ~~~
+
+    Replace `peer` with `md5` on this line to activate password authentication using an MD5 hash.
+
+2.  To enable these changes, we need to restart PostgreSQL. However, we did not grant the `postgres` user sudo privileges for security reasons. Return to the normal user shell:
+
+        exit
+
+3.  Restart PostgreSQL and switch back to the `postgres` user:
+
+        sudo service postgresql restart
+        su - postgres
+
+4.  As `postgres`, connect to the test database as the `examplerole` PostgreSQL user:
+
+        psql -U examplerole -W mytestdb
+
+    You will be prompted to enter the password for the `examplerole` user and given `psql` shell access to the database. When using a database, you may check access privileges for each of its tables with the `\z` command.

+ 1 - 0
host/mailcow.md

@@ -4,3 +4,4 @@
 - [https://mailcow.github.io/mailcow-dockerized-docs/](https://mailcow.github.io/mailcow-dockerized-docs/)
 - [https://forum.mailcow.email/](https://forum.mailcow.email/)
 - [https://github.com/mailcow](https://github.com/mailcow)
+- [https://github.com/mailcow/mailcow-dockerized](https://github.com/mailcow/mailcow-dockerized)

+ 10 - 0
lang/rails.md

@@ -1 +1,11 @@
 # Rails  
+
+- [http://rubyonrails.org/](http://rubyonrails.org/)
+- [https://github.com/rails/rails](https://github.com/rails/rails)
+
+
+
+```
+/// fix issue with mysql2 adapter
+sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib
+```

+ 3 - 0
software/_software.md

@@ -3,3 +3,6 @@
 * [Apple](apple.md)
 * [Sketch](sketch.md)
 * [Adobe](adobe.md)
+* [Chrome](chrome.md)
+* [Homebrew](brew.md)
+* [ngrok](ngrok.md)

software/adobe.md → localhost/adobe.md


software/apple.md → localhost/apple.md


software/brew.md → localhost/brew.md


software/chrome.md → localhost/chrome.md


+ 3 - 0
localhost/ngrok.md

@@ -0,0 +1,3 @@
+# ngrok  
+
+- [https://ngrok.com/docs](https://ngrok.com/docs)

software/sketch.md → localhost/sketch.md


+ 8 - 0
saas/linode.md

@@ -0,0 +1,8 @@
+# Linode  
+
+- [https://manager.linode.com](https://manager.linode.com)
+- [https://www.linode.com/docs/security/securing-your-server](https://www.linode.com/docs/security/securing-your-server)
+
+
+- [https://www.linode.com/docs/tools-reference/custom-kernels-distros/run-a-distribution-supplied-kernel-with-kvm](https://www.linode.com/docs/tools-reference/custom-kernels-distros/run-a-distribution-supplied-kernel-with-kvm)
+  - As of February, 2017, you can boot your Linode using your choice of Linode's own kernel or the upstream kernel provided by a distribution's maintainers. Booting with Linode's kernel is enabled by default, but changing to the distro-supplied kernel is easy. This is useful if you'd like to enable specific kernel features, or if you'd prefer to handle kernel upgrades yourself.

+ 1 - 0
server/_servers.md

@@ -7,6 +7,7 @@
 * [letsencrypt](letsencrypt.md)
 * [mail](mail.md)
 * [GoAccess](goaccess.md)
+* [Docker](docker.md)
 
 
 ## Personal Servers

+ 21 - 0
server/docker.md

@@ -0,0 +1,21 @@
+# Docker
+
+- [https://www.docker.com/](https://www.docker.com/)
+- [https://cloud.docker.com/app/windhamdavid](https://cloud.docker.com/app/windhamdavid)
+- [https://cloud.docker.com/swarm/windhamdavid/](https://cloud.docker.com/swarm/windhamdavid/)
+- [https://hub.docker.com/u/windhamdavid/](https://hub.docker.com/u/windhamdavid/)
+- [https://docs.docker.com/](https://docs.docker.com/)
+- [https://hub.docker.com/](https://hub.docker.com/)
+
+
+
+
+
+/// Because the image that Linode provides for Ubuntu 16.04 LTS has a custom Linux Kernel Installed in it. So we can’t install linux-image-extra package normally see [../saas/linode.md](../saas/linode.md)
+- [https://github.com/linode/docs/issues/480#issuecomment-231653920](https://github.com/linode/docs/issues/480#issuecomment-231653920)
+- [https://github.com/linode/docs/pull/575/files](https://github.com/linode/docs/pull/575/files)
+```
+apt-get install -y dmsetup
+dmsetup mknodes
+
+```

+ 5 - 0
til.md

@@ -1,5 +1,10 @@
 #TIL (Today I Learned)
 
+* June 2017
+	- [The Moby Project (docker blog)](https://blog.docker.com/2017/04/introducing-the-moby-project/)
+		- [https://mobyproject.org/](https://mobyproject.org/)
+	- [Docker Ubuntu 16.04 Linode issue](server/docker.md) and [Linode Kernel](saas/linode.md)  
+
 * May 2017
 	* [Node 8.x (Carbon) LTS release in October](https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V8.md#8.0.0)
 	* [NPM v5.0.1 release](lang/npm.md)